doorbot icon indicating copy to clipboard operation
doorbot copied to clipboard

Add support for Ring Alarm

Open joeyberkovitz opened this issue 6 years ago • 11 comments

joeyberkovitz avatar Jul 22 '18 23:07 joeyberkovitz

as noted in https://github.com/davglass/doorbot/issues/26#issuecomment-432017925, et. seq., i am thinking that we should have a seperate repo for this, viz., https://github.com/homespun/ring-alarm

mrose17 avatar Oct 25 '18 19:10 mrose17

@mrose17 To make sure they stay in sync, I could export the main class and you could require and extend it with the new attributes. Then if I change up the authentication or fix a bug they don't have to be done in both places..

davglass avatar Oct 25 '18 19:10 davglass

@davglass - that would work.

mrose17 avatar Oct 25 '18 19:10 mrose17

Sounds good. In that case, would it make sense to store the oauth token from the auth functions so that the extended classes can use it without having to replace the auth functions?

joeyberkovitz avatar Oct 25 '18 19:10 joeyberkovitz

@joeyberkovitz Maybe I missed something, but the token should be stored on the class already:

https://github.com/davglass/doorbot/blob/master/doorbot.js#L296

davglass avatar Oct 25 '18 20:10 davglass

That's a token, but not the original oauth token. This PR store the oauth token as well as the token used by the API line 287. To access the alarm APIs, the original oauth token is needed.

joeyberkovitz avatar Oct 25 '18 21:10 joeyberkovitz

@mrose17 @joeyberkovitz I pushed up a branch in #37 that you can test for extending. Let me know if I need to refactor anything else to help.

davglass avatar Oct 26 '18 12:10 davglass

Thanks, Will test it over the weekend and let you know.

joeyberkovitz avatar Oct 26 '18 13:10 joeyberkovitz

@joeyberkovitz - can you do me a favor and try out https://github.com/homespun/ring-alarm, viz.,

DEBUG=ring-alarm.station RING_USERNAME=... RING_PASSPHRASE=... node test.js

and let it run for a day or so until the websocket closes. i'm seeing an issue in re-establishing the websocket. i'm not quite sure how to solve it... thanks!

mrose17 avatar Oct 26 '18 13:10 mrose17

Running. Will let you know how it goes. Suspect that there may be a need to refresh the initial Oauth token and request a new alarm token.

joeyberkovitz avatar Oct 26 '18 13:10 joeyberkovitz

@joeyberkovitz - many thanks. i think you're on the right track!

mrose17 avatar Oct 26 '18 13:10 mrose17