I have 2 motion sensors in my living room and I can’t get it to turn the lights off when the 2 of them havend detected motion. With 1 sensor it works perfectly but with 2 it doesn’t. The lights turn off if either one of them has no motion or they don’t turn off at all. Is there a automation to fix this problem?
Yes, providing some details of the entities involved, and the automation or automations you have so far, would be very helpful.
But, assuming the two motion sensors are binary sensors (I’ll refer to them as binary_sensor.motion_1 and binary_sensor.motion_2), if you want an automation that turns off a light when they both have changed to `'off``, then the easiest way (especially if you use the automation editor) is to trigger when either goes off, and then have a condition that they are both off:
- trigger:
- platform: state
entity_id:
- binary_sensor.motion_1
- binary_sensor.motion_2
to: 'off'
condition:
- condition: state
entity_id:
- binary_sensor.motion_1
- binary_sensor.motion_2
state: 'off'
action:
- service: light.turn_off
entity_id: light.my_light
Thanks for the help, but the to automations you suggested didn’t work. I have 2 lights in my livingroom and 2 sensors:
entity_id: switch.0x680ae2fffe40e9a0_switch
entity_id: switch.0x680ae2fffe414f3b_switch
I have the two motion sensors combined in a group. Then the group acts as one motion sensor. So that way if either is triggered the light goes on. If they both stop sending motion the timer is triggered to go off.
What Phil advised should have worked for you.
Admittedley it does not have a delay on but we could introduce that once it works.
You have not showed the code you tried, (i.e. as you implemented it)
Looking at your code it is obviously generated byt the GUI editor and I get (understand) : -
But can I ask why your switch is called : - switch.0x680ae2fffe40e9a0_switch ?
You do know that you can rename both the ‘Name Override’ (friendly name) and the ‘entity_id’ ? say from switch.0x680ae2fffe40e9a0_switch to say switch.livingroom_lamp01 and have the friendly name as say “Ruben’s Lamp” This makes reading the code easier and even if you choose from a list it’s considerably less obscure.
I’m a bit lost with. why does it have both a device_id AND an entity_id ??
type: motion - really not sure about this, a binary sensor is either ‘on’ or ‘off’ (I know that the front end transcribes this to other states according to device class, but it’s still ‘on’ or ‘off’)
I don’t see how this triggers
Please post the automation you created when you tried to implement my suggestion. These device type triggers and actions are new and many of use are unfamiliar with them because we don’t use the automation editor – we hand edit YAML files.
Well, I ‘would’ “Like” your post, but maybe someone would think that I “like” the 'implications' (Which I definitely do not ! ) (sorry, it’s not personal ! )
I learned this too about 3 month ago from another great member of this community. So the credits should go to @Tinkerer for this one.
Check out his blog for more handy tips and tricks: https://blog.ceard.tech/?m=1
Well then it should have worked. If you could have posted exactly what you did I might have spotted the problem. But @frits1980’s solution is also a good one. Glad you got it working either way!