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): discard Cloud APIs empty states (connection resets) #153

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

palazzem
Copy link
Owner

@palazzem palazzem commented Mar 4, 2024

Related Issues

Proposed Changes:

This change handles updates when a connection reset happens. In that case, the last_id is equal 1, meaning the Cloud API returns an empty state. With this change such updates are discarded and a full update is forced to reconcile the actual (cached) state, with the real one.

Testing:

  1. Activate at least one sector
  2. Disconnect the main unit
  3. Wait the Integration to use a cached state (you should see errors in logs)
  4. Reconnect the main unit
  5. The integration must not change the alarm state (if the bug is present, it will go in "Disarmed" and then back to the actual state).

Extra Notes (optional):

n/a

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 4, 2024
@palazzem palazzem self-assigned this Mar 4, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8143683054

Details

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

Totals Coverage Status
Change from base Build 8113263050: 0.03%
Covered Lines: 676
Relevant Lines: 723

💛 - Coveralls

@palazzem
Copy link
Owner Author

palazzem commented Mar 5, 2024

Confirmed by @andr3a88 that the fix works. Merging! 🎉

@palazzem palazzem merged commit 0d14aec into main Mar 5, 2024
5 checks passed
@palazzem palazzem deleted the palazzem/issue-148-2 branch March 5, 2024 17:31
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.

Integration state switches frequently to "Unavailable" when there is a blip with the Cloud API polling
2 participants