Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(device): avoid state update while arming or disarming #155

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

palazzem
Copy link
Owner

@palazzem palazzem commented Mar 5, 2024

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

  • Related issues and proposed changes are filled
  • Tests are defining the correct and expected behavior
  • Code is well-documented via docstrings

@palazzem palazzem added this to the 2.4.0 milestone Mar 5, 2024
@palazzem palazzem self-assigned this Mar 5, 2024
@coveralls
Copy link

coveralls commented Mar 5, 2024

Pull Request Test Coverage Report for Build 8189992854

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.007%) to 93.986%

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

💛 - Coveralls

@palazzem palazzem force-pushed the palazzem/issue-154 branch from e4fd86d to 8c1a4ca Compare March 7, 2024 13:26
@palazzem palazzem force-pushed the palazzem/issue-154 branch from 8c1a4ca to 67bbc44 Compare March 7, 2024 14:44
@palazzem palazzem merged commit cc43a7a into main Mar 7, 2024
5 checks passed
@palazzem palazzem deleted the palazzem/issue-154 branch March 7, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Alarm state moves between states when activated via HomeKit
2 participants