Trying to Add a Z2m Coordinator to my ZHA Setup

I have been using ZHA using SkyConnect (ZBT-1) for a while now on a Raspberry Pi and been very happy with things. Recently I bought a Sonoff SWV-ZNE Water Valve. I want to configure a setting on it that controls the maximum time the valve will stay open, but this is not configurable via ZHA. I have installed a quirks file but that does not cover this setting. I believe the setting can be controlled using MQTT.

I did a little bit of research and it looked like I could buy a second coordinator and configure that for MQTT. So I bought the new ZBT-2. I have installed it. I have installed the MQTT app and then Zigbee2MQTT. However, when I try to set up Zigbee2MQTT I get different errors. At first I got “USB Adapter Discover Error”, but adding the adapter line as below seemed to resolve that.

serial:
  port: /dev/ttyACM0
  baudrate: 115200
  rtscts: false
  adapter: ember

Now I get Failed to start EZSP layer with status=HOST_FATAL_ERROR which I believe is an inability to open the USB port, possibly because of the ZHA adapter. I found a suggestion (which I can’t find again now) to disable USB discovery using this:

default_config:
  discovery:
    ignore:
      - usb

But that hasn’t worked either, I still get the HOST_FATAL_ERROR.

I have two basic questions:

  1. Not understanding the quirks very well, is it possible that I could modify the quirks file so that I could access the particular setting I am interested in using ZHA? In which case I wouldn’t need my new ZBT-2, although I could migrate to it later given that it is a newer device.
  2. Assuming I need Z2M for this one particular device, and not wanting to migrate everything to Z2M, how do I fix the configuration so that I can actually setup Z2M just for this device? I have read some conflicting posts about co-existence of ZHA and Z2M, and some people say they have done it but don’t seem to explain how, so I think it should be possible to do it and to achieve a stable configuration, I just don’t know how to do this.

Thanks!

PS I am new to the forums, so I hope I am following the conventions correctly!

Undo this change ^^

Go back to your Z2M config & change it to use the serial device path instead of
port: /dev/ttyACM0

Easiest way to do this is to unplug your ZBT-2, check Hardware page inside HA, then & plug it back in & see what changed. Chances are, you were probably targeting the ZBT-1 in your Z2M config.

Note that Zigbee is a mesh network. You’re using a usb coordinator with an outside device. The signal might not be strong enough for communication between the ZBT-2 & the SWV. Chances are you will have message drops & trouble sending open/close commands (if you can even get it to pair) if the signal is weak.

I’ve had both Z2M & ZHA running simultaneously without any issues for 6 years now. All you need is 2 coordinators & to be aware that these are separate zigbee meshes. Everything else is just teething issues during initial configuration.

If all else fails, the error in Z2M points you towards this troubleshooting page. Read though that & follow the steps if you get stuck.

Thanks. I tried these things but I am not sure if I am doing things right. I removed the section in default_config and I changed zigbee2mqtt config to be this:

serial:
  port: /dev/serial/by-id/usb-Nabu_Casa_ZBT-2_14C19FC70608-if00
  baudrate: 115200
  rtscts: false
  adapter: ember

The hardware listing shows me this:

Which suggests the /dev/serial/by-id/usb-Nabu_Casa_ZBT-2_14C19FC70608-if00 setting is really the same as /dev/ttyACM0 anyway.

On rebooting the Zigbee2MQTT app shows “Error” on Settings->Apps, but there are no fresh logs in the zigbee2mqtt/logs folder. At this stage I go to the Zigbee2MQTT app and select Open Web UI which seems to be the only way to get a fresh attempt to connect and fresh logs. But under “Devices found” it only lets me set /dev/ttyACM0, it doesn’t appear to let me edit the configuration before trying to apply it, so when I submit the config it changes it back to /dev/ttyACM0 and then fails like before.

Is there a way to get the adapter to start again without running the Web UI? I would have thought a reboot did it, but I don’t think it does, at least there are no new logs in the zigbee2mqtt/logs folder after booting.

I have already been to the troubleshooting page you suggest. That suggests that something could be interfering with the USB discovery which is why I tried disabling it. It also suggests disabling ZHA, I am not sure how to do this, at least not without possibly deleting all my devices (?), but even if that is the solution then it would seem unlikely that the two devices, ZHA and Z2M, will work reliably once they are both enabled again.

Found this page which says that for the ZBT-2 I need the baud rate to be 460800 and rtscts to be true. That seems to have resolved the HOST_FATAL_ERROR. Furthermore, using /dev/ttyACM0 for the port is fine.

Until you unplug one of your USB devices or reboot the server running HA & the devices get detected in a different order. Safer to use /dev/serial/by-id/ & avoid the possibility of this happening altogether.

That makes sense, I have made the change as you suggest