CoCT Loadshedding into Home Assistant

I’m sorry if anyone came here looking for an answer, as I am too.
Once again I was caught by load-shedding which shut the house down. The problem is, when HA comes back online it then puts the house back into its old state (lights on).

I found an integration that lets you know the load-shedding level but I don’t have anything that actually states when load shedding is going to take place so it can then shut down the house ahead of time.

Another possible solution would be reading amps/volts incoming by a device that’s not mains powered (IE not a Sonoff POW). Maybe possible to pull that off a UPS.

HA as well as the lights run from the backup supply… so I have not had that issue.

Where I did have this issue was with a sonoff running Tasmota. I had cleverly configured the PowerOnState to ON, because it is a geyser, a hair salon in the backyard is involved, and if I am away and something goes wrong, it should be as easy as turning the breaker off and back on again.

So over the holidays, the salon closes for two weeks and we turn it off using the sonoff. The geyser cools down completely. Some days later we have load shedding, and when power comes back the sonoff goes into ON state, and heats the geyser, consuming 8kWh of energy.

Of course, after that, I went back to the default saved state on the sonoff. I can imagine that that could be an issue if the sonoff is out of reach when you need to talk to it…

I have to say this is a funny coincidence. Just this morning I asked the same question to my buddy and he gave me the same answer: Only the level but not the times.

Just for info, I am planning to change my MinSOC so that I am not caught with my pants down if there are two LS sessions per night (8pm to 10pm and 2am to 4am 'ish). If I know there will be two I can up the MinSOC for the day and then drop it again when there is only a single outage. But I am not there yet. @calypso I will follow this thread to see if you ever find a way to programatically ‘see’ your local LS schedule and then act on it.


If you willing to add node-red to your home assistant install, I may have something that will work for you.

Download the json file from GitHub - tinuva/nodered-coct-loadshedding
That can work out the timeslots for your area. This combined with the eskom loadshedding level integration, you should be able to do what you need.

I use it to trigger a binary input that is named “in loadshedding slot”. If that goes to true in HA, I start a timer for 2 hours 30 minutes which then sets the input back to false.

Then using that timer, you can trigger stuff. Eg. when it goes active, stop a bunch of stuff, turn off etc.
When it ends, you can turn all the stuff back on.

Let me know if you need more details, but I think you will start to figure it out once you have nodered installed with the nodered integration for HA and the HA addons for nodered.

What I have found to be the simplest and the safest in my own HA install is to monitor the grid input voltage to the Muliplus using modbus.

My automation’s all have a condition to only trigger if the grid voltage is above 200V. These can however be overridden if I’m home and have ample PV.

I also have separate automation’s that switch off my EV charger, all air-conditioners, heaters and the geyser when the input voltage (ESKOM) drops away and HA sends me an alert as well as VRM for extra measure.

I find I no longer have to worry about load shedding as the system will take care of itself.

This is especially helpful as the substation feeding our area regularly trips and the loadshedding schedule isn’t strictly adhered to.

@calypso Doing it this way will mean you dont need to shut the house down ahead of time, rather react immediately to the loss of power to spare your system and prevent the house going off at all.

1 Like

I’ve taken the approach of “the grid can die at any time”, so don’t bother with load shedding schedules. Load shedding schedules are unreliable for Ekurhuleni at best

  • I use solar prediction to determine if I can run off battery at night
  • If there’s more than 25kWh solar predicted then run to 30% DoD
  • If there’s between 18-25kWh predicted, run to 40% DoD
  • if less than 18kWh, don’t run off batteries at night
  • Things like AC, Oven, Pool and Geysers run off non essentials. So no chance of those draining batteries when grid is down
  • outside lights remain on essential side, but turn off at 60% DoD if there’s no grid at night.
  • fridges and freezers remain on essential side, but will turn off if DoD reaches 50% and there’s no grid.
  • DoD can go down to 10% if there’s no grid

All servers and networking gear has an additional 1.5kVA UPS to keep those up for as long as possible, or when someone plugs in something they shouldn’t on the essential side (lawnmower with dodgy extension through a bedroom window).

The above logic has been running for over a year now and has yet to fail me. Granted, I was probably lucky, but I’ve covered uptime for probably 99% of the time. I had made peace with the fact that I can’t cover myself for unusually extended periods without grid during poor weather days.


I think there is value in what most people have said. Having the info ahead of time allows one to shut down AC’s so they don’t get caught power dead in a state with vents open and you could shut down PCs prior to the power cut.
At the same, the house should also handle an unexpected power outage. As @gbyleveldt stated.

@Thaelian What you said makes the most sense, I just can’’ do this as I have not installed an inverter yet (I’m just being cheap).

@tinuva I’ll get back to you on this. Thanks. I experimented with Node-Red for a while. I can’t say that I was a fan and so far I’ve kept everything YAML.

I’ve been using an ICAL link into Google Calendar to get the schedules into my calendar, where I toggle their visibility when loadshedding is forecast.

The service has been stable in my experience. If you can get the LS stage and then look at the calendar for the stage & area you get timeslots with starts and ends.

Not sure how to get that into HA though.

I use the Home Assistant Calendar integration: Google Calendar Event - Home Assistant (

I then (painstakingly) entered my loadshedding schedule as recurring events into a Google Calendar (colors optional, just helped me keep sane when entering that many events):

This is then pulled into Home Assistant and using the features mentioned here Google Calendar Event - Home Assistant you can basically create binary sensors to indicate whether you’re in a specific Load-shedding event (basically within a specific Calendar Event). E.g. on mine, due to the way I named the entries, I can see that I am currently in a load shedding slot for level 2, or 3 or 4 (I didn’t bother going higher).

HA then creates the following binary sensors for me:


A couple of additional template sensors later I get this:

The “minutes until loadshedding” one is particularly useful, as I can basically now do an automation which says if I’m within 60 minutes of a loadshedding event, and the current LS level matches, and my batteries are below X (say 50%), then force charge them from the grid up to 50%.

The only part that I haven’t managed to solve yet is when it is not currently loadshedding, but scheduled to start at say 8:00 AM tomorrow and I’m in the first slot - then that automation won’t trigger. So far I’ve been lucky.

EDIT: we should really just go and develop a Load shedding integration/custom component for Home Assistant.


Another analog way of making sure you don’t heat the geyser with batteries is to have a contactor between the geyser and your main relay. Have the grid power up the contactor so if the grid falls away the contactor opens and even if every thing goes pear shape there will still be no power available to the geyser.

I also played with the prediction models , the one problem I had with them is that you can not predict the weather on solar production.
I ended up using the battery watts as my “Predictor”. If they are discharging then you can be pretty sure that the solar is maxed out so then it is just question of switching the loads on / off accordingly.

That looks great. I would just hate to think about when the schedule changes.
EskomSePush has an API, they just wont reply to email or say how much it costs.

1 Like

Yeah, so far I’m lucky in that

  • Pretoria’s schedules haven’t changed in a while
  • They’re fairly reliable - they load schedule on time 99% of the time as per the schedule and load shedding status.

At least the only thing that I have to do is go and change the Google calendar entries - and then it all pulls through correctly.

I can probably code a parser that parses the schedules and then deletes/creates my Google calendar entries for me, which is probably what I’ll do should CoT change them.

Cape Town is the same. Haven’t changed in a while, and quite reliable.

Although the other night, we were supposed to be off from midnight to 2AM, and instead they dropped us from 00:15 to 03:30. Still more or less within the concept of “African time” so I am not complaining :slight_smile:

Generally, who ever is the guy flipping the switches has been pretty spot on, timing wise, normally, it’s like promote this guy, give hime something more to do that have positive impact, because clearly he takes pride in being accurate.


Not to spoil a good joke, but I deeply suspect that in Cape Town, they have probably automated this at least in part. I remember back in 2007/8 ish, in some areas people drove to substations and physically switched things. I suspect that at least in larger areas (like Cape Town), some of this is automated by now. With the right kind of control system you can even interleave/stagger the disconnection and connection of smaller areas to get a much smaller “kachunk” out of each switch :slight_smile:

1 Like

agree on the interleave,
agree on the remember it use to be a manual flip the switch
agree on Cape Town.
Now Jhb, we will just laugh and move on.

1 Like

Now one problem that I haven’t managed to solve is the neighbourhood Whatsapp group screaming “LOADSHEDDING!” every time the power goes out - whether it is actually loadshedding or an unexpected power outage…

I see the same in the EskomSePush app’s chat feature.

1 Like

Yup. Every outage is now load shedding. Any unscheduled outage is evidence that Eskom “don’t keep to their own schedules anyway!”.

I love my countrymen, but man… we’re an easily bewildered bunch…