EskomSePush: API available

Maybe save the state of loadshedding and the time of the previous API call and see from that to current time if you in LS then set a flag to indicate that. Timer will clear the flag at end of LS?

Now you know if it is currently LS or not.
Groetnis

Updated version:

It now correctly reports that I’m in a LS event, not sure if they move on at some point? Will see what happens.

I did change the eskomsepush to a timestamp with the time it was last updated :slight_smile:

5 Likes

Looking good there!
Once you happy, would you mind sharing the code and a short description of how to get it into HA please?

Groetnis

Sure thing, will post the latest code the weekend. The earlier stuff is the essence, but I’ll post some tweaks.

1 Like

That really looks good for a night’s work.
Please can you make the code agnostic enough to be used nationwide?

It should already be :slight_smile: Just figure out your area ID once using this: EskomSePush Business API 2.0 (getpostman.com) and then change "<your area id here>" to yours :slight_smile:

The only part that I haven’t captured is the load-shedding stage for Cape Town - I live in Pretoria so not too much of a problem for me (EskomSePush’s API can give it to you though). And because of the API call limits for personal use, I rely on the Eskom sensor to get as many LS status updates that I need.

Forgive me, but what is the “Eskom sensor”? Maybe it’s something that every Saffer knows about, but I’ve been abroad a long time.

HomeAssistant models the thing as a “Sensor”. So he probably means the one that has name: EskomSePush in it :slight_smile:

1 Like

Yes in my case its the neighbors generator.
But all south Africans know now that 3 times a day your faulty wall plug wont shock you.

In my case that is a fairly unreliable measure. My neighbour is a very frugal man. Let me explain, he is probably the kind of person who turns the gas flame off when he turns over the bacon. The Zimbabwean “contractor” who is painting at my place gave him his business card, and he remarked that “it is not time yet”… despite the fall facing my side being so clearly in need of paint that I’ve considered paying for it… just so I don’t have to look at the thing. Anyway… based on this, the petrol generator isn’t always in the best working state, and even when it is, he will sometimes simply not start it. Which is not a bad thing… the drone of a petrol generator with that slight misfire every 7-11 seconds… not the most musical thing :slight_smile:

Haha, sorry, I meant this one: eskom_loadshedding_status

This one reads the loadshedding status directly from Eskom. Unlike the EskomSePush one it doesn’t have an API limit, so I can hit it more often to see if the national status change. When it changes, I can trigger an update to the EskomSePush sensor to see if my scheduled loadshedding changes.

The latter is done via an automation, that looks like this:

- id: '1663278849966'
  alias: Update EskomSePush Sensors when loadshedding status changes
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.eskom_loadshedding_status
  condition: []
  action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.eskomsepush
  mode: single

So the Eskom sensor updates every 180 seconds (3 mins) while the EskomSePush sensor (REST) updates every 3600 seconds (1 hour). Since the EskomSePush API gives you 50 calls a day, it means I spend 24 of those on getting the scheduled LS activities every hour, while the rest are reserved for updates when loadshedding changes.

The other EskomSePush call (also REST) called EskomSePushAllowance doesn’t count towards the API according to their docs, but also refreshes once an hour to get the number of API calls I have remaining.

1 Like

This makes sense, and optimises your notice period.
Can this functionality also be solely achieved within Node-Red?

There are many horror stories of HA being unreliable due to updates.
( And quite frankly Node-RED already scares me, but I have been lucky in cobbling bits of other peoples’ jsons together).

Don’t know - I haven’t used NodeRed before!

Shows you what I know, I thought that was a Node-RED dashboard you made.

No worries, but yeah, all standard Home Assistant dashboards.

I am still trying to figure out how I could best make use of this new API.

Currently, I only use it to show the upcoming slots.

Screenshot 2022-09-18 at 08.33.11

Just using solcast pv forecast and having that adjust the DoD for the batteries, is enough to keep the batteries ready for any situation. So yesterday we didnt have much pv forecasted, so batteries didn’t get discharged too much. Here is a quick view of the last 24 hours:

Screenshot 2022-09-18 at 08.33.34

And right now, its charging again (its not even 9am yet, where the good stuff starts for me in CPT):

The only thing I can think off, is to figure out maybe what to do about 4-8am slots for now, but generally I am already covered for that.

2 Likes

So my system now basically:

  • figures out how when loadshedding will occur via the API
  • knows remaining PV yield and tomorrow’s via Solcast
  • always checks 60 mins in advance before LS if I have enough battery - 50% at least. If not, charges from the grid
  • uses Eskom in the peak evening (I know, I’m the type Eskom hates) and switches to battery at 21:00. It then decides if the min SOC should be 25% or 50%. This is based on the amount of solar yield predicted for the next day as well as if there’s loadshedding during the night (up to 2 hours after sunrise).
  • announces via Google Home 15 min before loadshedding kicks in what stage it is and how long the session will be (sadly necessary with stage 5 or 6)
  • anounces via Google Home when Eskom goes out and whether it is expected (because of loadshedding) or unexpected. Also announces when it is back
  • adjusts the period my outdoor lights stay on when motion is detected based on Eskom availability or not

The one thing I haven’t been able to do yet is to run the geyser when there’s excess power available and batteries are full and the solar geyser’s temperature is too low. It does this already but if the batteries are full during LS it won’t try again when Eskom comes back (geyser are on the non essential side).

1 Like

I have a manual “doomsday” switch that Jaco installed for me a little earlier the year. It is good enough for me and have saved me quite a bit of money already during LS. During loadshedding I can flick the switch an run the geysers, pool pump, oven, scullery etc. should the sun allows. If I’m not home, I’d rather not do it due to inability to control loads and unreliability of the sun on cloudy/rainy days. Don’t want to run those off the battery, no real point. My battery wasn’t sized according to non-essentials.

Maybe you can get an automatic/wifi “doomsday” relay to use in automations.

Sounds cool. Will have to speak to Jaco about something similar at my place for my borehole especially.

I used these alot at my previous house … work a treat! Don’t take up alot of space and not to expensive.

1 Like