Giter Club home page Giter Club logo

ringsnapshotdownload's Introduction

licence badge stars badge forks badge issues badge .NET Core

Ring Snapshot Download Tool

Console application written in .NET 6 compiled for Windows, Raspberry Pi, Linux and macOS which allows for downloading of Ring snapshots to your local machine.

Version History

2.1.0.0 - September 3, 2023

  • Modified the error handling while downloading an image slightly

2.0.0.0 - September 3, 2023

  • Completely removed the dependance on the Ring API package. Only kept a bare minimum version of the model inside this application to avoid conflicts and parsing issues as much as possible.
  • Fixed an issue with the OSX x64 build
  • Added an OSX ARM64 build

1.4.0.0 - September 2, 2023

  • Added -validateimage option that will check if the downloaded image is valid
  • Upgraded to Ring API v0.5.3.0

1.3.0.0 - July 4, 2023

1.2.0.0 - September 14, 2022

1.1.1.0 - September 14, 2022

1.1.0.2 - July 5, 2021

  • Added additional error handling around reading the config file
  • Fixed an issue with reading from the config file on non Windows environments

1.1.0.1 - July 5, 2021

  • Changed configuration handling as the old method wasn't working well in .NET 5. The settings are now stores in Settings.json in the same folder from where you run the tool. Any parameters you provide will be stored in this config file, so you don't have to supply them again on subsequent runs. This new configuration is not backwards compatible with the previous configuration, so if you're upgrading, log in once by providing your username and password via the commandline and the values will get stored in the new config file.

1.1.0.0 - July 4, 2021

  • Updated to .NET 5.0

1.0.2.0 - June 23, 2020

  • Bugfix in two factor authentication not working
  • Bugfix in the counter potentially not showing the proper amount of devices when using -list
  • Added notice if the two factor authentication fails due to too many recent requests for it

1.0.1.0 - April 29, 2020

  • Changed some async handling of downloads
  • Added check with the Ring API on when the latest available camera capture was taken and use that timestamp in the file so if there is no newer image available, the old one will be overwritten
  • Added a one second delay after doing a force refresh to allow the Ring API to fetch an update from the doorbell
  • Added -maxretries optional flag which allows specifying how many times to retry fetching the snapshot with 1 second intervals if the Ring API returns an error. This happens when Ring has no recent snapshot of your Ring device on file and it couldn't retrieve a new one from the Ring device yet.
  • Updated Ring API to 0.4.3.2

1.0.0.1 - February 14, 2020

  • Ring 2 doorbells will now also be returned when doing a -list

1.0.0.0 - February 13, 2020

  • Initial version

System Requirements

  • Either of: Windows x86, Windows x64, Windows ARM (i.e. Windows 10 IoT), Linux ARM (i.e. Raspberry Pi), Linux x64 (any Linux based distribution), Mac OS (Apple devices)
  • For all platforms the application is self containing, so it does not need anything else to be installed on the operating system, not even .NET Core

Usage Instructions

  1. Download the ZIP file of the latest version from releases. Make sure you download the right type for the platform on which you want to run it:
    • Windows 7 SP1 or later, Windows 8.1, Windows 10 version 1607 or later, Windows 11, Windows Server 2012 R2 or later: win-x64.zip (64 bit) or win-x86.zip (32 bit)
    • Linux ARM (i.e. Raspberry Pi): linux-arm.zip (32 bit) or linux-arm64.zip (64 bit)
    • Linux x64 (any Linux based distribution): linux-x64.zip
    • Mac OSX (Apple devices): osx-x64.zip or osx-arm64.zip
  2. Extract it to any location on your machine
  3. Run RingSnapshotDownload.exe in a Command Prompt or PowerShell window to see the possible parameters and samples

If you want to run this application unattended in i.e. a scheduled daily download script, ensure you run it once manually with your username and password. After this run it will store the refresh token in a file called Settings.json and will run without needing a username, password or two factor authentication token on subsequent runs.

Current functionality

With this tool in its current state you can:

  • Log on once to a two factor authentication enabled Ring account and then have it use the retrieved refresh token to run unattended on subsequent runs
  • Download the latest snapshot from your Ring device
  • List all Ring doorbells and Ring stickupcams you have available under your Ring account
  • Force the Ring device to capture a fresh snapshot

Feedback

Any kind of feedback is welcome! Feel free to drop me an e-mail at [email protected] or create an issue.

ringsnapshotdownload's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ringsnapshotdownload's Issues

[BUG] Unhandled exception in list operation windows

Describe the bug
When running command in windows with list parameter getting an unhandled exception

To Reproduce
Steps to reproduce the behavior:

  1. Run RingDownloader --list

**Message Received

Ring Snapshot Download Tool v1.3.0.0 by Koen Zomers

Using settings from V:\win-x64\Settings.json
Connecting to Ring services
Authenticating using refresh token from previous session
Retrieving all devices... Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.Int64]. Path: $.stickup_cams[1].battery_voltage_2 | LineNumber: 0 | BytePositionInLine: 46919. ---> System.FormatException: Either the JSON value is not in a supported format, or is out of bounds for an Int64. at System.Text.Json.Utf8JsonReader.GetInt64() at System.Text.Json.Serialization.Converters.Int64Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at KoenZomers.Ring.Api.Session.GetRingDevices()
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)

[BUG] Not working in OSX Ventura 13.5.2 on M1 Pro

Describe the bug
When I attempt to run ./RingSnapshotDownload, no matter what I do with permissions, it returns:
zsh: killed ./RingSnapshotDownload

To Reproduce
Steps to reproduce the behavior:

  1. Modify Settings.json to include RingUsername, RingPassword
  2. Open Terminal
  3. Change directory to directory where RingSnapshotDownload is
  4. run ./RingSnapshotDownload
  5. returns: zsh: killed ./RingSnapshotDownload

Expected behavior
Downloads image, or when using -list provides list of Ring devices

Screenshots
None

Versions (please complete the following information):

  • OS: Ventura 13.5.2 on M1 Pro chip
  • RingSnapshotDownload: osx-arm64

[BUG] Unhandled Exception

Hi,
I get this when I try and retrieve a list.

I've tried both 64bit and x86 versions on Windows 10.

Thanks.

Ring Snapshot Download Tool v2.1.0.0 by Koen Zomers

Connecting to Ring services
Authenticating using provided username and password
Unhandled exception. System.Text.Json.JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) at System.Text.Json.Utf8JsonReader.ReadSingleSegment() at System.Text.Json.Utf8JsonReader.Read() at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at KoenZomers.Ring.Api.Session.Authenticate(String operatingSystem, String hardwareId, String appBrand, String deviceModel, String deviceName, String resolution, String appVersion, Nullable`1 appInstallationDate, String manufacturer, String deviceType, String architecture, String language, String twoFactorAuthCode)
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)

Not working in Windows 11

Am I correct that I will not be able to run this on a Windows 11 machine?

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • OS: [e.g. Windows 10/Raspbian/etc]
  • RingSnapshotDownload:

[BUG] Latest osx release is failing to parse response from Ring

Describe the bug
Downloaded latest osx asset to list devices on account, provided username password and 2FA and application throws exception unable to parse JSON output.

To Reproduce
Steps to reproduce the behavior:

  1. Download osx-x64.zip from https://github.com/KoenZomers/RingSnapshotDownload/releases/tag/1.2.0.0
  2. Extract and run ./RingSnapshotDownload -username $RING_USERNAME -password $RING_PASSWORD -list
  3. Provide 2FA code
  4. See error
Retrieving all devices... Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable`1[System.Int64]. Path: $.stickup_cams[0].latitude | LineNumber: 0 | BytePositionInLine: 6908.
 ---> System.FormatException: Either the JSON value is not in a supported format, or is out of bounds for an Int64.
   at System.Text.Json.Utf8JsonReader.GetInt64()
   at System.Text.Json.Serialization.Converters.Int64Converter.Read(Utf8JsonReader& , Type , JsonSerializerOptions )
   at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& , Type , JsonSerializerOptions )
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& )
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , TCollection& )
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& )
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , Utf8JsonReader& , Exception )
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 , JsonTypeInfo , Nullable`1 )
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 , JsonTypeInfo )
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String , JsonSerializerOptions )
   at KoenZomers.Ring.Api.Session.GetRingDevices()
   at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
   at KoenZomers.Ring.SnapshotDownload.Program.<Main>(String[] args)

Expected behavior
Binary runs without error and lists devices on account

Screenshots
n/a

Versions (please complete the following information):

[FEATURE REQUEST] Linux ARM64 version

Is your feature request related to a problem? Please describe.
First off, great work on the API and this wrapper for it!
Unfortunately the Linux ARM binary does not work on Raspberry Pi 4 with Ubuntu 20.04 without 32bit libraries installed (which I believe is the default).

Describe the solution you'd like
It would be great to have a Linux ARM64 version in addition to the ‘regular’ 32bit ARM version.

Describe alternatives you've considered
I have considered creating this myself using the source code but would be better to have this available on this repo.

Additional context

[BUG] On Linux ARM getting JSON Exception with -list operation

Describe the bug
Running on Linux ARM with -list action getting the following error:

Connecting to Ring services
Authenticating using refresh token from previous session
Retrieving all devices... Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.Int32]. Path: $.doorbots[0].battery_life | LineNumber: 0 | BytePositionInLine: 173. ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number. at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& ) at System.Text.Json.Utf8JsonReader.GetInt32() at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& , Type , JsonSerializerOptions ) at System.Text.Json.Serialization.Converters.NullableConverter1.Read(Utf8JsonReader& , Type , JsonSerializerOptions )
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& ) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , TCollection& )
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object , ReadStack& , Utf8JsonReader& )
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& ) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& , Type , JsonSerializerOptions , ReadStack& , T& )
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& ) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& , Utf8JsonReader& , Exception ) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& , JsonSerializerOptions , ReadStack& )
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 , JsonTypeInfo , Nullable1 )
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 , JsonTypeInfo )
at System.Text.Json.JsonSerializer.Deserialize[TValue](String , JsonSerializerOptions )
at KoenZomers.Ring.Api.Session.GetRingDevices()
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)
Aborted

Expected behavior
Error should be handled with error handling, also should output contents of JSON object if error occurs to allow for fixing of issue.

Versions (please complete the following information):

  • OS: Raspian
  • RingSnapshotDownload: Version 1.2.0.0

validation of downloaded snapshots

It often happens to me that the downloaded snapshots are not valid or corrupted, which has nothing to do with the tool I guess.

It would be great to actually check the downloaded files automatically and if corrupted get a fresh download. Don't know if this is possible but would be great.
What am I using the tool for: Downloading snapshots of my 4 devices every 5 minutes, copy the latest ones on my NAS so I can fetch the with my light manager and make them visible on the Cloud WebIF. Automatically delete all old jpeg except the latest one by using shellscripts and crontab.
I used iobroker before with the ring adapter, but every couple of days it stopped working, and I had to reboot the machine. All running on a raspi 4 with bullseye image.

By the way: fantastic work you delivered here!!!!!!!!!!!!!!!

[BUG] No devices found

Describe the bug
When running RingSnapshotDownload.exe with username, password and list parameters, the result is:

Connecting to Ring services
Authenticating using refresh token from previous session
Retrieving all devices... Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at KoenZomers.Ring.SnapshotDownload.Program.Main(String[] args)
at KoenZomers.Ring.SnapshotDownload.Program.

(String[] args)

Seems like await session.GetRingDevices(); is returning null instead of devices

The issue seems to be caused by the API:

Unexpected character encountered while parsing value: {. Path 'stickup_cams[0].motion_snooze', line 1, position 8408.

"motion_snooze": { "scheduled": true },

To Reproduce
Steps to reproduce the behavior:

  1. Run RingSnapshotDownload.exe -username [email protected] -password xxxxxx -list

Expected behavior
No error, snapshot downloaded

Screenshots
89105176-2222c480-d41f-11ea-9d3b-4953140adf38

Versions (please complete the following information):

  • OS: Windows 10 2004
  • RingSnapshotDownload: v1.0.2

authcode request permanent

Hello, I have written a batch in which I retrieve an image every 60 seconds with forceupdate. unfortunately, after about 10 snapshots I always get the 2-factor query for the code again. am I querying too often? can I solve it differently?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.