ptz0n / homebridge-securitas-direct

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

No response with the beta plugin. #1

Open artik opened 3 years ago

artik commented 3 years ago

Tried the first beta version of the plugin. Homekit returns me a no response answer. Here are my credentials:

        {
            "platform": "securitas-direct",
            "name": "Securitas Direct",
            "username": "20*****",
            "password": "************",
            "country": "es",
            "installation": "13*****",
            "pollInterval": 60
        }

When I use my credentials on the website https://customers.securitasdirect.es/, I can connect without issue and manage my homes. Homebridge logs return me:

[Securitas Direct] Initializing securitas-direct platform...
[Securitas Direct] info Alarm: Getting current alarm state.

I noticed that you put and email as login in your readme, but I have a number of 7 digits instead.

https://i.imgur.com/WA77x9F.png

ptz0n commented 3 years ago

Thanks for trying it out! 🎉

I’ll make sure to update the readme.

Have you tested arming/disarming the different states too?

artik commented 3 years ago

arming/disarming are greyed on homekit and cannot be controled. I tested to do it trought homebridge accessories section. Changing state worked one time, notification appeared on my phone with this log:

[11/30/2020, 12:17:13 PM] [Securitas Direct] info Alarm: Getting current alarm state.
[11/30/2020, 12:17:15 PM] [Securitas Direct] info Alarm: Setting target alarm state to: 0

But! Didn't affect the real state of the alarm on securitas.es. Still activated there.

ptz0n commented 3 years ago

Sorry if I was unclear. You should not use your email address as the readme implies. Please put in the username as on securitas.es.

artik commented 3 years ago

Yeah sure, it's what I did (cf: my first message). I'm using the 7 digits as login and never tried any email.

ur0 commented 3 years ago

As another piece of feedback on this issue, the plug-in works reliably for arming and disarming the security system, from both the Home app and from Siri.

One issue that I currently face is that it eventually stops working, the alarm state doesn’t synchronise with the UI and arming or disarming doesn’t work anymore.

I can eventually hook this up to a proxy and log the requests/responses if that helps. I’m guessing some rate limiting is kicking in, perhaps due to the polling for alarm status. The Securitas Direct app has an option to view an audit log, and I can see that they stop logging requests some time after homebridge starts (5-20 minutes).

ptz0n commented 3 years ago

I’m guessing there might be an issue with the session timing out and we need to login again. Taking a closer look 👍🏼

ptz0n commented 3 years ago

Looking at this plugin (which uses a deprecated API and won't work for most users); they seem to refresh the hash/token every 450 seconds.

I'm aiming for a strategy where we are catching the expired hash response to refresh only when needed.

ptz0n commented 3 years ago

Please update to plugin v0.2.0 and try again 👍

artik commented 3 years ago

I'm still having many issues regarding the No Response state. Sometimes it works, and when I try to change the alarm state, no response again. It's really random and Homebridge logs don't show any error. At least when it works, arming/disarming works.

ptz0n commented 3 years ago

HomeKit is quite picky with response times. In our case, Securitas Direct is slow at responding, as we need to query and then ask for the result multiple times until we finally get it.

Please make sure that your Homebridge instance is on a cable connection to minimise latency.

When testing, are you interacting from the same network or remotely?

maxesse commented 3 years ago

Hello, I’m also getting the exact same issue. Works fine for a while then it stops working - even using the MyVerisure app it fails to update status. I think it’s hitting rate limits. Perhaps I’d suggest to add some verbose logging to the plug-in so we can see the exact error code they (hopefully) return?

ptz0n commented 3 years ago

Good thinking. Let's investigate that a bit. I'll setup more verbose logging.