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(device): avoid state update while arming or disarming #155

Closed palazzem closed 6 months ago

palazzem commented 6 months ago

Related Issues

Proposed Changes:

This change fixes a race condition that happens when the device arms the system, but before this happens an update is triggered and brings the system to a wrong state. Furthermore, avoids the AlarmDevice to set "Arm Away" wrong state.

Testing:

From "disarm", trigger the "arm home" state and be sure it doesn't transition back to "disarm", or in a wrong "arm away" state.

Extra Notes (optional):

This change creates a dependency between the AlarmDevice and the arm/disarm caller as it is expected who calls one of these methods, to set the right ending state. While this is not great and would be better to decouple it, it's a good enough solution. At some point, we may want to remove AlarmDevice transforming it in an actual entity.

Checklist

coveralls commented 6 months ago

Pull Request Test Coverage Report for Build 8189992854

Details


Totals Coverage Status
Change from base Build 8189954330: 0.007%
Covered Lines: 674
Relevant Lines: 721

đź’› - Coveralls