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

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.

3 Likes

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

As part of debugging some other issues, I put my ConBeeII stick back in my PC with deCONZ running and sure enough, the channel mask has 15 checked and no other channels checked. Also, after enabling debug logging in HA, I can see that it’s setting up the mesh on ch15 once I put the ConBeeII stick back in the HA host. Looks like modifying the Zigbee channel in deCONZ and then setting up devices in HA with the default YAML definitely does not result in HA using the modified channel.

For now, I just moved my ch6 WiFi access points to ch11 to eliminate some of the potential interference with Zigbee on ch15. Still have one WAP on WiFi ch1, so it’s not perfect, but that’s better than running WiFi 1 and 6 with Zigbee right in the middle on 15.

I’m using one of the Sonoff Zigbee Wifi Bridges with Tasmota firmware and HA.
I just used ZBOSS to sniff my Zigbee network and found that its on ZB ch.11, not 15.

One of the known temp sensor addresses is e445.
e445 is in the communications list, so I’m pretty sure I’m sniffing on the correct channel.

see how-to:

Hey @mrneutron - did playing around with the frequencies buy you any stability? Ironically, I’m also using the sonoff reflashed with tasmota as my zha gateway- and my neighbor has a crazy strong signal down in the channel 11 region. My neighborhood is drowning in 2.4 signals in all channels AND my new ISP provided router doesn’t allow me to change my wifi channel - so there isn’t much hope for me, but I have so many sensors I feel pretty invested. Any tips/lessons learned and do you recommend moving the ZHA frequency around? (im not too excited about having to re-pair all my devices).

No, it didn’t help. My Sonoff Zigbee Bridge is operating on Zigbee ch.11, and it can’t be changed in ZHA. So, I moved my wifi as far away as possible - to the upper end on wifi ch.11.

From what I’ve been reading on this forum, there is a flaw in the serial-wifi-zigbee chain, and packets get lost/dropped, which causes the Sonoff Zigbee Bridge to disconnect/drop devices.
It sounds like if we move to a USB Zigbee stick as our Zigbee bridge (directo serial to Zigbee), the lost/dropped packet problem goes away.

I was just having huge issues with my sonoff zigbee loosing all connections, I noticed that one of my 2.4 aps was on channel 11… just moved that to see if it improves.