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

Closed palazzem closed 6 months ago

palazzem commented 6 months ago

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

coveralls commented 6 months ago

Pull Request Test Coverage Report for Build 8143683054

Details


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

💛 - Coveralls
palazzem commented 6 months ago

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