WTH: I can't change the Zigbee channel when using the ZHA integration?

Tags: #<Tag:0x00007f73984a25a0> #<Tag:0x00007f73984a2410>

From what I have found, there is no way to change the Zigbee channel when using the ZHA integration in Home Assistant. I’ve seen multiple posts saying it’s hardcoded to ch15, but I haven’t seen that officially confirmed and I haven’t rummaged through source code myself.

I understand that Zigbee ch15 is between WiFi ch1 and ch6 (and can likely coexist there), and that setting your WiFi to be on ch11 would keep WiFi and ZHA Zigbee from interfering entirely. Reference: https://www.metageek.com/training/resources/zigbee-wifi-coexistence.html

However, that solution won’t always work. I’ve been trying to figure out why some of my Zigbee devices are intermittently not responding reliably. The devices in question are mains-powered devices (light bulbs and strips) that usually work great, but sometimes they fail to turn on/off or set their color/temperature/brightness correctly. I’ve discovered the for some reason, one of my neighbors’ routers has decided to park itself on WiFi ch3 recently - a different WTH topic, but not for here… I don’t know how much WiFi bandwidth he’s using on ch3, but ch3 is right on top of Zigbee ch15. It could explain a lot, and I’d like to test that theory.

I’d love to be able to try moving my Zigbee network to Zigbee ch20 or ch25 (like my Hue Bridge has already done), but I haven’t found a way to do that in ZHA.

It’s painful to change the channel. The default is channel is channel 15, but it can be changed currently with the following steps.

Note, this is not an easy change and will require re-pairing all devices. A majority of devices on the market will also not gracefully handle a channel change, even if the support for channel change notification was present in zigpy/bellows/ZHA.

Leave the network and form a new network with bellows

pip3 install bellows
export EZSP_DEVICE=/dev/ttyUSBX
bellows leave
bellows form -c X

Where /dev/ttyUSBX is your EZSP stick and -c X is your preferred channel. You can also run bellows scan -e -t 250 to see what is the best channel in your enviroment. Look for something in the -80 dBm to -100 dBM range. Anything around -30 to -50 is fairly noisy and will have contention.

Now modify your configuration.yaml to include the following:

zha:
  zigpy_config:
    network:
      channel: X   

Where X is the same channel that you picked with bellows.

Re-pair all devices.

1 Like

Thanks for the details, @walt - super helpful! The scanning command sounds quite useful.

Any idea whether the above will work with a ConBee II stick? Or do I have to use Deconz to configure it?

Though my WTH mentioned changing the channel of an existing network, it would also be useful for initial setup, where you wouldn’t have to worry about re-pairing. I think your bellows/YAML suggestion above will take care of that.

As for the re-pairing an existing network after a channel change, my Hue devices do this seamlessly when connected to the Hue hub, so perhaps wishful thinking for other devices…

A while back, I did disconnect my ConBee II stick from my HA box (after powering down the host), connected it to my Windows PC with Deconz running, and then joined the existing network… I think successfully, since Deconz could see all my devices. I then tried to change the channel to 25, and it seemed like it worked, at least when I read back the config value through Deconz, it returned 25, and I could still see my devices. Then I put the ConBee II stick back in the HA host, booted up, and couldn’t see any devices. I put a few of my Router devices back in pairing mode and re-added them via HA. That worked, and my Endpoint devices were auto-detected as the Router devices came back online.

However, based on what you said above, I suspect that even if I did get the ConBee II to switch to 25 when connected to my PC, it sounds like it switched back to 15 when booted with HA and that’s why I had to re-pair my Router devices after booting HA. I’m not sure how to check the current channel that HA/ZHA is using with my ConBee II - got a non-destructive way to do that without a spectrum analyzer?

In any case, I’m wondering if I may have previously accomplished the channel change on my Windows PC and then accidentally undid the channel change in HA since I didn’t specify a non-default channel in the HA config. I’m considering trying again, but before I only had about 20 devices, and now I have 100+. Thus, the stakes are higher now.

The above will only work for radios that the bellows library supports, namely EZSP (EmberZNet) radios like the HUSBZB-1 and Elelabs adapters.

I believe for your Conbee, your method should be valid as long as you have an existing network. From looking through the source code, it appears the channel is only changed when form_network is called here:

https://github.com/zigpy/zigpy-deconz/blob/e9496cf3d3fe21968c36b9b40fb3cf7235682957/zigpy_deconz/zigbee/application.py#L92

I assume you should be able to check your current channel still in deconz under Network Settings