Zigbee2mqtt: Xiaomi Mijia temperature/humidity sensors need occasional repairing

Created on 9 Aug 2020  路  8Comments  路  Source: Koenkk/zigbee2mqtt

What happened

One year and a half ago I have bought 3 Xiaomi Mijia temperature/humidity sensors from aliexpress. 1 of these sensors works flawlessly for all the time I own it. It reports temperature every few seconds (location where it is place has large temperature variation during day and night) and it still runs on the same original battery. However, other two sensors drop out of the network every few days and need repairing to get them reporting again. Furthermore, both of these sensors went through two batteries already. There are two differences between these two sensors and the one that works very well:

  1. The misbehaving sensors are located in rooms where temperature variation is much smaller
  2. These sensors do not connect to the gateway directly but are relayed through IKEA TR脜DFRI smart socket.
    I was thinking to throw away these sensors, but now that I bought TuYa temperature and humidity sensor and had some pairing issues (see bug #4040) I started wondering perhaps the issues with Mijia sensors can be resolved.

Perhaps someone could help me debug the issue I am having and hopefully resolve it?

Network map directly after repairing:
image

Network map after couple of days:
image

Note that Sensor (Hall) has very poor connection, linkquality 1, but works with zero issues.

What did you expect to happen

2 of the Mijia sensors behaving like the other one.

How to reproduce it (minimal and precise)

Pair Mijia temperature sensor so it is relayed through IKEA TR脜DFRI smart socket.

Debug Info

Zigbee2mqtt version: various versions throughout 1.5 years including current latest development branch
Adapter hardware: CC2531
Adapter firmware version: 20190608

stale

Most helpful comment

Judging from that second plot, your best suited channel is around Wifi 11 - Zigbee channel 22-23 - but that could be wiped out by a closeby neighbour firing up on channel 11

(I wouldn't worry about those APs on WIfi 4 and 8, they're so far down in the mud it won't matter)

Check the channelling comparison here - 2nd set of images towards the bottom of the posting

Zigbee default channel 11 is wiped out by Wifi channel 1

On the first plot I would have aimed for around WIfi channel 8 - Zigbee channel 20

As a rule of thumb - assuming people are sticking to the "1,6/7,11" wifi channelling pattern in your area, then the zigbee channels to try are 15/16,20/21,25/26 - in Europe I'd stick to zigbee 15,20 as Wifi 12,13 are commonly used and may wipe you out.

Bear in mind that mains powered zigbee devices are going to be transmitting at 100mW (+20dBm) - more or less the same power as WIFI APs - but battery powered devices frequently only chirp at 10mW (+10dBm) or even 1mW (0dBm), and being DSSS (direct sequence spread spectrum) signals they're going to have trouble being heard over louder OFDM (Orthoganal frequency division multiplexing spread spectrum transmission) signals

That's why I suggested that you want to pick channels where there's at least 20dB headroom available

As you've found, more is better when it comes to repeaters/routers, especially if you have battery-powered kit (as long as your coordinator can support them)

The end device doesn't care how many repeaters it can see. It will latch onto the strongest one (or two) and use those.

NB: Xaomi/Aqara kit will doggedly stay on whatever it was paired with until that signal is utterly unusable before trying another repeater. If you paired with the coordinatror you may need to switch it off, bounce the button a couple of times to make it try and repair, then wait 10-20 minutes, bounce the button again to ensure it's paired with a repeater and THEN switch the coordinator back on

This habit is also a nuisance if your coordinator has a limited number of direct connections like the CC2531s do as it will interfere with pairing up more devices.

All 8 comments

Make sure to check https://www.zigbee2mqtt.io/devices/WSDCGQ11LM.html#troubleshooting-device-stops-sending-messagesdisconnects-from-network and the linked post (https://community.hubitat.com/t/xiaomi-aqara-devices-pairing-keeping-them-connected/623)

Yes I have checked those, the link quality of the disconnecting Mijia devices are always above 100. I have one Mijia device that has link quality of 1 and never disconnects. I have tried various batteries. Today I popped new VARTA batteries also and one device disconnected after half an hour another took 6h before it disconnected. As for the second link they state that relaying over tradfri plugs should work fine:
image

Does the device keep connected when pairing and leaving it close to the coordinator?

I've just written a fairly long posting about zigbee channelling issues - and why they matter - at https://community.openhab.org/t/zigbee-channelling-considerations-when-installing-your-zigbee-network/103455/

Is it possible you're suffering from zigbee vs wifi interference issues? (this is a particular risk if you're running on wifi ch1 and zigibee 11)

I looked into this more, so here it's an update.

I bought ConBee II adapter to replace my CC2531, when I replaced my adapter I had to re-pair all of the devices. After repairing I noticed that the network has much stronger connections now. And if I flip switches in homeassistant devices react almost instantly, before there was 1-2s delay. I also replaced positions of Plug 1 and Plug 3. Plug 1 is Xiaomi plug, Plug 3 is IKEA. because the not working sensors were connecting to plug 3 before, I thought maybe if it will be Xiaomi plug it will work better. The new network map is as follows:
image

Sensor (Hall) shows as disconnected, but it is working fine (network map bug?).

After several hours Livingroom temperature sensor disconnected again and stopped reporting. However, the bathroom sensor is still working fine. Livingroom sensor is in direct line of sight with all the plugs and the coordinator. It is also located approx 4m away from the coordinator. However, it chooses to connect to Plug 1 (previously plug 3) that is the furthest at 6m. It is the only sensor that is in direct line of sight with all of the plugs. Other sensors have line of sight with 2 plugs each.

image

From the graph above you see that living room sensor did report some values after being disconnected but that happened on rare occasion. Furthermore, if I would click the button on the sensor after it lost connection it would blink with two slow blinks instead of blinking rapidly like the other ones when sending data.

In upcoming days I will try out @Stoatwblr and @Koenkk proposals and keep you updated.

So, after replacing the coordinator to ConBee II adapter the Bathroom sensor got fixed as it did not disconnect a single time this time. Probably it was a range issue for that sensor as ConBee II provides much stronger signal. It is also possible that moving Xiaomi plug in a position so that it connects to it also helped. However, The living room sensor that is in direct line of sight of 3 repeaters (2 ikea plugs and 1 xiaomi plug) and a coordinator disconnects almost instantly. It never works more that couple of hours. I tried a suggestion from @Stoatwblr but that changed nothing for that sensor. At the beginning my router was on WIFI channel 11 and ZigBee coordinator on default channel. I guess channel 1?
a8114178-cad4-4423-85b3-4be2121abe4b

I changed the router to channel 8 and switched coordinator to channel ZigBee channel 11 as per @Stoatwblr suggestion.
8a305eeb-2aed-4f60-8f1d-ff2c0d592e1f

This significantly improved network strength. But did not help with Livingroom temperature sensor.

I am now thinking, perhaps, the issue is with the fact that the sensor has good connection to too many repeaters and a coordinator. I will move it in a location where it has only direct line of sight to as few repeaters as possible.

Judging from that second plot, your best suited channel is around Wifi 11 - Zigbee channel 22-23 - but that could be wiped out by a closeby neighbour firing up on channel 11

(I wouldn't worry about those APs on WIfi 4 and 8, they're so far down in the mud it won't matter)

Check the channelling comparison here - 2nd set of images towards the bottom of the posting

Zigbee default channel 11 is wiped out by Wifi channel 1

On the first plot I would have aimed for around WIfi channel 8 - Zigbee channel 20

As a rule of thumb - assuming people are sticking to the "1,6/7,11" wifi channelling pattern in your area, then the zigbee channels to try are 15/16,20/21,25/26 - in Europe I'd stick to zigbee 15,20 as Wifi 12,13 are commonly used and may wipe you out.

Bear in mind that mains powered zigbee devices are going to be transmitting at 100mW (+20dBm) - more or less the same power as WIFI APs - but battery powered devices frequently only chirp at 10mW (+10dBm) or even 1mW (0dBm), and being DSSS (direct sequence spread spectrum) signals they're going to have trouble being heard over louder OFDM (Orthoganal frequency division multiplexing spread spectrum transmission) signals

That's why I suggested that you want to pick channels where there's at least 20dB headroom available

As you've found, more is better when it comes to repeaters/routers, especially if you have battery-powered kit (as long as your coordinator can support them)

The end device doesn't care how many repeaters it can see. It will latch onto the strongest one (or two) and use those.

NB: Xaomi/Aqara kit will doggedly stay on whatever it was paired with until that signal is utterly unusable before trying another repeater. If you paired with the coordinatror you may need to switch it off, bounce the button a couple of times to make it try and repair, then wait 10-20 minutes, bounce the button again to ensure it's paired with a repeater and THEN switch the coordinator back on

This habit is also a nuisance if your coordinator has a limited number of direct connections like the CC2531s do as it will interfere with pairing up more devices.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreasbrett picture andreasbrett  路  4Comments

pepp86 picture pepp86  路  4Comments

LCerebo picture LCerebo  路  3Comments

andreasbrett picture andreasbrett  路  3Comments

sylarevan picture sylarevan  路  5Comments