-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automation Ideas #5
Comments
Hi If anyone is interested. Add this to configuration.yaml
then in your card
this then will display the next time of loadshedding. During loadshedding display the next schedule and index [1]. |
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 Stage and Area panelCodetype: entities
entities:
- type: custom:template-entity-row
icon: mdi:lightning-bolt-outline
name: Status
entity: sensor.load_shedding_stage
active: '{{ not is_state("sensor.load_shedding_stage", "No Load Shedding") }}'
state: '{{states("sensor.load_shedding_stage")}}'
- type: custom:template-entity-row
icon: mdi:timer-outline
name: Milnerton
active: '{{ states("sensor.load_shedding_milnerton") == "on" }}'
state: >-
{{ (state_attr("sensor.load_shedding_milnerton", "start_time") |
as_datetime | as_local).strftime("%H:%M") }} - {{
(state_attr("sensor.load_shedding_milnerton", "end_time") |
as_datetime | as_local).strftime("%H:%M") }}
secondary: >-
{% if states("sensor.load_shedding_milnerton") == "off" %} Starts in
{{ timedelta(minutes=state_attr("sensor.load_shedding_milnerton",
"starts_in")) }} {% else %} Ends in {{
timedelta(minutes=state_attr("sensor.load_shedding_milnerton",
"ends_in")) }} {% endif %}
entity: sensor.load_shedding_milnerton Schedule panelCode - type: markdown
content: >
{% set schedules = state_attr("sensor.load_shedding_milnerton",
"schedule") %} <table width="100%">
<tbody>
<tr>
<td width="10%"><ha-icon icon="mdi:calendar"></ha-icon></td>
<td align="left">Schedule</td>
<td align="right"></td>
</tr>
{% for s in schedules[:3] %}
<tr>
<td></td>
<td width="50%" align="left">{{ as_timestamp(s.start_time | as_datetime) | timestamp_custom("%-d %B %Y", True) }}</td>
<td width="100%" align="right">{{ as_timestamp(s.start_time | as_datetime) | timestamp_custom("%H:%M", True) }} - {{ as_timestamp(s.end_time | as_datetime) | timestamp_custom("%H:%M", True) }}</td>
</tr>
{% endfor %}
</tbody>
</table> |
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. |
not sure how to get that. |
Load Shedding v0.5.0
Code Cardtype: entities
entities:
- type: custom:template-entity-row
icon: mdi:lightning-bolt-outline
name: Status
entity: sensor.load_shedding_stage
active: '{{ not is_state("sensor.load_shedding_stage", "No Load Shedding") }}'
state: '{{states("sensor.load_shedding_stage")}}'
- type: custom:template-entity-row
icon: mdi:timer-outline
name: Hartbeespoort
active: '{{ states("sensor.load_shedding_hartbeespoort") == "on" }}'
state: >-
{{ (state_attr("sensor.load_shedding_adderley", "start_time") |
as_datetime | as_local).strftime("%H:%M") }} - {{
(state_attr("sensor.load_shedding_adderley", "end_time") | as_datetime |
as_local).strftime("%H:%M") }}
secondary: |-
{% if not is_state("sensor.load_shedding_stage", "No Load Shedding") %}
{% if states("sensor.load_shedding_adderley") == "off" %} Starts in {{
timedelta(minutes=state_attr("sensor.load_shedding_adderley",
"starts_in")) }} {% else %} Ends in {{
timedelta(minutes=state_attr("sensor.load_shedding_adderley", "ends_in"))
}} {% endif %}
{% endif %}
entity: sensor.load_shedding_adderley 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)
Code Automationalias: Load Shedding (60min Warning)
description: ''
trigger:
- platform: template
value_template: >-
{{ timedelta(minutes=(state_attr("sensor.load_shedding_adderley",
"starts_in"))) == timedelta(minutes=59) }}
condition:
- condition: and
conditions:
- condition: time
after: input_datetime.alarm
before: '20:00:00'
- condition: not
conditions:
- condition: state
entity_id: sensor.load_shedding_adderley
state: Unknown
- condition: state
entity_id: sensor.load_shedding_stage
state: No Load Shedding
action:
- service: media_player.volume_set
data:
volume_level: 1
target:
entity_id: media_player.googlehome5943
- service: tts.google_translate_say
entity_id: media_player.googlehome5943
data_template:
message: >
'{{ ["Load Shedding starts in 60 minutes", "Load Shedding starts in one
hour", "Load Shedding starts in 3600 seconds, that is one hour for those
that can not math", "Prince of darkness in 60 minutes"] | random }}'
- service: automation.turn_off
data: {}
target:
entity_id: automation.load_shedding_45min_warning
- service: notify.notify
data:
title: Loadshedding
message: Starts in 60 minutes
mode: single 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 |
When you say master you mean V0.4.1? |
@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. Codealias: "Eskom: Check pre-paid"
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.eskom_power
to: "off"
- platform: state
entity_id:
- sensor.load_shedding_area_westerncape_14_parklands
to: "off"
condition:
- condition: state
entity_id: sensor.load_shedding_area_westerncape_14_parklands
state: "off"
- condition: state
entity_id: binary_sensor.eskom_power
state: "off"
action:
- service: script.notify_phone_and_tv
data:
message: ⚡ Check pre-paid electricity
mode: single 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 😛) Codealias: "Eskom: Power off in 30 min"
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.load_shedding_area_westerncape_14_parklands
attribute: starts_in
below: "30"
condition:
- condition: not
conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.load_shedding_area_westerncape_14_parklands
state: unavailable
- condition: state
entity_id: sensor.load_shedding_area_westerncape_14_parklands
state: unknown
action:
- service: script.notify_phone_and_tv
data:
message: >-
⚡ Power going off at {{
(state_attr("sensor.load_shedding_area_westerncape_14_parklands",
"next_start_time") | as_timestamp | timestamp_custom('%H:%M')) }} (in {{
state_attr("sensor.load_shedding_area_westerncape_14_parklands",
"starts_in") }} mins) will be back on around {{
(state_attr("sensor.load_shedding_area_westerncape_14_parklands",
"next_end_time") | as_timestamp | timestamp_custom('%H:%M')) }}
mode: single |
And of cause we have one when the stage changes Codealias: "Eskom: Stage Change"
description: ""
trigger:
- platform: state
entity_id:
- sensor.load_shedding_stage_eskom
not_from:
- Unknown
- Unavailable
not_to:
- Unknown
- Unavailable
condition: []
action:
- service: script.notify_phone_and_tv
data:
message: "⚡ Eskom stage changed: {{ states('sensor.load_shedding_stage_eskom') }}"
mode: single |
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 |
This issue is a place where everyone can share their automation ideas or panels they create using this integration.
The text was updated successfully, but these errors were encountered: