Temporarely disable automation triggered by motion sensor

Hi

I have a motion sensor that turn on the light in my living room. I add a condition on it to not turn on the light when it’s already at on. So if i watch a movie and put the brightness to 5% it will not turn it at 100%. Everything work fine (for me). Next day my kids come to tell me that they can’t close the light because they always turn on.

Is there a solution other than turning off the automation? Like a variable that i can refer in a condition. One solution that i thought was to turn off the automation for 2h when the ligth is close from the wall switch. I’m searching for an other idea

thanks

Hi pmdroz,

First, could you post your existing automation or automations that control this light? Please make sure to format it correctly. E.g., enter it like this:

```
automation goes here
```

So if I understand correctly, you’re saying that when someone enters the room, the light will be turned on by the automation due to the motion sensor sensing motion. But if the switch is turned off manually at the wall switch, the light will be turned back on by the automation when the motion sensor sees motion again. Is that correct? And what you would like to do is to temporarily disable the automation for two hours when the light is turned off manually. Is that also correct?

Assuming you don’t have any automations that turn the light off, this should be easy to do. You can trigger another automation when it sees the switch go off, and its action will be to turn the first automation off, wait two hours, and then turn it back on. I can provide a complete solution after you post your current automation if you like.

Hi

I’m able to do it by enabling/disabling automation but i want to know if HA provide another way to do the same? Like setting a variable named living_room_disable=true when the light is close from the switch. After that the automation can read this variable in the condition section. Eventually it can be used in multiple automations conditions.

This is my current automation. ( I tried to format it as requested but I always have a message telling me it is not correct :slight_smile: )

- id: turn_on_living_room_motion_sensor
  alias: Turn on living room motion sensor
  trigger:
    platform: state
    entity_id: binary_sensor.motion_sensor3_motion
    to: 'on'
  condition: 
    condition: and
    conditions:
      - condition: state
        entity_id: light.living_room_light
        state: 'off'
      - condition: or
        conditions:
          - condition: sun
            after: sunset
            after_offset: "-01:00:00"
          - condition: sun
            before: sunrise
            before_offset: "01:00:00"
  action:
    - service: light.turn_on
      data:
        entity_id: light.living_room_light
        brightness_pct: 5

So when it is daylight out the kids complain that the lights keep turning themselves on when they hit the off switch and move around, correct? Is there another automation that may be doing this, because (unless your syntax is off?) your code as written should only operate at “night time”. Also, an interesting behavior it seems, is your will just turn on to 5% automatically (not 100% then you dim it to whatever manually as kind of suggested).

Yes perhaps having a 2hr pause on the automation after the switch is manually changed would work for you. Doing that in node-red would be almost trivial (that’s what I use for automations), but not sure how you go about the same in yaml.

I have a kinda similar thing for my entry door beepers. They beep every 20sec if an exterior door is left open longer than 2min. It’s great for training my kids about keeping the bugs outside, but it sucks when I’m unloading groceries for example. So I rigged it where I can just send a telegram text of “/stopbeeps” to kill the beepers until the door is closed. For me, that would be a PITA day or 2 of playing with yaml I’m afraid… vs 30min of work “coding” in nodered.

I have Motion based lighting for every room in the house. I also created an input_boolean for every room that I use to enable/disable “occupancy detection” per room. This way I can manually and programmatically enable/ disable Motion lighting easily.

Simply include an additional condition that check the state of the input_boolean in your automation. Turning it on would enable it…off to disable.

if you wanted to have lights on on motion but sometimes you don’t want it to turn off
ie having a party
is it better to create 2 automations
FYI i suck at YAML Automations :crazy_face:

**1**
trigger
   motion
condition
  sunset - sunrise
action
light

**2**
trigger
   light on
for 
   10
condition 
   motion triggered
   sunset-sunrise
   input_boolean
action
  light off