z0lt1
(Zoltan)
1
Hi, I would like to fire an action when a switch is turned of, but only if it was ON before for 1 hour.
This one doesnt work:
alias: Test - Neue Automatisierung
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.testschalter
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: 0
id: stromverbrauch.hoch
condition:
- condition: state
entity_id: input_boolean.testschalter
state: "on"
for:
hours: 0
minutes: 0
seconds: 10
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.waschmaschine_fertig
mode: single
123
(Taras)
2
alias: Test - Neue Automatisierung
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.testschalter
from: "on"
to: "off"
id: stromverbrauch.hoch
condition:
- condition: template
value_template: "{{ now() - trigger.from_state.last_changed > timedelta(seconds=10) }}"
action:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.waschmaschine_fertig
mode: single
After testing it you can change timedelta(seconds=10)
to timedelta(hours=1)
to meet your original requirement.
1 Like
z0lt1
(Zoltan)
3
Thank you, that works perfect!
So
is the time when input_boolean.testschalter
switched from off to on, correct?
1 Like