doorbot
doorbot copied to clipboard
Add support for Ring Alarm
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 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 - that would work.
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 Maybe I missed something, but the token should be stored on the class already:
https://github.com/davglass/doorbot/blob/master/doorbot.js#L296
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.
@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.
Thanks, Will test it over the weekend and let you know.
@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!
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 - many thanks. i think you're on the right track!