Before starting
You need an SNZB-06P with USB power, a compatible Zigbee coordinator, a running Zigbee2MQTT instance and an MQTT broker. This route reads occupancy and the dim or bright illumination category. It is not a lux meter and not a continuous motion stream.
Our connector checks use simulated messages; behaviour on physical hardware remains unverified here, and the payload field names below come from the official device page rather than from a capture.
Know the four attributes first
| Attribute | Direction | Values | Meaning |
|---|---|---|---|
| occupancy | read | true, false | Presence detected in the field |
| occupancy_timeout | read and write | 15 to 65535 | Seconds occupancy stays true after the sensor clears |
| occupancy_sensitivity | read and write | low, medium, high | Three-step detection sensitivity |
| illumination | read only | dim, bright | Category, updated when occupancy is detected |
There is no distance, gate or coordinate in that list. If the automation needs them, this is the wrong device class.
Pair, name, then stop joining
Pair using the official instructions, name the device room_presence, and close the permit-join window afterwards. A sensor left joinable is a sensor any nearby coordinator can adopt.
The friendly name is the topic segment: renaming the device later renames every topic under it, so choose the name before you write automations.
Point the local kit at it
Follow the workbench setup, select live mode, and retain only the room-presence device. Match the topic to your actual friendly name rather than editing the sensor's name to fit an example.
cp config.example.json config.local.json
# Edit mode, mqtt and devices in config.local.json.
.venv/bin/python service.py --config config.local.json
An occupancy event looks like this; the values are illustrative.
{"occupancy":true,"illumination":"bright"}
Read and write, not just read
Two of the four attributes are writable, which means the bridge can change sensor behaviour:
# Ask for the current values
mosquitto_pub -t 'zigbee2mqtt/room_presence/get' -m '{"occupancy_timeout":""}'
# Raise the hold time to 120 seconds
mosquitto_pub -t 'zigbee2mqtt/room_presence/set' -m '{"occupancy_timeout":120}'
# Step the sensitivity down
mosquitto_pub -t 'zigbee2mqtt/room_presence/set' -m '{"occupancy_sensitivity":"medium"}'
Treat a write as a configuration change: record the old value, change one attribute at a time, and re-check with a get request. A sensitivity change that also moves the timeout makes the next observation uninterpretable.
Make availability explicit
Occupancy false and device offline are different states, and the sensor alone cannot distinguish them for you. Enable device availability in Zigbee2MQTT so the bridge publishes a separate liveness signal:
availability:
enabled: true
active:
timeout: 10
passive:
timeout: 1500
The documented defaults are 10 minutes for an active device that can be pinged and 1500 minutes, about 25 hours, for a passive one. The SNZB-06P is USB-powered, but the setting to verify is which class the bridge treats it as; check the device page before assuming either number.
Availability is published to a separate topic and persists across bridge restarts. If the bridge is stopped for longer than the active timeout, devices are marked offline when it returns, which is expected rather than a fault.
Set freshness in the consumer, not the sensor
The local kit's example data-age threshold is ten minutes. That number belongs to the consumer: it says how long a value may be reused, and it has nothing to do with how often the sensor reports.
Two rules keep this honest:
- An unchanged occupancy value can be legitimate for hours. Old data does not prove the device is offline.
- A fresh value after a reconnection proves the path works; a missing value after a reconnection proves nothing until the availability topic is read.
Verify the path in four steps
- Move in front of the sensor and watch the occupancy value change on the device page.
- Confirm the same change arrives on the MQTT topic.
- Pull the coordinator or stop the bridge, then confirm the availability topic reports offline.
- Restore it, confirm online, and confirm a new live report rather than a retained snapshot.
Record the device firmware, the coordinator firmware and the Zigbee2MQTT version with the result. Without those three, a later difference cannot be attributed.
Troubleshooting
| Symptom | Likely cause | Check |
|---|---|---|
| No occupancy at all | Device not interviewed or wrong topic | Device page, permit-join window |
| Occupancy stuck true | Timeout set very high | Read occupancy_timeout |
| False triggers with nobody present | Fan, curtain or adjacent room in field | Move the sensor, lower sensitivity |
| Values arrive but no availability | Availability not enabled, or disabled per device | Bridge configuration, device override |
| Automation fires late | Consumer-side delay, not the sensor | Check the automation's own debounce |