Error Setting Up Entry - Sonoff Zigbee USB 3.0 Plus with ZHA

Hello all, I recently bought a Sonoff Zigbee USB 3.0 Plus and am trying to integrate it into HA using ZHA. I am running my HA in a VM through Virtualbox. I flashed the dongle with the latest firmware following this guide https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=video&cd=&cad=rja&uact=8&ved=2ahUKEwjOjtfYvOL4AhW5lmoFHct_CqEQtwJ6BAgFEAI&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DKBAGWBWBATg&usg=AOvVaw32HfgYXrQMc51ecgSLMzeh

I was able to successfully pass the USB through to HA and ZHA could see it when attempting to add the integration. However, the integration fails during setup and I get the following from the log entry

 Logger: homeassistant.config_entries
 Source: components/zha/core/gateway.py:173
 First occurred: 3:03:20 PM (1 occurrences)
 Last logged: 3:03:20 PM
 Error setting up entry Sonoff Zigbee 3.0 USB Dongle Plus, s/n: ... - ITead for zha
 
 Traceback (most recent call last):
   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 339, in async_setup
     result = await component.async_setup_entry(hass, self)
   File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 102, in async_setup_entry
     await zha_gateway.async_initialize()
   File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 173, in sync_initialize
     self.application_controller = await app_controller_cls.new(
   File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 61, in new
     await app._load_db()
   File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 53, in _load_db
     await self._dblistener.load()
   File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 491, in load
     await self._load_node_descriptors()
   File "/usr/local/lib/python3.9/site-packages/zigpy/appdb.py", line 573, in _load_node_descriptors
     async with self.execute(f"SELECT * FROM node_descriptors{DB_V}") as cursor:
   File "/usr/local/lib/python3.9/site-packages/aiosqlite/context.py", line 41, in __aenter__
     self._obj = await self._coro
   File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 184, in execute
     cursor = await self._execute(self._conn.execute, sql, parameters)
   File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 129, in _execute
     return await future
   File "/usr/local/lib/python3.9/site-packages/aiosqlite/core.py", line 102, in run
     result = function()
 sqlite3.OperationalError: no such table: node_descriptors_v8

I read the documentation for ZHA here Zigbee Home Automation - Home Assistant and attempted to run the command to clear the modem manager on my MX Linux host

sudo apt-get purge modemmanager

I rebooted HA after doing that but still see the error. I’m not finding anything on Google for that particular error. Is there something I’m doing wrong here?

It appears the usb port is unavailable. Could be a rights issue. Im on my phone so I can’t dig into either of my rp4 setups. I’ve had similar issues using an x10 controller through a serial to usb device. Had to include/dev/usb0 in some group. Memory serves me poorly but that was the ballpark where that particular solution was.

I have two sono dongles that work ed without flashing. Im always reluctant to flash unless it’s a last resort

It could be but I know ZHA sees the dongle. It showed no devices available during ZHA setup but I changed some config for virtual box and then it detected the device. I’m admittedly not adept with Linux so let me know if you have any further troubleshooting steps or techniques.

A nagging question lingers: did the dongle not work - and this caused you to flash it? Can you get back to the factory flash? It’s perplexing that the os sees it but no rf devices will communicate.

Can you consider not using virtual box and use docket containers instead? I have two implementations using docker with no zigbee issues

I only flashed it because every tutorial for Sonoff dongle with HA started out with that. This is my first foray into HA and any home automation stuff so I know enough to be dangerous but nothing beyond that, yet. I doubt I’d have a way to get back to factory install.

As for docker, I’d rather stick with vbox since that’s what I’m more familiar with. I’ve seen enough other stuff on forums to have hope that I should be able to get it to work. Gotta just be something I’m missing.

I have no experience with vbox. I have a microsoft datacenter with a variety of virtuals including ubuntu. Initially I wanted to setup the newest rpi4 on ubuntu but read about problems so I tried standing up ha in docker containers on the virtual running ubuntu. Got to the lovelace desktop but supervisor had huge issues. Bottom line: speculation was accurate - stick with debian 11.

Are you using the canned haos or on a linux flavor

Its got a Linux back end but I didn’t do anything special. I just downloaded the vdi from here https://www.home-assistant.io/installation/linux

that should be iron clad. I’m going on the assumption the flash is the issue. I know it’s a waste of money but getting another dongle (mine was $29 on amazon) and leaving it alone (flash wise) and see what happens.

I actually bought a new one on eBay after getting the Amazon one since it was half the price maybe I’ll see if that one works better out of the box. In the meantime, I am going to try a USB extender since I see everywhere that people recommend using that for various connection issues.

What do you make of the last line in my original error log?

sqlite3.OperationalError: no such table: node_descriptors_v8

To me, that sounds like a db issue but I wouldn’t know where to even look to troubleshoot it.

these errors are nested and can make little logical sense to us humans. obviously its sqlite but there is an element of data from the sq database that is the wrong puzzle piece…:frowning:

the usb port is the node, the descriptor (version 8 maybe) has no metadata. this tells me the configuration / installation is at fault

I finally, accidentally, got it solved. I did a core update and it crashed my HA. I restored from an automated Google backup I had but it required a password, which I didn’t have. I ended up starting over from scratch for my whole HA setup. The dongle had no issue being installed on the new HA instance and detected my Zigbee device without any problems.

Side note/moral of the story, test your backups!

congrats that you finally got a solution. funny thing about backups… I managed a boat load of public school systems with a number of techs assigned. every instance of a server build (obviously) required a backup solution but i would never sign off until a recovery was actually tested. tape systems were the worst for long term reliability but cloud bakups are completely unreliable. I have always had issues of allowing data leave the local domain - encrypted or otherwise.