Last active
May 11, 2021 12:12
-
-
Save cliffordwhansen/b9ce886f8942d957e6140b8655f69f46 to your computer and use it in GitHub Desktop.
Homeassistant sensor.rest for Eskom Loadshedding status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 %} |
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?
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)
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
Thank you ... very helpful.