Hi there
Im an absolutely newbie on HomeAssistant, i set up my Shelly 3EM in Home Assistant, and it works great.
I created a Utility-Meter in helpers for my energy-consumption. I set two tariffs (Peak and Off-Peak).
Now i want to create a automation for the drop down selecter.
The times of „peak“ ar following:
Mo-Fri: 07:00AM till 08:00PM
Saturday: 07:00AM till 01:00PM
„Off-Peak“ times are:
Mo-Fri: 08:00PM till 07:00AM
Saturday: 01:00PM till Monday 07:00AM
I have absolutely no idea how to create a „switching“ automation…
Her is my configuration.yaml:
# Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
- sensor:
- name: "Total Power Consumption"
unit_of_measurement: "W"
device_class: power
state: >
{{ [ states('sensor.l1_power'),
states('sensor.l2_power'),states('sensor.l3_power') ]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.l1_power'),
states('sensor.l2_power'),
states('sensor.l3_power')] }}
- sensor:
- name: "Total Energy Consumption"
unit_of_measurement: "kWh"
device_class: energy
state: >
{{ [ states('sensor.l1_energy'),
states('sensor.l2_energy'),states('sensor.l3_energy') ]
| map('float') | sum }}
availability: >
{{ not 'unavailable' in
[ states('sensor.l1_energy'),
states('sensor.l2_energy'),
states('sensor.l3_energy')] }}
If someone can help me, it would be awesome
I recently tried to create in helpers a schedule for peak and off-peak, but i can’t find a way to use this calendar-schedule for switching between my two tariffs🙈
So i tried different things in the automation. But HA doesn’t change the tariffs… in the log I see that the automation is running but when i try the command in the devloper-tools, every time i get the same fault message… (screenshot)
Im at my work now, thats why i post screenshots from my mobile.
Did you write your automation in YAML or by using the GUI? I am not a pro in YAML, but my automation looks very much different from yours. It has been created within the GUI and looks like this:
(when creating automations in the GUI, there is an option within the top-right-menu to see the YAML itself)
alias: Hochtarif/Niedertarif setzen
description: >-
Diese Automation verwendet eine Zeitsteuerung, um den gültigen Tarif für den
Stromzähler Utility Meter zu setzen.
trigger:
- platform: time
at: "07:00:00"
- platform: time
at: "13:00:00"
- platform: time
at: "20:00:00"
condition: []
action:
- choose:
- conditions:
- condition: time
after: "07:00:00"
before: "20:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
sequence:
- service: select.select_option
data:
option: Hochtarif
target:
entity_id: select.stromzahler_utility_meter
- conditions:
- condition: time
after: "07:00:00"
before: "13:00:00"
weekday:
- sat
sequence:
- service: select.select_option
data:
option: Hochtarif
target:
entity_id: select.stromzahler_utility_meter
default:
- service: select.select_option
data:
option: Niedertarif
target:
entity_id: select.stromzahler_utility_meter
mode: single
–
EDIT: okay, when looking at the …/config/automations.yaml, the structure is the same as yours. Main difference is, that I created 1 automation, not 5. Perhaps, your automations interfere with each user in an unexpected way?
–
EDIT2: in my …/config/automations.yaml all automations start with an id. in our screenshots, the id’s are missing.
Here is the same automation out of my automations.yaml:
- id: '1651527795676'
alias: Hochtarif/Niedertarif setzen
description: Diese Automation verwendet eine Zeitsteuerung, um den gültigen Tarif
für den Stromzähler Utility Meter zu setzen.
trigger:
- platform: time
at: 07:00:00
- platform: time
at: '13:00:00'
- platform: time
at: '20:00:00'
condition: []
action:
- choose:
- conditions:
- condition: time
after: 07:00:00
before: '20:00:00'
weekday:
- mon
- tue
- wed
- thu
- fri
sequence:
- service: select.select_option
data:
option: Hochtarif
target:
entity_id: select.stromzahler_utility_meter
- conditions:
- condition: time
after: 07:00:00
before: '13:00:00'
weekday:
- sat
sequence:
- service: select.select_option
data:
option: Hochtarif
target:
entity_id: select.stromzahler_utility_meter
default:
- service: select.select_option
data:
option: Niedertarif
target:
entity_id: select.stromzahler_utility_meter
mode: single
–
EDIT3:
–
EDIT4:
one last warning: when changing automations, you need to relead them in order to take effect. go to: