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

feat(collector): support configurable scan interval to reduce data usage #58

Closed palazzem closed 9 months ago

palazzem commented 9 months ago

Related Issues

Proposed Changes:

This change introduces a new optional variable SCAN_INTERVAL that let users to change how often the system is updated. This closes the high data usage issue as there is no other way, at the time of writing, to handle this specific case.

Testing:

Open the integration configuration page and set a scan interval.

Extra Notes (optional):

Unfortunately, this solution is suboptimal. Currently the system works that way:

  1. The system and the cloud don't communicate often with a very minimum data consumption
  2. When any system (mobile app, webapp or this integration) asks for a status update (poll), the cloud forces the system to provide the latest update
  3. As this integration provides real-time updates, the default scan interval asks for the update every 5 seconds with a long-polling that lasts 15 seconds.
  4. The integration doesn't consume data, but indirectly forces the cloud to ask the system for data every 5-15 seconds that is a lot if your system is connected through a mobile network.

As the communication between the system and the cloud is out of scope for this integration, the only way to reduce data is just to ask for less. The downside is that with a high SCAN_INTERVAL the integration stops to be real-time and so some automations may trigger later, or you may see discrepancies between the detected value and the real state.

Checklist