Optimizing Home Automation with Motion Sensors and Door/Window Sensors

I’ve recently added quite a few motion sensors and door/window sensors throughout my home, and I’m now confident in knowing what’s happening at any given time. I wanted to brainstorm a complex ruleset to determine logical presence based on sensor inputs. Here’s how I approached it:

The Scenario

  1. Motion Detected: When motion is detected, it indicates someone is present.
  2. Door Opened: If a door is opened, it suggests someone is entering or leaving.
  3. Door Closed: After a door is closed, motion should still be detected if someone is inside.
  4. No Motion Since Door Closed: If no motion is detected after a door is closed, it’s safe to assume no one is there.
  5. Nobody There: The system should recognize the absence of occupants.

The Challenge

I wanted to create a ruleset that accounts for these states without overcomplicating things. Initially, I considered tracking time intervals and using dummy items to store timestamps, but that seemed overly engineered. Instead, I focused on combining motion detection with door sensor states and time of day considerations.

The Solution

  1. Motion Detection: Use motion sensors to trigger presence detection.
  2. Door Sensors: Integrate door sensors to track entry and exit events.
  3. Time of Day: Factor in time of day to avoid false negatives (e.g., no movement at night doesn’t mean no one is home).
  4. Logical Presence: Combine these inputs to determine if someone is likely present.

Implementation Tips

  • Avoid Overcomplication: Start simple and gradually add complexity as needed.
  • Test Thoroughly: Validate each condition in real-world scenarios to ensure accuracy.
  • Log Events: Use logging to monitor sensor inputs and rule triggers for troubleshooting.

Example Rule

plaintext
IF Motion Sensor is active AND Door is closed
THEN Set Presence to ‘Present’
ELSE IF Motion Sensor is inactive AND Door is closed
THEN Set Presence to ‘Absent’

Conclusion

By thoughtfully integrating motion and door sensors, I’ve created a reliable system to monitor presence in my home. It’s been a rewarding project, and I’m excited to explore further enhancements in the future!