EskomSePush recently released and API which makes it easy to integrate the data directly into home assistant and create a card that matches the app’s UI
head over to the API Docsand using post man use “Areas Search (Text)” to find your area and save the id of your area
In your home assistant configuration create a sensor like the one below. (this code is for the city of joburg) others may vary because the api response can differ but if you look at the API response it should be easy to adapt to others. We want the schedule to be part of the attributes and sensor vaule isn’t too important so i just made it the location name
It took a couple of days before I got a key. And if you want the upcoming schedule and current status then it’s 2 separate API requests so keep that in mind when you fill in the required number of requests per day
sensor:
- name: 'Next Loadshedding'
device_class: timestamp
state: >
{{ strptime(states.sensor.esp_loadshedding.attributes.events[0].start, '%Y-%m-%dT%H:%M:%S%z') }}
- name: 'Minutes to next loadshedding'
state: >
{{ ((strptime(states.sensor.esp_loadshedding.attributes.events[0].start, '%Y-%m-%dT%H:%M:%S%z') - now() ).seconds/60) | int }}
That goes in templates.yaml with
template: !include templates.yaml
in your configuration.yaml
You can then use the next_loadshedding entitiy as your automation trigger, or some other thing.
And then use a condition to check how long until your next loadshedding
Hi. So the loadshedding schedule is an array and as far as i know you can’t have an array as the value of an entity but you can have it as the attributes. The value_template sets the value of the entity and its not really too important so i just use the suburb/loadshedding area name as a place holder here and then I can put it on the card. It could be anything
I am clearly doing something wrong as from postman i can get the area ID and schedule but in HA template tester it says no events in attributes, but in postman i see the events element in the JSON file
Just note that now that loadshedding is actually ending (who knows for how long), the sensors will start failing as you’re trying to read event[0] which doesn’t exit (the list is empty).
So instead of making the sensor unavailable it will set the value to “Unknown”, which means automations will still run.
I also added the additional code since I noticed that sometimes I still got the previous LS event from the API which is already past. So it will check if it should look for events[0] or [1].
If you have HACS then @wernerhp has an update to his Load Shedding Integration that adds a few sensors using EskomSePush which is fantastic.
There is also a new process to get an API Token, if you didn’t get a token from the new gumroad store (ie you used the Google Form) your token will expire at the end of November, follow Werner’s setup it has a link directly to get a token.
Hi Gents
Not sure if anyone can help me. I setup a load-shedding telegram group (for our community) then an automation in HA which sends out a notification when load-shedding starts and when load-shedding ends it’s based on my grid feed and gets the info from the solarman integration.
Is there anyway I can send the load-shedding info to that group for the day like the stage and times?
ESP normally sends a notification that says load-shedding starts in 55 mins is there anyway i can also send that to the telegram group?
Bear in mind I know fokol about coding. I can kinda find my way around but not too clued up.
I do have an API key and I have setup a card but thats about it. I also know nothing about API’s and what they really do.
@SeaSickMama Sensor configuration should be added to configuration.yaml or some file referred to by configuration.yaml. In the screenshot you try to add it to the user interface (error: card type not found)