Motion-based counter-driven automation

Has anyone used multiple motion sensors as a counter to trigger automation?

Thought is this: there is a passage leading into a room, if I could use two motion sensors in succession, it should be able to count how many people are occupying the room. That way I can activate an automation when someone enters and (hopefully) activate an automation when everyone has left.

I can think of other ways that knowing how many people are in a room could be useful or using it as a second condition to change the timing on a motion sensor. Thoughts?

Dual sensor for occupancy isn't really going to work because motion sensors have a timeout. For example, the iris sensors have a 30 second timeout hard coded into them. That means that once it is active, it will not go inactive for 30 seconds. A ton of people could walk in front of the sensor in that amount of time.

Okay - so sensor type could definitely be an issue and may need something different to a motion sensor that has large timeouts. If there were two sensors that could be tripped with say a ~2 second lag, would there be a way to trigger the action, increment up as more pass 1-2, down as they pass 2-1 and action as decrements to 0?

Our zone motion controller app is capable of doing the first part of this, the second might be possible via RM.

It's never going to be accurate to the degree that you want. What if two people walk through an area at the same time but then one remains in the room and one leaves. It seems to me, if you have two motion sensors, just point them towards the room you're trying to monitor and forget trying to keep track.

I agree with @Ryan780 that keeping an accurate count isn't going to be easy. However, you can't find out for sure if you don't try.

As @mike.maxwell mentions, Motion Lighting will do the first bit. You can use RM to keep count with a virtual dimmer. Here's an example use case

I'm not aware of any PIR motion sensors that reset as quick as you're looking for, but you can do this mod to Xiaomi motion sensors and they will reset in 5 seconds. I soldered, but several people have just used a 2B Pencil and said it works. You can also use a conductive pen.

Thanks for all the info, I am going to put this on the back burner for a while and look at some other methods and come back to it as a project. Will likely look into some other sensors such as contact/pressure or beam and combine it with info from a motion sensor for better results. It could definitely do with some more noodling and then some actual trial and error.

Have you considered using pressure sensors? They might work to offset any false positives on the motion sensors and will still work even if the sensor times out.

Here is a UK company that has them. There are also some of these on Amazon and other US sources.

YF