Change Sonoff SN-ZB03 Implementation

Currently this sensor will emit an “off” event 60s after an initial “on” event even if motion has been continuous through that 60 seconds. The way this sensor handles the occupancy property makes it somewhat worthless; however, it seems like there may be a work-around which has been discussed in this thread (https://github.com/Koenkk/zigbee2mqtt/issues/4874). Apparently this sensor sends two different properties: an occupancy property and zoneStatusChange property (or at least that’s how it’s interpreted by tasmota2zigbee). Would it be possible to switch this integration to using ZoneStatusChange instead of occupancy?

Relevant posts:

LucReynders commented on Apr 2

In nodered this device works great and the tasmotized sonoff bridge.
The sensor sends a message which contains the property “ZoneStatusChange” . This property stays 1 as long there is some movement. It will change state to 0 after 1 minute of no movement.
do not use the occupancy property.

cjs30 commented on Apr 3

After more digging it seems like there are two sets of messages that come from the sensor - both with occupancy booleans. But, only one set with the ZoneStatusChange. The messages that don’t contain the ZoneStatusChange need to be ignored. So, using ZoneStatusChange works (at least so far). The additional occupancy 0 messages (which have no ZoneStatusChange flag attached to them are misleading and are not to be believed).

LucReynders commented on Apr 3

Below the console activity :

Sensor1 is the PIR, after a movement it sends ZoneStatusChange 1 and occupancy 1 :

14:47:15.001 MQT: tele/ZBBridge/Sensor1/SENSOR = {“ZbReceived”:{“Sensor1”:{“Device”:“0x9D13”,“Name”:“Sensor1”,“0500<00”:“010000010000”,“ZoneStatusChange”:1,“ZoneStatusChangeZone”:1,“Occupancy”:1,“Endpoint”:1,“LinkQuality”:55}}}
14:47:15.049 MQT: stat/ZBBridge/RESULT = {“ZbSend”:“Done”}
After some short time (typ 1 min) the msg with occupancy : 0 arrives (!!! ZoneStatusChange is not send)

14:48:45.010 MQT: tele/ZBBridge/Sensor1/SENSOR = {“ZbReceived”:{“Sensor1”:{“Device”:“0x9D13”,“Name”:“Sensor1”,“Occupancy”:0}}}
While I was still moving before the sensor the ZoneStatusChange stays on until there is no movement for 60 sec, then the msg ZoneStatusChange = 0 is send :

14:50:47.331 MQT: tele/ZBBridge/Sensor1/SENSOR = {“ZbReceived”:{“Sensor1”:{“Device”:“0x9D13”,“Name”:“Sensor1”,“0500<00”:“000000010000”,“ZoneStatusChange”:0,“ZoneStatusChangeZone”:1,“Occupancy”:0,“Endpoint”:1,“LinkQuality”:60}}}
14:50:47.431 MQT: stat/ZBBridge/RESULT = {“ZbSend”:“Done”}
(https://github.com/Koenkk/zigbee2mqtt/issues/4874#issuecomment-812870147)

Fixed in v2.13.0.

Just for the records: according to the respective device request, the device doesn’t have any occupancy sensing cluster :wink:

Hi, I’m running deCONZ v2.13.04 (via Home Assistant add-on), and sadly this behavior has not been fixed. These still report no motion after 60s despite there being constant motion in front of them. If there’s any information I can provide to assist with getting these to behave correctly, please let me know.