zigpy / zha

Zigbee Home Automation
Apache License 2.0
24 stars 22 forks source link

Challenges with Integrating Zigbee Devices in HomeAssistant via Zigbee (ZHA) - Pairing uncompleted #257

Open Snabelt opened 12 hours ago

Snabelt commented 12 hours ago

Hello everyone,

I am new to the Zigbee environment and have been diving into the details. I am an IT specialist with a focus on system integration and a specialization in cybersecurity.

For my SmartHome setup, I tried integrating a module for my electricity meter into HomeAssistant. I chose the product: Electricity Meter Interface 2, LED by frient. Here is the link: https://frient.com/products/electricity-meter-interface-2-led/ The product is officially compatible with ZHA. See: https://frient.com/compatible-hubs/ Since I didn’t have any Zigbee devices before (except for Philips Hue, which operates in its own ecosystem), I purchased an officially supported Zigbee antenna. Based on this document: https://www.home-assistant.io/integrations/zha/, I decided on the ConBee 3. See: https://phoscon.de/de/conbee3

I managed to get the ConBee 3 running with ZHA, and it seems to work flawlessly. As a next step, I tried connecting the frient Electricity Meter to the network. This also worked perfectly at first. The device was detected, and real values were initially displayed in the entities. However, after some time, I noticed that the entities were no longer updating. LQI and RSSI are displayed as unknown after a while. It seems that the device is not fully integrated into the network or the connection is lost. When I delete and re-add the device, the same issue occurs. The error is therefore reproducible.

I also noticed that after the supposed pairing, the Electricity Meter remains in pairing mode (the LED continues to blink). The pairing mode is maintained for 15 minutes, during which I can reproduce the issue. After these 15 minutes, I need to restart the pairing process on the device.

To rule out whether the issue lies with the end device, I removed a motion sensor from my Hue system and tried to pair it with the Zigbee network. The same thing happens here. I can find the device during the initialization process, and it displays the correct values for a moment, but immediately after initialization, the connection seems to drop. This error is also reproducible.

I have attached a debug log of the connection to the frient device. home-assistant_zha_2024-10-23T09-51-29.577Z.log Unfortunately, I am not yet knowledgeable enough to fully understand the log or the Zigbee functionality to further narrow down the issue. Therefore, I am hoping for your help.

Here are some technical details about the setup: HomeAssistant is running on a virtual machine, installed using this standard: https://www.home-assistant.io/installation/alternative Core: 2024.10.3 Supervisor: 2024.10.2 Operating System: 13.2 Frontend: 20241002.3

Best regards

Hedda commented 9 hours ago

For my SmartHome setup, I tried integrating a module for my electricity meter into HomeAssistant. I chose the product: Electricity Meter Interface 2, LED by frient. Here is the link: https://frient.com/products/electricity-meter-interface-2-led/ The product is officially compatible with ZHA. See: https://frient.com/compatible-hubs/ Since I didn’t have any Zigbee devices before (except for Philips Hue, which operates in its own ecosystem), I purchased an officially supported Zigbee antenna. Based on this document: https://www.home-assistant.io/integrations/zha/, I decided on the ConBee 3. See: https://phoscon.de/de/conbee3

Before troubleshooting further can you answer if have connected Zigbee Coordinator via a USB-extension-cable to USB 2.0 port (not USB 3.0 port) and also if you first added any Zigbee Router devices (mains-powered) to the same ZHA Zigbee network as well?

Not saying one or both of those are the root causes in this case for you but they are two very common issues and best practice is therefore to always use Zigbee Coordinator connected via a long USB-extension-cable and place it a little bit away from anything else to get it away from possible sources of EMI/RMI/EMF + connect it to a USB 2.0 port and not USB 3.0 port (as USB 3.0 is a known source of EMI/RMI/EMF unless use a long shielded USB 2.0 extension-cable). Then another best practice it that you normally will first want to add a few mains-powered Zigbee Router devices as those acts as Zigbee repeaters to extent the range of ZHA's Zigbee network mesh before you add any Zigbee End Devices (non-routers) such as example battery-powered Zigbee products, as those usually do not have the signal range to get good reception without connectiing via other Zigbee devices on the same Zigbee network mesh.

Anyway, this specific repository is probably not correct support channel, as normally you post to the forum or Discord and then submit bug to Home Assistant core if get no help, at least if you are not a Python developer that planing to look deeper and possibly fix the problem yourself.

Unfortunately, I am not yet knowledgeable enough to fully understand the log or the Zigbee functionality to further narrow down the issue. Therefore, I am hoping for your help.

There is by the way a very extensive/detailed guide and discussion regarding Zigbee best practices in Home Assistant's community forum that recommend you try following regardless as doing so usually catch a lot of common root causes that can be avoided :

Also suggest you check out these additional community guides on Zigbee too as all of those can help you get up to speed:

Snabelt commented 5 hours ago

Hi @Hedda,

Thank you for your quick reply. I reviewed the links but couldn't find any information directly related to my problem. However, they did help me understand the issue a bit better.

Before troubleshooting further can you answer if have connected Zigbee Coordinator via a USB-extension-cable to USB 2.0 port (not USB 3.0 port) and also if you first added any Zigbee Router devices (mains-powered) to the same ZHA Zigbee network as well?

Currently, the Zigbee Coordinator is connected to the front ports of my server. Technically, it is an extension, but I have already ordered a 5-meter extension cable, which should arrive tomorrow. I will update you as soon as I've installed it. Like you mentioned, I also don’t think that this is the root cause. I don't have any Zigbee Routers in my network. The End Device is just 3 meters away from the Coordinator.

Anyway, this specific repository is probably not correct support channel, as normally you post to the forum or Discord and then submit bug to Home Assistant core if get no help, at least if you are not a Python developer that planing to look deeper and possibly fix the problem yourself.

I apologize if I'm using the wrong channel. I'm quite new to this, so I rely heavily on Google searches to find my way. Every problem that seemed close to mine led me to this GitHub issue page, so I decided to open a ticket here. Another reason is that I believe this might be a bug.

Hedda commented 4 hours ago

Currently, the Zigbee Coordinator is connected to the front ports of my server. Technically, it is an extension, but I have already ordered a 5-meter extension cable, which should arrive tomorrow. I will update you as soon as I've installed it.

Also check and verify that it is either connected to a USB 2.0 port (and not a USB 3.0 port) or at use a good quality shielded USB 2.0 extension cable (and not and not a USB 3.0 extension cable to a USB 3.0 port). An alternative if computer only has USB 3.0 ports is to buy a USB 2.0 port (with its own external power-supply) and connect via that instead.

Regardless, not using a USB extension cable and connecting to an USB 3.0 port can both be the root cause(s) of the problem, as can be seen if this demo -> https://www.youtube.com/watch?v=tHqZhNcFEvA

As you can see and understand from that video EMI/RMI/EMF interference can jam Zigbee communications (blocking or corrupting signal reception) which can cause symptoms like you describe.