Help with zha, elelabs USB, zigbee and hass

Really, really struggling here.

With some help from the Discord team, I managed to finally get a stable hass install running on a Raspberry Pi (manual install; on top of Raspbian Lite).

What I am trying to do is to just get my Elelabs USB Zigbee stick working…at all!

Where I have got to is to have the following in my configuration.yaml :

zha:
  usb_path: /dev/ttyUSB0
  database_path: /home/homeassistant/.homeassistant/zigbee.db

But, if I do have this in there, the frontend web UI will not load. And there are no errors that I can see. In fact, the log only shows that it is trying to load config.core and not getting any further. This is the last set of entries from over an hour ago:

Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.loader] Loaded config.auth_provider_homeassistant from homeassistant.components.config.auth_provider_homeassistant
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.loader] Loaded config.script from homeassistant.components.config.script
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.loader] Loaded config.group from homeassistant.components.config.group
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.loader] Loaded config.device_registry from homeassistant.components.config.device_registry
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.loader] Loaded config.config_entries from homeassistant.components.config.config_entries
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.loader] Loaded config.core from homeassistant.components.config.core
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform yr is taking over 10 seconds.
Jan 02 11:06:42 Lazio hass[20758]: 2019-01-02 11:06:42 INFO (MainThread) [homeassistant.setup] Setup of domain config took 2.7 seconds.
Jan 02 11:06:43 Lazio hass[20758]: 2019-01-02 11:06:43 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 1.2 seconds.
Jan 02 11:06:48 Lazio hass[20758]: 2019-01-02 11:06:48 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 21.2 seconds.

If I comment the zha out, then it loads normally. If I comment discovery out, it makes no difference. The only devices it is finding on the network already are my Hue lights and Chromecasts.

Am at my wit’s end trying to get this working. Any help would be greatly appreciated!

Just a guess here… What are the permissions on that Zigbee.db file?

Better yet, does the zigbee.db file even exist at that location?

zigbee.db is in /home/homeassistant/.homeassistant, is owned by homeassistant:homeassistant and the permissions are “-rw-r–r--” - so, 644?

As per an answer I got on reddit, I tried changing the path to just /home/homeassistant/zigbee.db - but that made no difference. The zigbee.db file gets created either way, but the UI doesn’t load.

and there are no error or warning entries in the home-assistant.log file?

Nope. That’s what is so frustrating!

The only things that appear in there are the warnings that don’t tell you much: e.g. 2019-01-05 22:41:20 WARNING (MainThread) [homeassistant.setup] Setup of frontend is taking over 10 seconds.

are you sure the zigbee stick is located at that device address?

try entering the following in the terminal and see what the results are:

ls -l /dev/serial/by-id

This will tell you the id of any USB devices inserted.

ls -l /dev/tty*

This will tell you the device addresses of the dev/tty… devices

I had wondered that. Tried both your commands: got the following responses:

 ~# ls -l /dev/serial/by-id
total 0
lrwxrwxrwx 1 root root 13 Jan  1 19:56 usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0 -> ../../ttyUSB0

and

~#  ls -l /dev/tty*
crw-rw-rw- 1 root tty       5,  0 Jan  6 21:34 /dev/tty
crw--w---- 1 root tty       4,  0 Jan  1 19:56 /dev/tty0
...[then a whole bunch more, ending with]
crw--w---- 1 root tty     204, 64 Jan  1 19:57 /dev/ttyAMA0
crw------- 1 root root      5,  3 Jan  1 19:56 /dev/ttyprintk
crw-rw---- 1 root dialout 188,  0 Jan  6 21:35 /dev/ttyUSB0

What is the device at ttyAMA0?

What I would do now is pull the elelabs stick and run the same commands again and see what changes.

is ttyAMA0 bluetooth?

I pulled the stick and re-ran the commands:

~# ls -l /dev/serial/by-id
ls: cannot access '/dev/serial/by-id': No such file or directory

~# ls -l /dev/tty*
...[tty - tty63]
crw--w---- 1 root tty    4,  9 Jan  1 19:56 /dev/tty9
crw--w---- 1 root tty  204, 64 Jan  1 19:57 /dev/ttyAMA0
crw------- 1 root root   5,  3 Jan  1 19:56 /dev/ttyprintk

Ok well that definitely verifies that the stick is at ttyUSB0.

Have you looked at the setup instructions for the stick on the Elelabs website:

it has instructions specific to home assistant. I looked there and saw that you need to include a baudrate entry to the zha config. The example they show is for hassio but it should also work for regular HA also. You just need to modify the db path. Here is what they show as a config (I changed the db path for HA):

zha:
  usb_path: /dev/ttyUSB0
  database_path: /home/homeassistant/.homeassistant/zigbee.db
  baudrate: 57600

I would add the baudrate: to the config and see if it helps

Also I saw you changed your db path in the last attempt. Make sure you change that back to what you had before to keep everything standard (I already did that in the code above).

Also if that doesn’t work the guide at the elelabs site also has instructions for setting your logger up to get debug logs for zha too. So maybe that will help if adding the baudrate doesn’t help.

Thanks finity. I tried the baudrate but no joy.

I’ll try the advanced debugging. Hopefully there is a clue in there somewhere!

Well, we’re definitely getting more information now that I have loaded that debugger!

I now get a whole bunch more detail (here’s the log info: https://hastebin.com/igoqexagil.bash)

The last few lines:

Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.ezsp] Send command setConfigurationValue
Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.uart] Sending: b'664c215754790eb4591cd87e'
Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.uart] Data frame: b'674ca157547915ec1b7e'
Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.uart] Sending: b'87009f7e'
Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.ezsp] Application frame 83 (setConfigurationValue) received
Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.ezsp] Send command networkInit
Jan 10 20:40:21 Lazio hass[31170]: 2019-01-10 20:40:21 DEBUG (MainThread) [bellows.uart] Sending: b'774d2157543d0cfe7e'
Jan 10 20:40:26 Lazio hass[31170]: 2019-01-10 20:40:26 DEBUG (MainThread) [bellows.uart] RSTACK Version: 2 Reason: RESET_POWER_ON frame: b'c102029b7b7e'

That’s where it seems to be getting stuck.

Any ideas?

At this point I’ve got nothing.

I did a search and there are some references to something similar but nothing exactly matching and no real resolution as far as I could find.

Maybe your best bet would be to continue this with Elelabs customer tech support.

Yeah, I was afraid you’d say that. :frowning: I have reached out to them before and haven’t had any response.

In fact, their website says they no longer sell this version of the USB stick, and new ones are coming in 2019. :angry:

Any better suggestions for Zigbee control from a Raspberry Pi?

I’ve been using the the HUSBZB-1 for about a year and a half ever since I started using HA.

I’ve “almost” never had any troubles with it…

I’ve only got some Sengled light bulbs connected to it and they have worked really well so far.

However, right after I got the stick and bulbs all connected and working i bought some zibee “compatible” Bosch motion sensors that were really cheap. And then I found out a couple of things. 1. they weren’t compatible with the zha version that HA uses. 2. The place where I bought them from had horrible customer service. When I requested a RMA to return them the guy basically told me he would gladly accept a return but he would charge me the entire amount of the order as a “restocking fee”. :roll_eyes: They’ve been sitting on the bench ever since.

Then about a couple of months ago out of the blue for some unknown reason the HUSBZB-1 stick started acting screwy. it would intermittently loose comms with the NUC i’m running HA on and/or the zigbee lights. I fought it for a few weeks then decided to try out zigbee2mqtt (which is my next recommendation after the HUSBZB stick) which would have the added benefit of possibly getting those “useless” motion sensors working since you can add functionality to the software to potentially integrate new devices.

But then while I was waiting on the CC2531 stick and programmer to be sent over on a slow boat from china :slightly_smiling_face: I thought about the fact that I still had my original RPi that had a perfectly working instance of HA on it that the stick ran on before I switched to the NUC. I plugged the stick in there and it’s been working perfectly ever since :confused:

So now I use MQTT from my main HA on the NUC to control zigbee devices connected to the stick running in HA on the RPi.

The zigbee2mqtt set up has the advantage of being cheaper than the HUSBZB-1 stick (US$45 on Amazon with prime shipping) even with buying the required programmer (~US$25 at Aliexpress) but like I said it takes forever to get shipped and you might have to put in a little work if your devices aren’t already included in the supported devices. But there are a bunch of supported devices already so the chances of that are less than what you might think.

https://github.com/Koenkk/zigbee2mqtt/blob/master/docs/information/supported_devices.md

hey @thecrane
I’ve also got an Elelabs stick but never ran into any of these problems. Originally I was using it on a Pi 3b with hassio, I setup exactly as you did in the configuration.yaml as /dev/ttyUSB0 and a database path. About a month or so back I moved over to an Asus Tinkerboard but still running hassio, this time I set it back up using the ‘Integrations’ page from the front end. I’ve not had any issues with that setup method either.

Nothing special on my frontend config either, just enabled. Updater and discovery disabled.

frontend:

config:

hassio:

Sorry realize this probably doesn’t help but thought to at least let you know it works on hassio
Maybe try setting the radio type on the config? radio_type: ezsp

image

It’s good to know that you at least have it working!

I am using HASS on Raspbian, as I had issues with hassio initially. But I can’t get it to load!

I’ve recently enabled the debugger and got some more information - it seems to be sticking here:

Jan 14 17:04:37 Lazio hass[673]: 2019-01-14 17:04:37 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback SerialTransport._read_ready()
Jan 14 17:04:37 Lazio hass[673]: Traceback (most recent call last):
Jan 14 17:04:37 Lazio hass[673]:   File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
Jan 14 17:04:37 Lazio hass[673]:     self._callback(*self._args)
Jan 14 17:04:37 Lazio hass[673]:   File "/srv/homeassistant/lib/python3.5/site-packages/serial_asyncio/__init__.py", line 106, in _read_ready
Jan 14 17:04:37 Lazio hass[673]:     self._protocol.data_received(data)
Jan 14 17:04:37 Lazio hass[673]:   File "/srv/homeassistant/lib/python3.5/site-packages/bellows/uart.py", line 64, in data_received
Jan 14 17:04:37 Lazio hass[673]:     self.frame_received(frame)
Jan 14 17:04:37 Lazio hass[673]:   File "/srv/homeassistant/lib/python3.5/site-packages/bellows/uart.py", line 86, in frame_received
Jan 14 17:04:37 Lazio hass[673]:     self.data_frame_received(data)
Jan 14 17:04:37 Lazio hass[673]:   File "/srv/homeassistant/lib/python3.5/site-packages/bellows/uart.py", line 107, in data_frame_received
Jan 14 17:04:37 Lazio hass[673]:     self._application.frame_received(self._randomize(data[1:-3]))
Jan 14 17:04:37 Lazio hass[673]:   File "/srv/homeassistant/lib/python3.5/site-packages/bellows/ezsp.py", line 169, in frame_received
Jan 14 17:04:37 Lazio hass[673]:     assert expected_id == frame_id
Jan 14 17:04:37 Lazio hass[673]: AssertionError

According to the PDF that Elelabs has on their site:

That means your USB adapter has a different version, probably v6. While Home Assistant version is
<=0.66.

First, try to update the Home Assistant, probably later versions will support v6 ezsp protocol and
you will not have this issue.

Second, try to perform the Software Downgrade on the Elelabs USB Adapter to downgrade it to v5,
which is supported on 0.66. To do it you better contact us at [email protected].

Contacting them has resulted in radio silence. I’m running the latest build (0.84?) of HASS, so it can’t be that. I’m now trying to find out if I can manually update the ezsp support to v6?

Why is this soooo hard?! :frowning:

Thanks for all those details, @finity - I appreciate that. I will have to look a bit closer and see if this is an option for me.

To be honest, I would just use a SmartThings hub, but they only come in the z-wave frequency that is illegal in my part of the world.