Dear all,
I have an automation that turn on a light when a motion sensor detect a presence.
I would like that this automation run one time and the for 10 minute stay off.
I have this automation:
- alias: "Movimento Bagno"
trigger:
platform: state
entity_id: binary_sensor.motion_bagno_occupancy
to: 'on'
condition:
condition: or
conditions:
- condition: template
value_template: >
{{ now().strftime("%H:%M:%S") > states.input_datetime.accensione_movimento_notte.state }}
- condition: template
value_template: >
{{ now().strftime("%H:%M:%S") < states.input_datetime.spegnimento_movimento_notte.state }}
action:
- service: switch.turn_on
data:
entity_id: switch.shelly1_specchio
For set a condition that avoid a start for 10 minutes, I must to add this code?
- condition: template
value_template: "{{ (as_timestamp(now())-as_timestamp(states.switch.shelly1_specchio.last_changed)) > 600 }}"
It’s right?