Help debugging a Zigbee problem, please

I would appreciate help debugging a Zigbee problem. My knowledge of Zignee is quite limited.

I have a Zigbee door switch on my laundry room door. When the door opens, the light comes on untl the door is closed.
An automation handles the turning on or off the light using ‘laundry_door_contact’. “on” or “off”
That’s the way it worked (for months) until yesterday when I upgraded Home Assistant to Home Assistant Operating System 10.1. (I can’t be certain that the upgrade wasn’t just a coincidence).

I go into Zigbee2MQTT and click on the switch.

Right now, the door is closed.

On the About tab, “Last seen” is “N/A” and “Availability” is “Disabled” However, when I click on the “Exposes” tab, “contact” correctly shows the state of the switch as “Closed”.

In Home Assistant, developer tools, the state of the laundry_door_contact is “unavailable”

Further, under “State” I see:

{
    "battery": 100,
    "contact": true,
    "device_temperature": 30,
    "linkquality": 127,
    "power_outage_count": 44,
    "voltage": 3005
}

If I open the door, in Zigbee2MQTT the “Exposes” tab shows the contact is “open” and in the “state” tab, contact is false.

I am confused. Any tips would be appreciated.

Do your other Zigbee devices work ?

I don’t have other Zigbee switches, but I do have a couple of Zigbee (Ikea) lamps and they are turning on or off correctly.

So Zigbee is working (your bulbs), but not your contact sensor. Maybe try re-pairing it.

One of the challenges that I have found is that of having multiple places to ‘look’ at what is happening with your devices (there might be more, but lets start here) :

  1. What Zigbee2MQTT ‘sees’ from the device, this can be view on the details of the dashboard of on Zigbee2MQTT

http://192.168.1.100:8080/#/dashboard

This can be affected by the Zigbee2MQTT converters, they are often solid representations of what the device manufacture is doing in it’s device firmware, however new and some less ‘used/popular’ devices may suffer from inaccurate conversions.

  1. What Zigbee2MQTT publishes to MQTT, again this can have some odd edge behaviors based on Zigbee2MQTT’s converters and more general it’s ‘philosophy’ on how devices should report/behave. There are some options in Zigbee2MQTT that can influence how devices, if you change any, make sure to just change one and then test results with multiple beers ;-).

If you are able to do some command line ‘stuff’, I find looking at the raw JSON data that Zigbee2MQTT publishes often valuable with new devices I am adding to Home Assistant via Zigbee2MQTT.

The linux bash file below when run, just sits and waits for Zigbee2MQTT to publish data from a device. When it does, this bash script just displays the raw JSON data. Have a beer and watch what comes across MQTT.

  • install the linux program mosquitto_sub
  • create this linux bash file
  • make this file executable by running 'chmod +x ’ on it.
  • run the script and then manipulate the device so it sends data
#!/bin/bash
# test.sh
echo "Bash version ${BASH_VERSION}..."

while :
do

    PRI=$(mosquitto_sub -C 1 -h 192.168.1.101 -t zigbee2mqtt/0x004384eaeebadf30)
    printf "%s\n" "$PRI"
#    echo $PRI


done

  1. How Home Assistant interprets the JSON information sent to it via MQTT. If you let HA do it automatic creation of a device from MQTT is one route, or if you manually created a HA device/sensor from MQTT. Either way, you have to look in details at what and how HA is interpreting the JSON data from the MQTT message. For example sometime Zigbee2MQTT might send a string value and HA assumes a numeric value, when it does not get a number it might set it’s attribute to “NA”.

I know this is TMI and a PIA, but take it one step at time from Zigbee2MQTT to Home Assistant and you will learn much as I did and narrow down where your problem might be occurring.

Good hunting!

How do I do that? It’s been so long since I installed the door switches, I’ve forgotton how to do a pairing. But, since the “Map” function shows the switch connected to the Coordinator, and the switch state being reported correctly if the door is open or closed, then how would a re-pair do anything?

BTW, when I did a map, I am embarassed, but I realized a few other Zigbee devices that I had forgotten about. Two Xaiomi temperature sensors and a Tradfri button that controls the Ikea lights. All of those work. It’s just the laundry room door that has stopped triggering my automation.

You’re more likely to know than us as you haven’t told us what the device is. The instructions are likely in the z2m instructions for the device, which is a clickable link in z2m.

Oh, crap. The one thing that I criticize others for,
Anyway, it’s an Aqara Door Sensor.

The odd thing, though, is when I got out of bed this morning, surprise, the switch is working again. I did nothing. It just started working after 36 hours offline.

I doubt it is a weak signal as the LQI is 123. The reason I sound confused is because I installed this switch almost two years ago and never thought about it since.

But, thanks. I appreciate everyone who tried to help.

Did you just upgrade to 2023.5.3 ?

Not sure if the fix was for ZHA only, but there was a major issue with connectivity, mostly with aqara devices that affected 2023.5.x until 2023.5.3 fixed it.