palazzem / ha-econnect-alarm

Home Assistant integration that provides a full-fledged Alarm Panel to control your Elmo/IESS alarm systems.
BSD 3-Clause "New" or "Revised" License
10 stars 5 forks source link

fix(entity): state transitions support users configurations #32

Closed palazzem closed 9 months ago

palazzem commented 9 months ago

Related Issues

Proposed Changes:

This change introduces AlarmDevice.get_state() that maps activated sectors with HA compatible states. If users configure the integration to set ALARM_HOME = [3, 4], the state is set to HOME if sectors 3 and 4 are armed.

The transition happens immediately after the command is triggered, and when the AlarmDevice updates its state through the update() call.

Testing:

To test this PR, configure a alarm home and night options, then enable alarm home and then switch to night.

Extra Notes (optional):

Some refactoring has been done to organize better the changes.

Checklist