SOLVED - ZigBee sensor state not reported correctly - Not fast enough?

I am using HAOS on a Pi, ZigBee2MQTT and have a V2 Sonoff stick, 40 devices on the network with many routers.

I have one Tuya door contact that seems to not report the correct state. It reports that it is open when it closed. If I then open the door the correct state is transmitted, but on closing the unit reports it is open.

The sensor does not appear to refresh the state until there is a state change, but it seems to miss the closing. Is there a setting in Z2MQTT that might help with this ? Possibly debouncing ?

Thanks for any suggestions.

So the state is always “open”?
What device is it, exactly (link)?

The door is closed but HA says it is open. If you open the door, the sensor sends on Open.

Now when you close the door quickly HA misses the transaction.

It may be a case of contact bounce.

I think the sensors state is correct but the transmission of the change was missed so HA’s state doesn’t get the update.

Device is a generic TS0203 wireless door/window contact

Maybe the 2 pieces are just too far apart in “close” position?
Depending on the device / quality, you can get away with 1 cm or a couple mm…

“Quickly” or not should not matter. A zigbee device will regularly post its state, anyways, so you can assume the device does not know it is closed, here.

Thanks for your input. Yes I agree about the speed. Yesterday I looked at the log after opening and closing the gate slowly, and it missed the closure. At least HA missed it.

The sensor has a 1/8 inch gap so I think that is pretty good. The magnet was mounted as close as possible without hitting the sensor when closed. What my next step may be is to check the interior of the sensor to make sure I am in precise alignment with the reed switch and if I am I may swap out the magnet for a rare earth variety. Failing that I will swap out the sensor with a different brand.

In my experience the Tuya Zigbee end devices seem to need to have a repeater device nearer to them than some other brands’ devices; otherwise they lose their connection to the mesh.

Try to follow all these best practice tips AND ALSO replace batteries in any problem devices:

Not related to a ZigBee network problem as I’ve recently added about a dozen new routers which transformed the network from being an unreliable toy, where devices fell off of the net on a daily basis, to a decent stable setup. And for those who can’t trust their Zigbee network, I would highly recommend installing more routers.

This sensor was the first I had seen that does away with the reed switch and instead utilizes a hall effect transistor.

The fix was repositioning the gate latch and the magnet so that it had a better chance of remaining in contact after closing. From all of my tests it seems to have sorted it out.

1 Like