This change refactors entirely how the DataUpdateCoordinator is exposed to the integration. Instead of writing the fetching logic inside the async_setup_entry as a standalone function, we moved the entire logic in a dedicated class that is easy to test. AlarmCoordinator is fully tested and a regression test is added to the test suite.
Furthermore, the integration now uses async_config_entry_first_refresh() to call the first update, so that if there are issues with the update, the integration will raise ConfigEntryNotReady exception, preventing the integration from loading. At that stage, the integration is flagged as "Failed to load", preventing logs spamming.
Testing:
Install the integration
It should work as usual as this is just a refactoring
Extra Notes (optional):
n/a
Checklist
[x] Related issues and proposed changes are filled
[x] Tests are defining the correct and expected behavior
Related Issues
Proposed Changes:
This change refactors entirely how the
DataUpdateCoordinator
is exposed to the integration. Instead of writing the fetching logic inside theasync_setup_entry
as a standalone function, we moved the entire logic in a dedicated class that is easy to test.AlarmCoordinator
is fully tested and a regression test is added to the test suite.Furthermore, the integration now uses
async_config_entry_first_refresh()
to call the first update, so that if there are issues with the update, the integration will raiseConfigEntryNotReady
exception, preventing the integration from loading. At that stage, the integration is flagged as "Failed to load", preventing logs spamming.Testing:
Extra Notes (optional):
n/a
Checklist