Turn off storage heater after 3-6hours

This commit is contained in:
2023-07-30 22:10:46 +02:00
parent 23e8f04a85
commit ce24e49354
+25
View File
@@ -0,0 +1,25 @@
substitutions:
name: "storage-heater"
packages:
device_base: !include templates/mystrom.yaml
globals:
- id: heater_was_on_previous_interval
type: bool
restore_value: no
initial_value: "false"
interval:
- interval: 3hours
then:
# Turn off the heater if it's on for 3-6 hours in a row.
lambda: |-
if (id(mystrom_relay).state) {
if (id(heater_was_on_previous_interval)) {
id(mystrom_relay).turn_off();
}
id(heater_was_on_previous_interval) = true;
} else {
id(heater_was_on_previous_interval) = false;
}