guerrerotook / securitas-direct-new-api

This repository contains the new securitas direct API that can be integrated in Home Assistant
Apache License 2.0
76 stars 30 forks source link

[CLOSED]New feature request - automating the Securitas OTP input #157

Closed bigramonk closed 7 months ago

bigramonk commented 10 months ago

Muy buenas,

I created an automation on my Android phone to recover the pin sent by Securitas and send it to a Home Assistant webhook where I set an input_text variable accordingly. From there, I send it to a specific Telegram group and do a copy/paste in the HA interface to allow the addon to connect to Securitas.

With an appropriate service, this could be fully automated and forgetting to re-instate the Securitas add-on upon restarting HA would no longer be an issue. If you think this would be feasible, I'd be more than happy to share how I extract and publish the pin to Home Assistant.

guerrerotook commented 10 months ago

You can disable the pin in Home Assistant. Also the pin in Home Assistant is not related to the Securitas Direct at all.

bigramonk commented 10 months ago

I am talking about the OTP that you receive by SMS from Securitas, not the code of the alarm. Every time Home Assistant is restarted, you need to ask Securitas to re-issue that 6 digit pin to authorize the addon to connect to Securitas.

guerrerotook commented 10 months ago

But that is something else, no one need to reenter the otp authentication once you successfully authenticated with Securitas. Actually that was an issue when they introduced this otp challenge.

For you information that was the original issue when I worked on this.

57

So there is something wrong with your integration. Did you update to the latest version?

bigramonk commented 10 months ago

Yes, I'm running v2.3.0.0. I completely removed the integration, rebooted HA and all addons, re-installed the integration but I still have to go thru the OTP challenge after every HA restart: image image image Here is what I get in the log:

2023-10-23 20:38:13.943 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration securitas which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2023-10-23 20:38:46.404 WARNING (SyncWorker_4) [homeassistant.helpers.service] Unable to find services.yaml for the securitas integration 2023-10-23 20:38:49.233 WARNING (MainThread) [homeassistant.components.alarm_control_panel] Setup of alarm_control_panel platform securitas is taking over 10 seconds. 2023-10-23 20:40:10.192 ERROR (MainThread) [custom_components.securitas.securitas_direct_new_api.apimanager] Unauthorized

If it is not the expected behavior, I'd be very grateful to learn how to solve this issue 😃

guerrerotook commented 10 months ago

That is very weird, because for everyone they reboot their home assistants installation and they don't need to re authenticate again. Also for me as well.

To be honest I don't know what to do!

bigramonk commented 10 months ago

Since upgrading to 2.4.0.0 I do not have to enter the Securitas OTP :grin: ¡Gracias Luis!