Skip to content

Instantly share code, notes, and snippets.

@cliffordwhansen
Last active May 11, 2021 12:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cliffordwhansen/b9ce886f8942d957e6140b8655f69f46 to your computer and use it in GitHub Desktop.
Save cliffordwhansen/b9ce886f8942d957e6140b8655f69f46 to your computer and use it in GitHub Desktop.
Homeassistant sensor.rest for Eskom Loadshedding status
- platform: rest
name: Eskom Loadshedding
resource: https://loadshedding.eskom.co.za/LoadShedding/GetStatus
scan_interval: 60
- platform: template
sensors:
eskom_loadshedding_status:
friendly_name: 'Eskom Loadshedding Status'
value_template: >-
{% if is_state('sensor.eskom_loadshedding', '1') %}
No load shedding
{% elif is_state('sensor.eskom_loadshedding', '2') %}
Stage 1
{% elif is_state('sensor.eskom_loadshedding', '3') %}
Stage 2
{% elif is_state('sensor.eskom_loadshedding', '4') %}
Stage 3
{% elif is_state('sensor.eskom_loadshedding', '5') %}
Stage 4
{% elif is_state('sensor.eskom_loadshedding', '99') %}
Updating
{% elif states('sensor.eskom_loadshedding') < 1 %}
No load shedding
{% else %}
{{ states('sensor.eskom_loadshedding_status') }}
{% endif %}
@emeyedeejay
Copy link

Thank you ... very helpful.

@mitsenoj
Copy link

Have being using this for a while now - just recently it has stopped workign though - gettting error: "Error fetching data: http://loadshedding.eskom.co.za/LoadShedding/GetStatus failed with [Errno 104] Connection reset by peer". Any ideas?

@cliffordwhansen
Copy link
Author

I've moved over to using this: https://github.com/swartjean/ha-eskom-loadshedding
There seems to be an issue with the API at the moment, also I have made an update to this snippet (changed to https seems to have helped)

@mitsenoj
Copy link

Thanx - see that component also having challanges - but at least eventually gives a Stage response. Guess it is Eskom related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment