diff --git a/storage-heater.yaml b/storage-heater.yaml index 0b817b1..8962089 100644 --- a/storage-heater.yaml +++ b/storage-heater.yaml @@ -8,13 +8,14 @@ esphome: packages: device_base: !include templates/mystrom.yaml -sensor: -- platform: duty_time - id: row_heating_time - name: Row heating time - lambda: "return id(mystrom_relay).state;" - on_value_range: - above: 18000 # 5h - then: - - switch.turn_off: mystrom_relay - - sensor.duty_time.reset: row_heating_time + +interval: +- interval: 1min + then: + - if: + condition: + sensor.in_range: + id: continuous_on_time + above: 18000 # 5h + then: + - switch.turn_off: mystrom_relay diff --git a/templates/mystrom.yaml b/templates/mystrom.yaml index f89e613..63c5f3d 100644 --- a/templates/mystrom.yaml +++ b/templates/mystrom.yaml @@ -118,6 +118,11 @@ sensor: then: - switch.turn_off: mystrom_relay +- platform: duty_time + id: continuous_on_time + name: Continuous on time + lambda: "return id(mystrom_relay).state;" + switch: - platform: gpio name: None # Main entity for the device. @@ -125,3 +130,5 @@ switch: id: mystrom_relay restore_mode: RESTORE_DEFAULT_ON device_class: outlet + on_turn_off: + - sensor.duty_time.reset: continuous_on_time