Troubles trying to get ZHA working

I am trying to get ZHA working with a Conbee2. I’m running HA on Ubuntu Server on a NUC. After playing around installing the Deconz software in Ubuntu I was then able to add devices to ZHA through the HA config GUI. Not sure if installing Deconz in Ubuntu was required but prior to that I was not seeing the Conbee2 in the ZHA config menu despite it being listed in Supervisor / System / Hardware (in HA side menu)

The two zigbee devices were working perfectly and I was happy… until I restarted HA (for other reasons).

In the HA error log I got the below and the Conbee2 is not showing up in the HA ZHA config menu

2020-04-07 11:20:03 WARNING (MainThread) [zigpy_deconz.api] No response to ‘Command.read_parameter’ command
2020-04-07 11:20:03 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2120390-if00 for zha
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 215, in async_setup
hass, self
File “/usr/src/homeassistant/homeassistant/components/zha/init.py”, line 103, in async_setup_entry
await zha_gateway.async_initialize()
File “/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py”, line 137, in async_initialize
await self.application_controller.startup(auto_form=True)
File “/usr/local/lib/python3.7/site-packages/zigpy_deconz/zigbee/application.py”, line 45, in startup
self.version = await self._api.version()
File “/usr/local/lib/python3.7/site-packages/zigpy_deconz/api.py”, line 310, in version
(self._proto_ver,) = await self[NetworkParameter.protocol_version]
File “/usr/local/lib/python3.7/site-packages/zigpy_deconz/api.py”, line 280, in read_parameter
r = await self._command(Command.read_parameter, 1 + len(data), param, data)
File “/usr/local/lib/python3.7/site-packages/zigpy_deconz/api.py”, line 210, in _command
return await asyncio.wait_for(fut, timeout=COMMAND_TIMEOUT)
File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 449, in wait_for
raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

I’m not sure how to make sure the Conbee2 works properly on restarts, any ideas?

I assume you can not have Deconz and ZHA communicating with the Conbee II at the same time. Did you stop Deconz?

Well when I got ZHA working, Deconz was still running in Ubuntu… I’m guessing that after the server reboot Deconz would not be running anymore since I didn’t start it myself. Does the Deconz software need to be running in order for HA to see the Conbee2 given that Ubuntu is involved in the middle?

I just VNC’d back into Ubuntu, Deconz doesn’t appear to be running

Ok, strange because I’m pretty sure it should not be running. How did you check if it’s running?

Ubuntu GUI, task manager

No idea… but if if worked when Deconz was running, did you try to start it?

I can run Deconz in Ubuntu and it sees the Conbee2 and two devices I had added in HA, but since HA failed to load ZHA at boot, I would then have to restart HA again to test.

Oddly, after starting Deconz in Ubuntu, this time HA notified me of an available integration, this didn’t happen before despite me adding the devices :man_shrugging:

Is this the normal requirement for ZHA to work when running HA on top of Ubuntu?

EDIT: it wont let me add the integration because it wants the gateway unlocked…

I think two things get mixed up now because HA discovered Deconz and you want to use ZHA. You can not use them both at the same time.

yeah… I guess I could try using deconz instead of ZHA, but ZHA seemed to be better in terms of compatible devices when I was reading forum posts

I’m using Deconz (this docker image) not installed on the OS. Never tried ZHA as all my devices are supported (Hue, Ikea, Xiaomi). I think the main difference is Deconz is closed source so you depend on Dresden elektronik to add new devices.
An advantage (for me) of using Deconz is that I use Deconz for basic light on/off. If for some reason HA stops working I can atleast still switch on/off the lights.

I’ll give it a try since a HA restart just now didn’t help, got the same error.

EDIT: installed the Deconz add-on and integration but it doesn’t detect the already linked devices I had added back with the ZHA integration, nor can it detect them if I try to add them again via deconz. I think i need to go back to trying to get ZHA working

If using Deconz, you should not have ZHA integration active. The error is from ZHA, you can not have both active at the same time.

You are trying 3 things at the same time, Deconz on Ubuntu, ZHA and the Deconz addon. Focus on one and uninstall the others.

No, I’m not trying 3 things at once. I only had one installed / configured at a time and restarted HA in-between each attempt.

The thing is, I have 2 devices which are now linked to the Conbee2 and can be seen if I start deCONZ in Ubuntu, but deCONZ in HA will not see or detect them

So deconz running in Ubuntu works and shows the devices, correct? Remove the integration, addon and ZHA and add it manually to your config;

deconz:
  host: your.ip
  port: 8443

But I don’t want to use deCONZ since for some reason the two devices I have linked to the Conbee2 don’t seem to work with deCONZ in HA. I can get deCONZ working in HA, thats not the issue, the issue is getting ZHA to work because I want those two devices to work which only seem to work with ZHA, not deCONZ. If I could get those two devices working in deCONZ then I’d be happy with that…

Can you tell us the make and model of the devices? Are they on the list of supported devices from deconz? If so they should work. Maybe there is something going on between deconz on Ubuntu and HA that causes that. Maybe they work just fine when using the deconz addon in HA. That way you don’t have to go through the hassle of using zha.

They are Tuya door and window switches, not on the deCONZ compatible list. That was why I wanted to go with ZHA, which did work for a little while… until I restarted HA

Ok, clear. I would uninstall deconz as you can not have both deconz and ZHA connect to the Conbee. I think this is what could have happend when you restarted HA, deconz connected to the Conbee which made it impossible for ZHA to connect to it.

As I said before, I was trying only one at a time. Currently I have neither of them installed, but as soon as I install ZHA it starts spitting out the errors.

EDIT: Further info- after removing deCONZ in HA and Ubuntu, and ZHA from HA (so nothing zigbee installed) I can then install ZHA successfully and HA shows the Conbee2 and two paired devices, but all 3 are shown as unavailable. Which makes me think there is some sort of issue with the Conbee2 being accessed from Ubuntu?

ZHA integration:

Conbee2: (not much shown here)
image

door/window sensor:
image