Motion sensor with constant updates

I am wanting to put downward facing motion sensors on both sides of every door to track people. For instance, if the outside sensor sees motion, followed by the inside sensor, then someone walked into the room, and I can set the room to “occupied”. I plan to have sensors with a view of the entire room as a backup. So, if a room turns to “unoccupied”, the lights go off (and if the lights in an “unoccupied” room are turned on manually, it would be set to “occupied”). If a room is “occupied”, the lights would turn off after maybe a half hour of no activity.

The advantage to doing it like this is it should allow tracking people, and turn on lights to the next room, and immediately turn them off when they’ve passed, or if they turn into a different room (or turn around).

I have experimented with some cheap Xiaomi sensors, and it seems to work in premise, except the sensors will only send a motion update about every 10 seconds. So, if anyone enters then immediately exits a room, the system couldn’t track that, which defeats the purpose. If I can’t trust the sensors over the doors, it would require an unworkable amount of code to track “occupied” versus “unoccupied”. If they sent an update more often, it would drain the batteries, but in this application, it wouldn’t matter - their “vision” would be limited to basically straight down.

TL;DR: Does anyone happen to know of any motion sensors that could be set or modded to send signals constantly? Prefer battery powered sensors, but will considered wired, if my only option. Alterantively, motion strips could achieve the same thing, if anyone knows if those are a thing. TIA!

If you’re using webCORE here’s all the work already done for you.


Thanks John! The issue is not the control interface of automating occupied v unoccupied rooms. I was planning on coding it into a smart app, so this interface will definitely be bookmarked.

But my idea is to track each person’s movement from doorway to doorway. Having sensors in each room would only be able to see when someone is in the room, and would have to be position to explicitly not see out a doorway. Obviously, I won’t be able to literally track each individual like “Person A is in the hallway going towards the bathroom; Person B is in the kitchen; etc.”, but I should be able to manage “someone is in the hallway going towards the bathroom. Someone is in the kitchen.” Essentially, I want to build in movement prediction - turning lights on in the room(s) they may be going to, and immediately turning those rooms off if the person passes by it.

To do that, I need sensors that send constant motion updates for active sensors.

What do you mean by “constant motion updates”?

A motion sensor sends 2 types of State Change events, and only 2:

(1) motion (something has been detected moving across the PIR field)

  • 1a. sensor’s built-in countdown timer starts when motion is no longer detected
  • 1b. sensor’s built-in countdown timer restarts when motion is detected again before the timer reaches zero. But no additional Event is sent!
  • 1c. when sensor’s built-in countdown timer reaches zero; goto (2):

(2) no motion (nothing has been detected moving across the PIR field since the timer expired)

The sensors I have, it sends a “motion” state once every 10 seconds or so, but that’s too long of an interval. I want one on each side of the door, so if someone walks into a room Sensor1 then Sensor2 sees motion. When they leave the room, Sensor2 then Sensor1 would trigger. However, if immediately exiting the room (for instance, walking into a room to grab something), Sensor1 should trigger, but doesn’t, because the interval is too short. So the system would see someone entering but not exiting, and falsely register the room as “occupied”.

Essentially, I don’t need a “no motion” state, just motion, and I can use Not motion as no motion.

1 Like

Some sensors have a configurable reset interval (countdown timer), but I think it will be difficult to find one that is instant / continuous - or maybe I just haven’t heard of such a thing. It would eat a lot of battery probably.

Do some laborious searching of PIRs or other means of motion detection (such as laser, radar, or Echo-Location?) and you might stumble upon one.

I presume that the algorithm I described is the most prevalent. I wonder what the shortest configurable reset timer duration is…

@tgauchat So, if I understand you correctly…

  1. Person walks into the room : Motion sensor senses and reports motion.
  2. Person walks out of room : sensor built-in countdown timer starts.
  3. Person immediately walks back into room : Motion detected but not reported and built-in countdown timer restarts.
  4. No matter how many times the built-in countdown timer restarts, motion will not be reported again until countdown reaches zero.

10 seconds is super fast for a count down timer! I have motions that only update every 3 minutes. The Iris updates every 30 seconds and most others are about every minute or so…

You just have to have a different approach.

To do want you want try this logic.

If motion A changes to active
Motion B is inactive
Room A is unoccupied
Then with Light A
Turn On
With Light B
Turn Off

You could even add other conditions such:
Contact is open/close
Was occupied less then 1 minute
Was active for more than 1 minute

Probably correct - But I advise testing this by observing Live Logging in the IDE while you perform the described actions. Live Logging likely shows all events: If necessary, go to My Devices and look at the Device Event History instead.