I’ve been experimenting with setting up a reliable room occupancy detection system using Xiaomi PIR motion sensors and a door switch sensor. My goal was to create a system that accurately detects when someone is in the room without false triggers, especially when moving in and out quickly.
Initially, I faced some challenges with the sensors. The Xiaomi sensors have a 2-minute delay after detecting motion, which sometimes caused the system to misbehave. After some trial and error, I refined my approach by integrating the door sensor into the equation. Here’s how it works:
- Door Open Detection: When the door opens, the system immediately sets the room presence to ‘on’.
- Door Close Detection: When the door closes, the system starts a detection script that monitors both motion sensors.
- Motion Monitoring: The script checks if both motion sensors are inactive after a short delay. If they remain inactive for a set period, the system turns off the lights and sets the presence to ‘off’.
This setup has significantly reduced false positives, especially when re-entering the room quickly. It’s been a great learning experience, and I’m excited to share my findings with the community! If anyone has similar setups or tips, I’d love to hear about them.