Hey,
I have a question about automation. I have one room in which I have a group of lights that can be controlled either by a switch (toggle lights) or by a motion sensor (turn on and off). The problem is that if the lights are turned on by the motion sensor and the person automatically reaches for the switch, the lights will turn off again. Is there any way to turn off the automation for 2 seconds when the motion sensor is detected? Thus, the sensor would prevent the automation from being triggered by the switch?
Thank you very much for your help.
can you post your automations? It seems like you took the simplest route with your automation by using toggle and now you’re struggling to get past that when you should have used turn_on or turn_off.
1 Like
Whether this is possible or not is partly dependent on the hardware you are using. For example, I have a similar issue in my pantry and I use the following automation to prevent motion from turning the light back on immediately after someone turns it off at the wall switch. As long as your hardware setup allows, you can use state conditions with “for” in your action similar to what I have in the second part of the “Choose” action below:
alias: Lights - Kitchen Pantry - Motion Control
description: Turn off Pantry light after 5 minutes of inactivity
trigger:
- platform: state
entity_id: group.kitchen_motion
to: 'off'
for: '00:05:00'
id: No Motion
- platform: state
entity_id: binary_sensor.sonoff_ms01_03_motion
id: Motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.kitchen_allow_motion_detector
state: 'on'
action:
- choose:
- conditions:
- condition: trigger
id: No Motion
- condition: state
entity_id: light.sonoff_minizb_02
state: 'on'
sequence:
- service: light.turn_off
target:
entity_id: light.sonoff_minizb_02
- conditions:
- condition: trigger
id: Motion
- condition: state
entity_id: light.sonoff_minizb_02
state: 'off'
for: '00:00:10'
sequence:
- service: light.turn_on
target:
entity_id: light.sonoff_minizb_02
default: []
mode: single
Thanks for reply and help. It solved my problem.