I want to switch on a light when I enter my home when it’s dark.
The trigger is ‘binary_sensor.garagepoort_gesloten’, the gate that opens (state on to off) in my garage.
It should also be dark, so I have this as condition (brightness below 20).
In the garage I have a motion sensor.
To determine the direction (the light must not be switche on when I left my home), I have the gate as trigger and the wait_for_trigger for the motion sensor.
alias: Switch on light when entering home description: '' trigger: - platform: state entity_id: binary_sensor.garagepoort_gesloten from: 'on' to: 'off' condition: - condition: numeric_state entity_id: sensor.lightsensor_illuminance_lux below: '20' action: - wait_for_trigger: - platform: state entity_id: binary_sensor.motionsensor_garage_occupancy id: binary_sensor.motionsensor_garage_occupancy to: 'on' continue_on_timeout: true - service: switch.turn_on target: entity_id: switch.light_keuken_indirect mode: single
When I enter at night, the light switches on, so that works.
Unluckely, this afternoon I came in and the light was also triggered to switch on.
I had a look in the automation and found:
So this morning 8:03 the gate opened, it was dark and 5 hours later, when I came in the motion sensor was triggered and the light was switched on.
Is there a way to limit the ‘wait for state trigger’ for example for 5 minutes? The automation should not wait 5 hours for the next action.