Version 1.0.3 available for testing

ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Version 1.0.3 available for testing

Post by ZachBenz »

To try it out:
Please report any issues here or feel free to file an issue on Github.
ZachBenz's Plugins: RingForIndigo
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

Also now available via the Plugin Store
ZachBenz's Plugins: RingForIndigo
autolog
Posts: 3996
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK [GMT aka UTC]
Contact:

Re: Version 1.0.3 available for testing

Post by autolog »

Hi Zach,
Installed 1.0.3 from Plugin Store. Adding a new device, still doesn't show any Ring devices. So I duplicated my Front doorbell and edited it to select the Back doorbell from the pull-down list and then saved it. Got the errors below, so I then reloaded the plugin.
Ring Error Error in plugin execution GetUiDynamicList:

Traceback (most recent call last):
File "plugin.py", line 304, in currentMappedPlusUnmappedRingDevices
KeyError: key address not found in dict

SQL Logger deleting table device_history_1446833696
SQL Logger creating table device_history_100580596 for "Ring Doorbell - Front Door copy"
SQL Logger Error exception trying to insert row into table device_history_100580596 ("Ring Doorbell - Front Door copy") -- unable to modify table
SQL Logger Error ERROR: value "6775809241619145768" is out of range for type integer at character 474

SQL Logger Error INSERT INTO device_history_100580596 ("lastdoorbellpresstime", "lasteventid", "lasteventkind", "lasteventtime", "lastmotiontime", "onoffstate", "ringdevicebatterylevel", "ringdevicefamily", "ringdevicefirmware", "ringdeviceid", "ringdevicelocation", "ringdevicemodel", "ringdevicename", "ringdevicetimezone", "ringdevicevolume", "ringdevicewifimacaddress", "ringdevicewifinetwork", "ringdevicewifisignalstrength", "waslasteventanswered") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);


29 Dec 2019 at 11:59:18
Reloading plugin "Ring 1.0.3"
Stopping plugin "Ring 1.0.3" (pid 45679)
Stopped plugin "Ring 1.0.3"
Starting plugin "Ring 1.0.3" (pid 46076)
Started plugin "Ring 1.0.3"
Events are now being detected and matched against the correct Indigo device. :)

However, the lag is really quite long (~60 seconds) and this is after I modded the plugin to set the sleep timer to 5 seconds. The iOS Ring App gets notified within a few seconds of the doorbells being pushed and likewise with the motion detection.

I then noticed other errors in the log:
SQL Logger Error exception trying to insert row into table device_history_100580596 ("Ring Doorbell - Back Door") -- unable to modify table
SQL Logger Error ERROR: value "6775830815233653853" is out of range for type integer at character 62

SQL Logger Error INSERT INTO device_history_100580596 ("lasteventid") VALUES (%s);


Ring Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 128, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 56, in update
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 103, in _get_health_attrs
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 200, in query
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 113, in _get_oauth_token
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/auth.py", line 71, in refresh_tokens
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests_oauthlib/oauth2_session.py", line 446, in refresh_token
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
InvalidGrantError: (invalid_grant) The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.

Ring Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)


SQL Logger Error exception trying to insert row into table device_history_100580596 ("Ring Doorbell - Back Door") -- unable to modify table
SQL Logger Error ERROR: value "6775831296269991005" is out of range for type integer at character 62

SQL Logger Error INSERT INTO device_history_100580596 ("lasteventid") VALUES (%s);

ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

autolog wrote: Traceback (most recent call last):
File "plugin.py", line 304, in currentMappedPlusUnmappedRingDevices
KeyError: key address not found in dict
I think I see the problem now - my logic is faulty in one condition when getting devices for the list. Fixing that...
ZachBenz's Plugins: RingForIndigo
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

autolog wrote: I then noticed other errors in the log
Hmm... the refresh token is invalid. Hadn't seen this one before, but looks similar to other oauth issues discussed on tchellomello's repo. I've filed an issue to look into this.

Annoyingly (from a debugging perspective), I am not currently getting errors like this on either my development or production system. For what its worth, in not experiencing the errors, my refresh rate is ~5 seconds... which suggests the error is correlated with the delay in updating.

Thanks so much for testing things out!
ZachBenz's Plugins: RingForIndigo
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

ZachBenz wrote:
autolog wrote: Traceback (most recent call last):
File "plugin.py", line 304, in currentMappedPlusUnmappedRingDevices
KeyError: key address not found in dict
I think I see the problem now - my logic is faulty in one condition when getting devices for the list. Fixing that...
Ok, just pushed out 1.0.4 to Github and the Plugin Store, which should hopefully fix this (you can test by deleting your second doorbell then trying to re-add it).
ZachBenz's Plugins: RingForIndigo
autolog
Posts: 3996
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK [GMT aka UTC]
Contact:

Re: Version 1.0.3 available for testing

Post by autolog »

ZachBenz wrote:Ok, just pushed out 1.0.4 to Github and the Plugin Store, which should hopefully fix this (you can test by deleting your second doorbell then trying to re-add it).
That works - Back doorbell deleted and re-added OK. :D

The doorbell and motion is still taking about a minute to register on the Indigo device. However the actual state time for the doorbell press / motion detected seems to be accurate (more or less).

Example,: LastEventTime = ... 16:46:15 UTC and the state updated at about 16:47:20 UTC

Good progress - Well done and thanks for your efforts! :)
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

autolog wrote: That works - Back doorbell deleted and re-added OK. :D
Excellent!
autolog wrote:The doorbell and motion is still taking about a minute to register on the Indigo device. However the actual state time for the doorbell press / motion detected seems to be accurate (more or less).

Example,: LastEventTime = ... 16:46:15 UTC and the state updated at about 16:47:20 UTC

Good progress - Well done and thanks for your efforts! :)
Are you still seeing the refresh token error?
ZachBenz's Plugins: RingForIndigo
autolog
Posts: 3996
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK [GMT aka UTC]
Contact:

Re: Version 1.0.3 available for testing

Post by autolog »

ZachBenz wrote:... Are you still seeing the refresh token error?
No I am not - I have only seen it once as previously reported.

I wonder if it might have been something to do with duplicating the Front Door Bell and then editing the copy to make it a back doorbell? :)
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

autolog wrote:I wonder if it might have been something to do with duplicating the Front Door Bell and then editing the copy to make it a back doorbell? :)
I don't think that should make a difference, but I suppose worth trying deleting both devices, disabling plugin, deleting preferences file for plugin, re-enabling plugin, and then finally re-adding devices. Totally understand if you don't want to go through doing all this! :D
ZachBenz's Plugins: RingForIndigo
autolog
Posts: 3996
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK [GMT aka UTC]
Contact:

Re: Version 1.0.3 available for testing

Post by autolog »

No problem - I will report back shortly :)
autolog
Posts: 3996
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK [GMT aka UTC]
Contact:

Re: Version 1.0.3 available for testing

Post by autolog »

Took slightly long than I thought as I had to sort out some triggers and a Control Page. :|

<INDIGO FEATURE REQUEST>Don't delete triggers and Control pages when invoking device is deleted - allow a no-op type device to be assigned</INDIGO FEATURE REQUEST>

Now back on-topic :wink: ...

Deleted Ring Doorbell devices and then disabled plugin:
Disabling plugin "Ring 1.0.4"
Stopping plugin "Ring 1.0.4" (pid 72119)
Ring Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 123, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 308, in doorbells
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 284, in __devices
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 33, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 56, in update
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 103, in _get_health_attrs
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 221, in query
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests/sessions.py", line 546, in get
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests/sessions.py", line 533, in request
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests/sessions.py", line 646, in send
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests/adapters.py", line 416, in send
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests/adapters.py", line 228, in cert_verify
IOError: Could not find a suitable TLS CA certificate bundle, invalid path: /Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/certifi/cacert.pem

Ring Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Stopped plugin "Ring 1.0.4"
Restarted the plugin Ok, added a new doorbell device (Front) which worked OK. I then duplicated the Front Doorbell and got the error below:
SQL Logger creating table device_history_744129089 for "Doorbell - Front copy"
SQL Logger Error exception trying to insert row into table device_history_744129089 ("Doorbell - Front copy") -- unable to modify table
SQL Logger Error ERROR: value "6775891258314630184" is out of range for type integer at character 474

SQL Logger Error INSERT INTO device_history_744129089 ("lastdoorbellpresstime", "lasteventid", "lasteventkind", "lasteventtime", "lastmotiontime", "onoffstate", "ringdevicebatterylevel", "ringdevicefamily", "ringdevicefirmware", "ringdeviceid", "ringdevicelocation", "ringdevicemodel", "ringdevicename", "ringdevicetimezone", "ringdevicevolume", "ringdevicewifimacaddress", "ringdevicewifinetwork", "ringdevicewifisignalstrength", "waslasteventanswered") VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);
After editing duplicate [Front] to Back Doorbell and saving it, got the following error:.
SQL Logger Error exception trying to insert row into table device_history_744129089 ("Doorbell - Back") -- unable to modify table
SQL Logger Error ERROR: value "6775903507555138653" is out of range for type integer at character 62

SQL Logger Error INSERT INTO device_history_744129089 ("lasteventid") VALUES (%s);

After pressing the Back doorbell, I got this error:
SQL Logger Error exception trying to insert row into table device_history_744129089 ("Doorbell - Back") -- unable to modify table
SQL Logger Error ERROR: value "6775915679492455517" is out of range for type integer at character 62

SQL Logger Error INSERT INTO device_history_744129089 ("lasteventid") VALUES (%s);
States seem to be updating OK but still with the ~60m seconds delay.

Refresh's token error has not occurred again. :)
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

autolog wrote: After pressing the Back doorbell, I got this error:
SQL Logger Error exception trying to insert row into table device_history_744129089 ("Doorbell - Back") -- unable to modify table
SQL Logger Error ERROR: value "6775915679492455517" is out of range for type integer at character 62

SQL Logger Error INSERT INTO device_history_744129089 ("lasteventid") VALUES (%s);
States seem to be updating OK but still with the ~60m seconds delay.

Refresh's token error has not occurred again. :)
Thanks for the detailed logs! Ok, so looks like treating eventIDs as integers isn't compatible with the SQL Logger plugin. I'll change them to strings. I also need to more cleanly shutdown the plugin.

Going to fiddle a bit to see if I can't figure out what is going on with the ~60 second delay...
ZachBenz's Plugins: RingForIndigo
autolog
Posts: 3996
Joined: Tue Sep 10, 2013 3:07 am
Location: West Sussex, UK [GMT aka UTC]
Contact:

Re: Version 1.0.3 available for testing

Post by autolog »

I spoke too soon :| - this error just popped up:
29 Dec 2019 at 18:36:54
Ring Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 123, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 308, in doorbells
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 284, in __devices
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 33, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 56, in update
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/generic.py", line 103, in _get_health_attrs
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 200, in query
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/__init__.py", line 113, in _get_oauth_token
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/ring_doorbell/auth.py", line 71, in refresh_tokens
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/requests_oauthlib/oauth2_session.py", line 446, in refresh_token
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/parameters.py", line 438, in validate_token_parameters
File "/Library/Application Support/Perceptive Automation/Indigo 7.4/Plugins/RingForIndigo.indigoPlugin/Contents/Server Plugin/oauthlib/oauth2/rfc6749/errors.py", line 405, in raise_from_error
InvalidGrantError: (invalid_grant) The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.

Ring Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
I wasn't doing anything with the doorbells at the time. :)
ZachBenz
Posts: 163
Joined: Sat Feb 08, 2014 9:17 am

Re: Version 1.0.3 available for testing

Post by ZachBenz »

autolog wrote:I spoke too soon :| - this error just popped up:
Thanks - I'll keep trying to reproduce this.

In the meantime, I have been able to reproduce the ~60s delay in getting event updates from Ring. No solution yet, but at least now I can debug it. :)
ZachBenz's Plugins: RingForIndigo
Locked

Return to “RingForIndigo”