wernerhp / ha.integration.load_shedding

A Home Assistant integration to track your load schedding schedule.
MIT License
113 stars 21 forks source link

How to manually force a refresh/API call to EskomSePush? #70

Closed kimfr closed 9 months ago

kimfr commented 1 year ago

Hello,

Thanks for a really cool integration - really helpful in manage Solar and Battery :-)

With the constant changes in Stages (sometimes with very short notice) - I was wondering if we could get a feature like a "Update button"? Perhaps something like having a button in Home Assistant which does a API call to EskomSePush for a refresh.

Currently, I often re-load the integration in Home Assistant once I get the push notification from EskomSePush App on my phone to get Home Assistant updated - yeah, I know - I might be impatient ;-) but sometimes it's "urgent" when the changes in Stages are at short notice.

tinuva commented 1 year ago

You could probably do it yourself.

Create this automation:

  - alias: Reload "Load Shedding"
    description: ""
    trigger:
      - platform: time
        at: "00:00:00"
    condition: []
    action:
      - service: homeassistant.reload_config_entry
        data: {}
        target:
          device_id: 557a41e60d82eecee1b78dda2ca59762
    mode: single

Then create a button that runs the automation, or a button that executes the above service call.

kimfr commented 1 year ago

I was thinking along the same route as well :-) - issue is just that it costs 2 or 3 API calls to reload - compared to the 1 API call per home - not really a big issue as have a max of 50 ;-)

btw, implemented it via double_tap_action on "Card 4" example by adding below: double_tap_action: action: call-service service: automation.trigger target: entity_id: automation.reload_loadshedding

wernerhp commented 1 year ago

I don't pay that much attention to stage changes, so haven't notice this. Do they happen at less than an hours notice?

Was going to suggest the same as tinuva as a workaround. Adding it to the integration can be done, but quite a bit of work for an optimisation that saves 2 AapI calls and is only required every now and then. Fortunately there's a lot of headroom still (25 calls per day)

Will keep this issue as a to do though. It's a nice idea along with making the stage update interval configurable for those who want to tweak the API calls for a different resolution.

kimfr commented 1 year ago

I don't pay that much attention to stage changes, so haven't notice this. Do they happen at less than an hours notice?

Not that often - but I have had that Eskom announces an increase in loadshedding which meant we were suddenly being loadshedding within 1 hour.... or an increase in Stage meant our slot is now 4.5 hours instead of 2.5 hours and the battery isn't fully charged yet..... :-1:

Will keep this issue as a to do though. It's a nice idea along with making the stage update interval configurable for those who want to tweak the API calls for a different resolution.

Sounds good - is really only a "nice to have".

Your integration in Home Assistant works so well that my wife doesn't even have the EskomSePsuh App on her phone anymore :+1: