At least I think that’s what’s happening. My goal is to have my basement light turn on when presence is detected and then off again 2 minutes after presence is no longer detected.
I have a Unifi Protect camera as the primary trigger using person detection. It can see most of the basement other than a blind spot on the other side of the HVAC stack. I have a Zooz Q-Sensor mounted on the ceiling a few feet from the stairs looking towards this blind spot. The idea is that it will trigger the scene quicker than the cam as it’s a binary sensor but it will also be able to see motion in that blind spot for the camera as this space is directly next to where the stairs come down as well.
I’ve tried manually creating an automation using the visual editor, the motion light blueprint and even the community motion light blueprint that seems to be popular but it seems like they all treat these two triggers the same way: “or”. In other words, if either of them clears the motion then the light will turn off a minute later. The result of this is that if someone is far enough away from the motion sensor that it no longer senses motion it will send the off command which will then turn off the lights, even if the camera still senses a person is present. At least this is how it seems from the traces I’ve reviewed.
I think what I need is to somehow have the automation consider the off trigger be BOTH of those showing off rather than just either of them being able to report an off. I created a group for these two sensors while I was trouble shooting because I read it could help to alleviate some oddness within automations but it didn’t seem to help in this case. Seems to be consensus best practices for things like this? I still like the idea of grouping areas up like this though so I’ll probably just leave it unless there’s a functional reason to not do things this way.
Here’s how the most basic version of this automation I created looks in visual editor:
Is there something I can add that will require those two sensors to BOTH report clear before the group is considered clear to start the 2 minutes timer to actually turn off the lights?
Hi, can you not just create a binary sensor group with both sensors?
There is an option to indicate if one or all should be on.
The trigger on this group rather than individual sensors.
You’re already doing this by creating the binary sensor group. The behaviour you’re describing sounds like you selected the “All Entities” option when you created the group.
This inverts the group logic and causes the behaviour you’re seeing, so go back in and switch off the All Entities toggle. Once you do that, the group will only show “off” if both of the sensors are off.
I thought that’s how I wanted it. Do I have this wrong? I think you may be onto something here as I wasn’t aware of what that option meant previously. Maybe it makes sense for the toggle to be off for the trigger “on” since I want any of the sensors to be able to turn it on. Maybe I need to create a 2nd group that’s identical but I want the toggle on so that all sensors of the group need to show off to trigger the “off” command which will keep the light on if any one of them are still sensing presence, right? Is this the easiest way to go about this by creating to different “all entities” versions of the same group to properly trigger the “on” and “off” actions?
Or is there a more simple way to go about this via the automation to avoid multiple groups that are essentially the same or is that the best practices for this sort of thing and the basic intention on how to best handle this?
No, you don’t have it wrong, and yes, it makes sense for that toggle to be off
No, with the All Entities option off like you currently have, the group should only be off if both the sensors are off.
What you are experiencing is totally abnormal based on what you have showed so far. Can you check the individual history of both your camera binary sensors as well as your group sensor? The group sensor should only be switching back to off when the last camera in the group is off
EDIT: @Ostrichsak Forget everything I just said - I just noticed your issue. You may be using the IF condition incorrectly (not 100% sure since I don’t use it myself). Your second IF should be nested under the Else section (which you’re missing) according to the docs.
Personally, I use Choose whenever I have to make more than 1 selection and it has never failed me. Maybe try switching to that and see if it works out better for you.
Not sure I fully understand what you’re saying about if/else but are you saying that the automation should have a choose for the action rather than what I had like this instead:
I also have a group with 2 sensors that is working without problem, so I am trying to compare yours with mine.
You mentioned that you checked the traces detail, so you are already sure that it is turned off by this automation, correct? If you want to post the traces detail I can also compare to mine if you want.
That’s correct. I have no other automations tied to this particular light/switch and nobody else manually triggered it. Unfortunately, this device doesn’t appear to have a logbook (?) so I can’t verify via the device itself.
I’m happy to post the trace from the last time it was run but I’m not sure really how to do that. Never done that before on this forum so I’ll just post a screen grab. Seems like lots of info that can’t be access w/o being able to interact with it though so if there’s a better way to share it, please let me know how.
I would also make a temp card (entities) like this, then simulate the problem. If the group switch off when one sensor is off, we know the problem is with the group and not with the automation.