This integration provides intelligent room occupancy detection by combining multiple sensor inputs using Bayesian probability calculations. It can detect occupancy more accurately than single motion sensors by considering various environmental factors and device states.
- Intelligent Occupancy Detection: Uses multiple sensors for more accurate presence detection
- Probability-Based: Shows both definitive occupancy state and probability percentage
- Multi-Sensor Support:
- Motion sensors (primary detection)
- Illuminance sensors (light level changes)
- Temperature sensors (environmental changes)
- Humidity sensors (environmental changes)
- Device states (TV, game consoles, etc.)
- Adaptive Learning: Uses historical data for improved accuracy
- Configurable Settings: Customize thresholds, decay times, and sensor weights
- Graceful Degradation: Continues functioning even if some sensors are unavailable
- Real-Time Updates: Immediate response to sensor changes
- Download the latest release
- Copy the
custom_components/area_occupancy
folder to yourconfig/custom_components
directory - Restart Home Assistant
- Go to Settings → Devices & Services
- Click "+ Add Integration"
- Search for "Area Occupancy Detection"
- Follow the configuration flow
Option | Description | Required |
---|---|---|
Area Name | Name for the monitored area | Yes |
Motion Sensors | One or more motion sensors | Yes |
Illuminance Sensors | Light level sensors | No |
Humidity Sensors | Humidity sensors | No |
Temperature Sensors | Temperature sensors | No |
Device States | Media players, TVs, etc. | No |
Threshold | Occupancy probability threshold (0.0-1.0) | No |
History Period | Days of historical data to use | No |
Decay Enabled | Enable sensor reading decay | No |
Decay Window | How long before sensor readings decay | No |
Decay Type | Linear or exponential decay curve | No |
The integration creates two entities for each configured area:
-
Binary Sensor (
binary_sensor.{area_name}_occupancy_status
)- State:
on
(occupied) oroff
(not occupied) - Indicates definitive occupancy based on probability threshold
- State:
-
Probability Sensor (
sensor.{area_name}_occupancy_probability
)- State: 0-100 percentage
- Shows the calculated likelihood of room occupancy
Both entities provide detailed attributes:
probability
: Current calculated probability (0-100%)prior_probability
: Previous probability calculationactive_triggers
: Currently active sensors/triggerssensor_probabilities
: Individual probability per sensordecay_status
: Current decay values for sensorsconfidence_score
: Reliability of the calculationsensor_availability
: Status of each configured sensorlast_occupied
: Last time area was occupiedstate_duration
: Time in current stateoccupancy_rate
: Percentage of time area is occupiedmoving_average
: Average probability over timerate_of_change
: How quickly probability is changing
# Example configuration with just motion sensors
Area Name: Living Room
Motion Sensors:
- binary_sensor.living_room_motion
- binary_sensor.living_room_corner
Threshold: 0.5
# Example configuration using all sensor types
Area Name: Home Office
Motion Sensors:
- binary_sensor.office_motion
- binary_sensor.desk_motion
Illuminance Sensors:
- sensor.office_light_level
Temperature Sensors:
- sensor.office_temperature
Device States:
- media_player.office_tv
- binary_sensor.computer_power
Threshold: 0.6
Decay Window: 300
Decay Type: exponential
automation:
- alias: "Turn off lights when office empty"
trigger:
- platform: state
entity_id: binary_sensor.office_occupancy_status
to: "off"
for:
minutes: 5
action:
- service: light.turn_off
target:
entity_id: light.office_lights
automation:
- alias: "Dim lights on low occupancy probability"
trigger:
- platform: numeric_state
entity_id: sensor.office_occupancy_probability
below: 30
action:
- service: light.turn_on
target:
entity_id: light.office_lights
data:
brightness_pct: 50
- Check sensor states in Developer Tools
- Verify motion sensors are responding
- Lower threshold value if detection is too strict
- Increase decay window if state changes too quickly
- Verify sensor connections and availability
- Check sensor placement and coverage
- Ensure device states are updating
- Review historical data period setting
- Reduce decay window setting
- Check sensor update intervals
- Verify automation trigger conditions
- Enable debug logging:
logger: default: info logs: custom_components.area_occupancy: debug
- Review Home Assistant logs
- Check sensor availability attributes
- Verify sensor connections and placement
- Report issues on GitHub
- Join our Community Discussion
- View Release Notes