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.
When this automation is triggered it turns on the switch and then waits for 10 minutes. If it is triggered again during the 10-minute delay, it will silently ignore the trigger.
- alias: "Movimento Bagno"
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: binary_sensor.motion_bagno_occupancy
to: 'on'
condition:
- condition: template
value_template: >
{% set t = now().strftime("%H:%M:%S") %}
{{ t > states('input_datetime.accensione_movimento_notte') or
t < states('input_datetime.spegnimento_movimento_notte') }}
action:
- service: switch.turn_on
data:
entity_id: switch.shelly1_specchio
- delay: '00:10:00'
I am using the same method as 123 for multiple types of events where triggers may occur multiple times during a period after the first trigger but only 1 automation run is desired
I’ve try this solution.
First of all, thank you for your work and for the new code about “condition”, very smart.
The automation work but it’s strange.
When I walk in front of the sensor, for the second time, the light does not turn on but the timer restart so if I walk continuosly the light does not turn on also for 1h.
I believe what you are calling the “timer” is the delay statement. It will not restart until it finishes its countdown and another trigger occurs. That’s how mode: single works.
I’m not sure why it is behaving the way you described.