guerrerotook / securitas-direct-new-api

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

Support for PERI alarms #197

Closed cantupaz closed 8 months ago

cantupaz commented 8 months ago

to resolve this issue: https://github.com/guerrerotook/securitas-direct-new-api/issues/193

guerrerotook commented 8 months ago

Hey @cantupaz, is this ready for review?

cantupaz commented 8 months ago

Yes. Let me explain what I did.

In the API manager I tried to capture the possible states that the alarm can have (in securitas_direct_new_api/const.py). This is by looking at the securitas app and website, independent of HA. Then I map those states (like AlarmStates.total_armed) to the commands we need to send in the API ("ARM1" ). The mapping of states to commands can be different depending on having a peri alarm, so that's a parameter to the ApiManager.

In this version, the HA integration doesn't use the commands at all. It uses the AlarmStates and lets the ApiManager figure which mapping from states to commands it needs to use.

I changed the login form a little to add the option for peri and to make some text clearer (I hope). Same with the options form.