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(collector): force update when connection is unstable #68

Closed palazzem closed 8 months ago

palazzem commented 8 months ago

Related Issues

Proposed Changes:

This change forces a full update when UpdateFailed exception is detected. If that happens, very likely there is a connectivity error and there is a chance the backend considers the connection with the central unit gone. In that case, it resets last known IDs, causing the integration to not detect any new change as described in #51.

This fix is available in this commit: https://github.com/palazzem/ha-econnect-alarm/pull/68/commits/588082b455c8e005c290dce3b6c66eaf649e70b3

Instead of adding the fix, this PR also refactors entirely how the DataUpdateCoordinator is exposed to the integration, so that now it's a self contained coordinator called AlarmCoordinator. The coordinator is fully tested and a regression test is added to the test suite.

Testing:

Extra Notes (optional):

n/a

Checklist

palazzem commented 8 months ago

PR has been reverted so that the bugfix can be released in a hotfix. The refactor will be separated from the hotfix.