Zha with xbee works; then after reboot, unable to control anything zigbee

I finally was able to get ZHA working with an Xbee 2C. I was able to pair some bulbs and control them. Once I restarted home-assistant or rebooted my pi, all attempts to control my zigbee devices had failed. If I remove them from the config and re-pair them then they are controllable again; of course until I restart HA.

2018-08-02 17:41:14 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1622089008: Received {‘type’: ‘call_service’, ‘service_data’: {‘entity_id’: 'light.g$
2018-08-02 17:41:14 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=entity_id=light.ge_appliances_zll_light_001479b5_1, servic$
2018-08-02 17:41:14 DEBUG (MainThread) [zigpy_xbee.zigbee.application] Zigbee request seq 17
2018-08-02 17:41:14 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall light.turn_off: entity_id=[‘light.ge_appliances_zll_light_001479b5_1’]>
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py”, line 1038, in _event_to_service_call
await service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/init.py”, line 362, in async_handle_light_service
await light.async_turn_off(**params)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/zha.py”, line 127, in async_turn_off
await self._endpoint.on_off.off()
File “/srv/homeassistant/lib/python3.5/site-packages/zigpy/device.py”, line 89, in request
expect_reply=expect_reply,
File “/srv/homeassistant/lib/python3.5/site-packages/zigpy_xbee/zigbee/application.py”, line 71, in request
self._devices_by_nwk[nwk],
KeyError: 38475

configuration.yaml:

zha:
radio_type: xbee
usb_path: /dev/ttyUSB0
baudrate: 115200
database_path: /home/homeassistant/.homeassistant/zigbee2.db

Version: Latest and greatest via Hasbian.

Hi,

Did you figure out the problem here?

I have the the exact same problem with an xbee s2c. I’ve tried with both up-to date hass.io on a PI and a venv installation on my notebook, both of them showing the same error. The value of KeyError in the end of the traceback is the network id of the first zigbee gadget paired, I can see it in the zigbee.db in the device table, nwk column.

I have yet to find a solution to this problem. I may try tweaking the firmware settings of the xbee to see if that helps. my current config is as follows:

zha:
radio_type: xbee
usb_path: /dev/ttyUSB0
baudrate: 115200
database_path: /home/homeassistant/.homeassistant/zigbee2.db

I’ve tried changing some firmware settings, none of them helped.

I’ve created an issue on zigpy : https://github.com/zigpy/zigpy/issues/77

This has been resolved for zigpy-xbee.

I’m still having this problem. Has this fix not made it’s way to the latest Hass.io release? I’m running HassOS 1.13 with a husbzb-1 dongle and testing with a GE Link light.

I am not sure if it is in the release or not; i updated zigbee-xbee via git in order to test the latest code changes.

Also you will need to rejoin all zigbee devices once on the new code. let me know if you need help doing the pull via git.

Hi,

I connected 4 zigbee lights yesterday and have the problem:
After a restart the zigbee lights are not working and I need to pair them again, then they are working again.
But my sensor is still connected.

Is there something what I can do to fix it??

Thanks in advance,
Jacob

You need to git clone the zigpy-xbee library (https://github.com/zigpy/zigpy-xbee). Then locate the zigpy-xbee component directory and replace it with the cloned zigpy-xbee directory you just pulled via git. Then mv your zigbee.db to zigbee.db.backup. Restart home assistant and repair your light bulbs

husbzb-1 is not an xbee. This fix is only for the zigpy-xbee component; so it has no bearing on the husbzb-1 as that leverages the zigpy and bellows components. Check this thread here for more information (Husbzb-1: what I have learned abouto this dongle so far in terms of z-wave and zigbee features)

Thanks for the info.
I have a Husbzb-1 and the lights ( 7 bulbs and one switch that is seen as a light) are not online after a reboot of the HASSIO. The sensors are able to reconnect.

I hope this can be fixed.

Update after upgrade to 0.88 version of home assistant:
I do not have to pair the lights again.
Now to turn off and on again is enough to let them connect again.
My current configuration.yaml for Zigbee:

Linear HUSBZ-1 USB Module

zha:
usb_path: /dev/ttyUSB1
database_path: /config/zigbee.db

Einde Zigbee Module

1 Like

that is great news. I am hesitant to upgrade to .88 just yet.

Hi,
The last update for now.
I changed from ZHA to zigbee2mqtt.
Advantage: stable
Disadvantage: slower than ZHA.

Best regards,
Jacob

Hi,

May I know do you search your ZigBee USB Path?

After configure the following, then it will works perfectly without any further settings?

zha:
usb_path: /dev/ttyUSB1
database_path: /config/zigbee.db

Thanks.

Hi,

To find your USB Path, you can navigate in HASSIO:

  1. in the left menu in Home Assistant go to “Hass.io
  2. Go to the tab. “SYSTEM”
  3. Choose “HARDWARE” in the “Host system” window.

Best Regards,
Jacob

Update: I wanted to try ZHA again.
(I did not got 2 bulb lights connected, so I used ZHA for this and then found out, that the response with ZHA is much faster then Zigbee@MQTT.

I have updated HASSio to version 0.91.4.

It is stable. It is responding nice and after a restart it is still online en it stay’s online.
(So I am very happy with this, thanks to all who make this happen)

I have connected to ZHA:
6 bulbs, (gledopto)
2 leak sensors, (aqara)
2 huminty sensors, (aqara)
1 smoke sensor (Heimann)
5 motion sensors.(aqara)
1 double remote switch (aqara)

The one I am strugle with is the aqara.remote dubble switch. This was better in Zigbee2MQTT.
There you had only one sensor, this works like: left, doulbe_left, left_long,
In ZHA it stay’s on and you have more sensors…….9 in total (1 for left, 1 for right and 1 for both), but they are not all working. if you pressed left, the sensor stay’s left.

I need to look in to this.

This is all for this moment,
Dit is het voor nu,
Laterssss,
Jacob

@joe8mofo hey, sorry, just read your post about finding zigpy-xbee and replacing with the git version - how do you locate zigpy-xbee on Hassio? I’m running 0.98.2 and getting some bugs and I’m thinking updating to 0.4.0 of zigpy-xbee might help?

In the top of this topic:

husbzb-1 is not an xbee. This fix is only for the zigpy-xbee component; so it has no bearing on the husbzb-1 as that leverages the zigpy and bellows components.

I can not help you, i have the husbzb-1 stick. (Not use zigpy-xbee.)

Best regards,
Jacob

@Jacob_nr.5 Opps. Sorry. I must have missed that.
I ended up ditching the xbee units and bought a DeCONZ from Amazon which is working wonders (I don’t have any Zwave devices and at worst case when I decommission Hubitat I can hopefully use the Zwave stick from that if I need it)