core: ZHA unreliable and slow on boot (async_initialize: all attempts have failed) with Conbee 2

The problem

I switched from deconz to zha four weeks ago, because one of my devices is not supported, but now I have a lot issues with zha. Lights do not properly turn on and more often turn on again, after I turned them off. The log is fludded with WARNING logs. And if I reboot Home Assistant, it takes up to 60 seconds until all devices are available again.

What version of Home Assistant Core has the issue?

2021.12.4

What was the last working version of Home Assistant Core?

No idea, had the problem since I switched from deconz.

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Zigbee Home Automation

Link to integration documentation on our website

https://www.home-assistant.io/integrations/zha/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

…
2021-12-21 14:05:50 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xF542:11:0x0008]: async_initialize: all attempts have failed: [DeliveryError('[0xf542:11:0x0008]: Message send failure'), DeliveryError('[0xf542:11:0x0008]: Message send failure'), DeliveryError('[0xf542:11:0x0008]: Message send failure'), DeliveryError('[0xf542:11:0x0008]: Message send failure')]
…
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.wohnzimmer_eurotronic_thermostat
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.kueche_eurotronic_thermostat
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.bad_eurotronic_thermostat
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.schlafzimmer_eurotronic_thermostat
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.bad_eurotronic_thermostat
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.kueche_kuelschrank_tint_ambiw
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities climate.bad_eurotronic_thermostat
2021-12-21 14:05:55 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities light.schlafzimmer_schreibtisch_philips_ambiw
2021-12-21 14:05:56 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.schlafzimmer_schreibtisch_osram_stecker
2021-12-21 14:06:31 WARNING (MainThread) [homeassistant.components.zha.core.channels.base] [0xF542:11:0x0006]: async_initialize: all attempts have failed: [DeliveryError('[0xf542:11:0x0006]: Message send failure'), DeliveryError('[0xf542:11:0x0006]: Message send failure'), DeliveryError('[0xf542:11:0x0006]: Message send failure'), DeliveryError('[0xf542:11:0x0006]: Message send failure')]
2021-12-21 14:07:33 WARNING (MainThread) [zigpy_deconz.api] No response to 'Command.aps_data_indication' command with seq id '0x02'

Additional information

Home Assistant OS is running in an VM and the conbee stick has an USB extension cable.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

I’ve done further testing and researched further - plus upgraded to a Sonoff Zigbee 3.0 Plus from a Conbee II.

The delay is still present - Zigbee devices don’t become available until 6 minutes after a HA restart.

I think the issue is that ~a dozen of my smart bulbs are on hard wall switches, so if they are turned off at the switch, the zha bulbs are never seen by HA. HA continues to try and find the devices (5 times?) and I think that may be the issue here.

I tested this theory and restarted HA with all zha devices on and accessible. Sure enough, I cut the delay down to under a minute.

I will say that this same zha config with older HA versions (early 2021?) was available quicker through the UI- even if they were unreachable - than later 2021 versions.

The slow boot issues are caused by offline or unreachable mains powered devices. When we introduced support for multiple entities per cluster we had to increase the amount of attribute data we read from the devices. That increase coupled with the retries we perform to account for occasional messages failing are what causes this delay.

There isn’t a good solution to this issue. For networks that are stable with no offline devices these changes were negligible. For weak meshes / networks with many offline mains powered devices we have heard that what is outlined here is common. The main issue stems from the fact that we aren’t expecting mains powered devices to be offline.

it has been suggested that we offer a config to skip polling mains powered devices. I’m hesitant to do this because it will lead to state desync issues with the HA UI after rebooting. There is no good way to determine that a user has turned off the power to mains powered devices so the option would have to be per device and user set or global. I’m not a fan of either option.

I’ve done further testing and researched further - plus upgraded to a Sonoff Zigbee 3.0 Plus from a Conbee II.

The delay is still present - Zigbee devices don’t become available until 6 minutes after a HA restart.

I think the issue is that ~a dozen of my smart bulbs are on hard wall switches, so if they are turned off at the switch, the zha bulbs are never seen by HA. HA continues to try and find the devices (5 times?) and I think that may be the issue here.

I tested this theory and restarted HA with all zha devices on and accessible. Sure enough, I cut the delay down to under a minute.

I will say that this same zha config with older HA versions (early 2021?) was available quicker through the UI- even if they were unreachable - than later 2021 versions.

FYI, there is also known issues with ConBee USB adapter sometimes needing to be unplugged and reinserted after a restart of HA. If that is the case then might be a good idea to also report to https://github.com/dresden-elektronik/deconz-rest-plugin/issues (?).

Also, before even starting troubleshooting recommend following the guidelines here -> https://github.com/home-assistant/home-assistant.io/pull/18864 as that will at the very least probably reduce most errors and failures caused by a noisy environment due to RFI/EMI interference. Even if it is not the root cause for this issue, trying to reduce sources of interference should hopefully help further troubleshooting.

Short summary of best practices on how to achieve a stable Zigbee setup and a robust Zigbee network mesh:

Zigbee and especially the Zigbee Coordinator are known to be very susceptible to Radio Frequency Interference (RFI) / Electromagnetic interference (EMI) caused by different signal interfering sources, so most general tips is to try to reduce interference meant to be taken seriously and it is very important to follow those best practice guidelines even if they may sound silly at a glance.

A lot of ZHA and Zigbee2MQTT users and especially those with ConBee/RaspBerry based Zigbee Coordinator adapters have posted in the Home Assistant community forum reporting with similar symptoms or other types of connection problems with Zigbee devices and for many of those issues the root cause turned out to be RFI/EMI interference and the users reported that the problem was resolved by simply getting both the Zigbee Coordinator and devices a bit away from all possible sources of RFI/EMI interference.

  1. Upgrade to the latest firmware on the Zigbee Coordinator adapter (whichever adapter you have). For ConBee/RaspBerry see:
  1. Connect the Zigbee Coordinator adapter to a long USB extension cable to get it a bit away from computer and peripherals.
  2. Connect the Zigbee Coordinator adapter to a USB 2.0 port (or via USB 2.0 hub, because USB 3.0 ports do cause interference).
  3. Shield any computers and USB 3.0 peripherals like hard drives by using metal enclosures/cases for computer and peripherals.
  4. Make sure that your Zigbee Coordinator adapter and devices are not close to your WiFi Router or any WiFi Access Points.
  5. Zigbee devices do not have long-range (or good radio signal penetration) on their own so begin by successively adding more always-on mains-powered Zigbee Router devices (a.k.a. Zigbee signal-repeaters/range-extenders) closer to the Zigbee Coordinator adapter and then in each room building outwards to form a stable Zigbee network mesh before adding devices further way. Note! Remember that Zigbee Router devices should be installed with permanent power so they are always available.
  6. Afting adding always-on mains-powered Zigbee Router devices pair all the other devices (Zigbee end-device devices) such as example battery-powered sensors where you plan to have them permanently installed and do not move them around afterwards.
  7. If still have issues change Wi-Fi channel(s) on your WiFi router or WiFi access points to do not conflict with Zigbee -> https://www.metageek.com/training/resources/zigbee-wifi-coexistence/
  8. If still have a problem then consider changing Zigbee channel to channel 25 at the risk of then no longer being compatible with older Zigbee devices, also noting that changing Zigbee channel could mean that have to re-pair all or some devices.

PS: I appreciate it if you guys give a thumbs up to this PR if these guidelines help you -> https://github.com/home-assistant/home-assistant.io/pull/18864