Sonoff SNZB-06P Zigbee Human Presence Sensor
I recently bought a Sonoff SNZB-06P Zigbee Human Presence Sensor. As ever it was very easy to connect it directly to Home Assistant via Zigbee. I chose this sensor as it has a microwave radar. This means that it can detect the slightest of movement, even breathing. This will stop the lights going off if people are in the room and not moving.
I wanted Home Assistant to turn the light on if there was movement and the room was dark. There is no illumination setting per se, just light or dark. You can’t use a certain lux level for the illumination.
After writing the automation that should have been quite simple, the light would not come on when it was dark. I noticed the light would come on when I re-entered the room. It turns out the the light level is only checked when movement is reevaluated.
The trick with the automation was to add a short delay before the light/dark value was evaluated. This has worked really well.
I am very happy with this sensor and would recommend it if you are looking for a motion sensor.
alias: Motion - Turn on office light
description: Motion - Turn on office light
trigger:
- platform: state
entity_id:
- binary_sensor.sonoff_snzb_06p_occupancy
from: "off"
to: "on"
for:
seconds: 2
condition:
- condition: state
entity_id: sensor.sonoff_snzb_06p_last_illumination_state
state: Dark
enabled: true
action:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.office_ceiling_fan_light
mode: single
This will turn off the office light when no more motion is detected
alias: Motion - Turn off office light
description: Motion - Turn off office light
trigger:
- platform: state
entity_id:
- binary_sensor.sonoff_snzb_06p_occupancy
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: 2
condition: []
action:
- service: light.turn_off
target:
entity_id:
- light.office_ceiling_fan_light
data: {}
mode: single