Open wernerhp opened 2 years ago
Hi Great work. I was looking at doing one myself.
If anyone is interested. Add this to configuration.yaml
- platform: template
sensors:
load_shedding_next_next:
friendly_name: "Loadshedding Next Next"
value_template: >-
{% if state_attr("sensor.load_shedding_paulshof_ext_65", "schedule")[1].start != None %}
{{ state_attr("sensor.load_shedding_paulshof_ext_65", "schedule")[1].start | as_datetime - now().strftime("%Y-%m-%d %H:%M%z") | as_datetime }}
{% else %}
Unknown
{% endif %}
load_shedding_next_start:
friendly_name: "Loadshedding Next Start"
value_template: >-
{% if state_attr('sensor.load_shedding_paulshof_ext_65', 'next_start') != None %}
{{ state_attr("sensor.load_shedding_paulshof_ext_65", "next_start") | as_datetime - now().strftime("%Y-%m-%d %H:%M%z") | as_datetime }}
{% else %}
Unknown
{% endif %}
load_shedding_next_end:
friendly_name: "Loadshedding Next End"
value_template: >-
{% if state_attr('sensor.load_shedding_paulshof_ext_65', 'next_end') != None %}
{{ state_attr("sensor.load_shedding_paulshof_ext_65", "next_end") | as_datetime - now().strftime("%Y-%m-%d %H:%M%z") | as_datetime }}
{% else %}
Unknown
{% endif %}
then in your card
- type: custom:template-entity-row
icon: mdi:timer-outline
name: Time Until Start
state: >-
{% if not states('sensor.load_shedding_next_start').startswith('-') %}
{{states("sensor.load_shedding_next_start")}} {% else %}
{{states("sensor.load_shedding_next_next")}} {% endif %}
condition: >-
{{ not is_state('sensor.load_shedding_paulshof_ext_65', 'No Load
Shedding') }}
- type: custom:template-entity-row
icon: mdi:timer-sand
name: Time Until End
state: '{{states(''sensor.load_shedding_next_end'')}}'
condition: >-
{{ not is_state('sensor.load_shedding_paulshof_ext_65', 'No Load
Shedding') and states('sensor.load_shedding_next_start') != None }}
title: Load Shedding
this then will display the next time of loadshedding. During loadshedding display the next schedule and index [1]. Still testing though.
As per the v0.2.0-alpha the following is what I use on my dashboard
type: entities
entities:
- entity: sensor.load_shedding_stage
- type: custom:template-entity-row
icon: mdi:timer-outline
name: Parklands
state: '{{states(''sensor.load_shedding_parklands'')}}'
secondary: >-
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim }} {% endfor -%}
{%- endmacro -%}
{%- macro humanizeMinute(input_minutes) -%}
{% set hours = (input_minutes / 60)|int %}
{% set minutes = input_minutes - (hours * 60) %}
{% set minutes = minutes * -1 %}
{{ hours }} hr(s) {{ minutes }} min(s)
{% if input_minutes < 0 %}
ago
{% endif %}
{%- endmacro -%}
Start {{ cleanup(humanizeMinute(state_attr('sensor.load_shedding_parklands', 'starts_in'))) }} /
End {{ cleanup(humanizeMinute(state_attr('sensor.load_shedding_parklands', 'ends_in'))) }}
title: Eskom
state_color: true
edit Fixed issue with negative minutes, added screenshot for on state
Updated for v0.2.0-alpha
Schedule | ||
{{ as_timestamp(s.start_time | as_datetime) | timestamp_custom("%-d %B %Y", True) }} | {{ as_timestamp(s.start_time | as_datetime) | timestamp_custom("%H:%M", True) }} - {{ as_timestamp(s.end_time | as_datetime) | timestamp_custom("%H:%M", True) }} |
Groot Dank aan julle! Die integration is bef@k!!!!
cant seem to get the Schedule panel to work.
adding a markdown card and add content change sensor name nothing displays. adding a markdown card then using code editor copy paste code change sensor name nothing displays.
cant seem to get the Schedule panel to work.
adding a markdown card and add content change sensor name nothing displays. adding a markdown card then using code editor copy paste code change sensor name nothing displays.
Screenshot of your sensor's attributes from debug console please.
not sure how to get that.
not sure how to get that.
See screenshots above. And please paste your code for your panel here.
Copy and Paste this, then replace [PASTE YOUR CODE]
with your code.
Preview to check that it looks like this
<details>
<summary>Code</summary>
```yml
[PASTE YOUR CODE]
Load Shedding v0.5.0
Hope you find this useful.
Currently I also get a notifications 60 minutes before load shedding and use node-red to shutdown my machines 15 minutes before load shedding starts (the person pressing the button gets over eager at times)
Thanks for a great integration.
P.S. I am no developer/programmer and most of my stuff is working by accident.
Thanks for the contribution @Drewskieza
0.5.0 was a pre-release/proof of concept that I slapped together in a hurry, and so I would not necessarily recommend it as a daily driver.
I made quite a few changes to it over the past two weeks. Initially replaced schedule with forecast, but forecast is not that reliable, because it's scraped from CityPower's website and as load shessing stopped now there's no data available. I added schedules back and made some improvements to include forecast if it's available, but it's likely going to break a few things from previous versions because I renamed a some of fields to be more consistent. If you want you can try out the latest by installing master
from HACS Just be sure to wait for it to fully load before hitting the Download button in HACS. I'm still testing and checking for bugs, before I'll release. Haven't updated the README yet.
When you say master you mean V0.4.1?
No, I mean the master
branch with the latest codeI'm working on. It's at the bottom of the list on HACS > Integrations > Load Shedding
then hit the menu button Redownload
Hi Werner, it seems I am unable to access the library as my sensor for eerste rivier has stopped working over weekend> I have uninstalled and re-installed... keep getting error... any advice pls
@paulbalinnel Please include error logs. That error usually means Eskom was doing maintenance or something and was unavailable. Logs will provide a clearer picture.
@wernerhp all good, probably as u said, eskom doing something, its all working again. thanks for the reply!!!
I set up the following automation as there have been times when I have forgotten to load electricity (pre-paid user) this will send me a notification to tell me to check the meter, as the schedule states we are not load-shedding
The eskom_power sensor is based on an inverter having input power.
script.notify_phone_and_tv: Just a script I use everywhere for notifications, it does some checks like "is the tv on" "am I home"
Another automation I have to notify me of power outages (yes I know EskomSePush also does this :stuck_out_tongue:)
And of cause we have one when the stage changes
Was anyone able to create a automation when loadshedding is 5min before start time turn of certain devices?
@tunavis Have a look at Example Automation 2 You can tweak it to your needs.
This issue is a place where everyone can share their automation ideas or panels they create using this integration.