This is a quick guide on how to connect ZHA to a Zigbee coordinator on different hardware than the hardware HomeAssistant is running on.
Reasons for wanting to do this could include:
- HomeAssistant running on hardware in a bad location in your house
- Needing to use ZHA over Z2M
- Long USB cords causing instability in Zigbee network
You will need another computer running Linux. A Raspberry Pi would work fine. I am using some really old Optiplex SFF running Debian.
- On the linux computer, run
apt install ser2net
. - Get the USB path by-id. This prevents issues when plugging in other devices to USB ports or moving the device to a different port.
ls /dev/serial/by-id
My output:usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2420347-if00
- Edit the yaml config for ser2net with
sudo nano /etc/ser2net.yaml
3.a The file will have a bunch of default config in it - comment all of that out and add the new config to the bottom:
connection: &con01
accepter: tcp,20108
enable: on
options:
kickolduser: true
chardelay-min: 0
chardelay-max: 0
connector: serialdev,
/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2420347-if00,
115200n81,nobreak,local
Check: [Connect to a remote adapter | Zigbee2MQTT](Connect to a Remote Adapter) for examples of other adapter configs. Note I changed the Conbee II config slightly from the example in that article to match the default configs I noticed in the yaml file and added some options I think provide more stability. I am not sure if this was necessary.
- Save with ctrl+x and execute:
sudo systemctl restart ser2net
- In HomeAssistant navigate to Settings > Devices & Services > Integrations > ZHA (Configure button).
- Click Migrate Radio
- Select reconfigure the current radio
- On serial device path click “enter manually”
- Type in:
9.a Substitute 192.168.X.X with the IP or hostname of the workstation that the coordinator is plugged into.tcp://192.168.X.X:20108
I have HomeAssistant running on a rack server in the basement. Previously I was using a very long USB cable and a lot of commands would fail, especially scenes involving a lot of Zigbee devices. Since making this change the stability has been rock solid.
Edit:
-
Changed the USB path to device by-id - Thanks SwerveShot
-
Added
chardeley-min
andchardelay-max
options in ser2net.yaml - not sure if this actually does anything, but larger commans, like turn off all the lights at once, seem to be more consistent. -
Added “or hostname” in option 9, as that is what I am using now