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

Add a button to force-update the state #160

Closed Mark-64 closed 3 weeks ago

Mark-64 commented 1 month ago

This integration works in principle very well, however my system is connected through a mobile connection and I only have 200 MB/month, which is very common in Italy for IoT subscriptions. If I set a polling interval of 120 sec or so, to get a decently responsive interface, the the data consumption is way too high. If I set a polling interval compatible with my subscription plan, then the update is way too slow. My proposal is to introduce a button to force-update the status, so that one can set a long polling interval and then force-update in HA when required through scripts and automations.

palazzem commented 1 month ago

Hello @Mark-64 ! I think your suggestion makes 100% sense. As a solution, I can create a Home Assistant service that you can use/call directly from your automations (e.g. you may force an update after some conditions are met), or manually from your UI (e.g. you add a button to your dashboards that triggers the update) as you are suggesting!

I have a question though as you are using a long scan interval: are you impacted by #117 ? I think I still need to fix that issue first because the force update may not work properly if the refresh tokens are not refreshed in time.

Anyway, I'll be sure to include your suggestion in the next release coming this week!

Mark-64 commented 1 month ago

I have a question though as you are using a long scan interval: are you impacted by #117 ?

No, I am not. Thank you for accepting my suggestion!

palazzem commented 1 month ago

Hello @Mark-64!

The force-update feature you suggested has been fully implemented, and your feedback is very welcome to see if it works as you expect! Currently, you can either add a button to force the update or use this service in your automations.

Update Your Version

As I still need to test and verify if everything works as expected, I've released this feature as a beta version, so you need to install the beta version. You have two options:

  1. Download and use the version available on this release page: https://github.com/palazzem/ha-econnect-alarm/releases/tag/v2.4.0b1
  2. If you use HACS, just enable the beta channel and you should see the v2.4.0b1 version available (be sure to install b1 and not b0).

Add the Update Button

Once the new version is installed, you can add a button in the Lovelace dashboard as follows:

  1. Add a card of type "button".
  2. In "Entity", select your Alarm Panel.
  3. In "Tap Action", select "Call Service".
  4. In "Service", select "e-Connect/Metronet Alarm: Update Alarm State".
  5. Click "Save".

And then you are done! By clicking that button, you'll force the update regardless of the delay you set. The screenshot below is a configuration example; update it based on your needs:

image

How Can You Help Further?

Your feedback is important, as I may have missed something you need. Just write here with your feedback, and as soon as everything works as you expect, I'll release a new official version. Let me know when you have time to play with it!

palazzem commented 1 month ago

Hello @Mark-64 ! I'm wondering if you had a chance to try 2.4.0b1 version, just to double check if the new feature fits your needs!

I'm planning to release a stable one tomorrow so that I can move forward with the development. Thanks again for your time and feedback!

palazzem commented 3 weeks ago

@Mark-64 As I didn't hear back, I'm moving forward with the version release! Of course, if something doesn't work as you expect, feel free to reopen the ticket and I'll prepare a bugfix release!

I'll update this post as soon as the release is out!

palazzem commented 3 weeks ago

@Mark-64 v2.4.0 has been release! You can find it here: https://github.com/palazzem/ha-econnect-alarm/releases/tag/v2.4.0

If you use HACS, simply update to the latest non-beta version! Keep us posted!