Hey everyone, I wanted to share a solution I came up with for motion detection in my home. Motion detection is a boolean quantity—motion has been detected or it hasn’t. I’d like to make my home automation more useful and predictive by detecting motion in a specific direction (a vector). For example, if motion is detected from the den towards the bedroom, the hallway and bedroom lights should turn on. If the motion is in the opposite direction, the hallway and den lights should turn on.
I considered placing a motion detector at each end of the hallway, facing the other room, but that would require multiple detectors and might lead to overlapping triggers. I wanted a more efficient solution without turning my home into a surveillance state.
After some research, I found that using a single motion detector with directional sensitivity could work. I also explored integrating this with Home Assistant’s automation rules. Here’s how I set it up:
- Motion Sensor Setup: I placed a motion sensor in the hallway facing both directions. It uses aPIR sensor with a wide detection angle to cover both ends of the hallway.
- Automation Rules: I created two automation rules in Home Assistant—one for motion detected from the den towards the bedroom and another for the opposite direction.
- Directional Logic: To determine the direction, I used the timestamp of the motion detection and the previous state of the sensor. If motion is detected after a certain period of inactivity, it’s assumed to be from one direction. If detected again shortly after, it’s from the opposite direction.
- Light Control: Based on the detected direction, the corresponding lights (den or bedroom) are turned on.
This setup has worked well for me, and I’d love to hear if others have similar solutions or improvements. Happy automating! ![]()