ptz0n / homebridge-securitas-direct

https://www.npmjs.com/package/homebridge-securitas-direct
MIT License
7 stars 3 forks source link

Reduce number of calls to server #7

Open joaodforce opened 3 years ago

joaodforce commented 3 years ago

This plugin is very cool, I liked it a lot. However I'm having a couple of issues.

1st, I noticed that the plugin queries the server too many times, which generates a huge load on the bridge, and floods the action history on Verisure's panel. I have homebridge-gsh, i don't know if maybe it is influencing this behavior.

I see that there is is a pooling interval setting, to improve this perhaps the plugin should debounce status updates by the same time as the pooling interval, or perhaps to a fixed rate. Ex: if the plugin is requested to update the status 200 times within 10 seconds, only do one request, and return the same value during the timeout period.

Homebridge also reports that the status request take too long to respond, thats probably because of how long the api normally takes to respond. A possible solution to this is return the current status immediately, and request a status update, and provide it in a future status request.

2nd, I could not change the alarm mode, it reported the current status correctly, but I tried disarming it, and then the plugin stopped responding, I checked the Logs to see if there were some errors, but there was nothing there. Maybe the disarm API changed? I took a look at the code, but didn't manage to figure it out yet. I might contribute if I find something else about it.

enzofrnt commented 2 years ago

HI, some evolution for you ? have you try to make it work ? I really need this plugin.. and if you can or someone or together we can make it work great and better go ! I'm sure there is a lot of people they wan't to see it work great.

joaodforce commented 2 years ago

HI, some evolution for you ? have you try to make it work ? I really need this plugin.. and if you can or someone or together we can make it work great and better go ! I'm sure there is a lot of people they wan't to see it work great.

Nah, I have up on that route, Securita's back end and communication with the alarm central is just too slow to be reliable.

I am working however in an alternative solution, but its very hacky, basically my plan is to use a ESP32 microcontroller to interface with the remote controller buttons and LEDs, and then use it as an actual home kit sensor.

Seems like it will work nicely, since the Remotes middle button asks for the status, I can even check if there is a zone open via the remote.

ptz0n commented 2 years ago

@joaodforce Caching and debouncing the arm state could make it work more reliable.

A combination of optimistic updates and caching, keeping the polling interval and adding debounce timeout as config options.

PS. I have a feeling that the SD installation communicates via SMS, which may explain the unreliable and slow interface. DS.