Sonoff Zigbee 3.0 USB Dongle Plus w. WSL2 on Windows 11

Host OS: Windows 11 ver 21H2 (Build: 22000.376)
WSL2 dist: Ubuntu 22.04 (5.10.102.1-microsoft-standard-WSL2)
Zigbee USB-device: Sonoff ZIGBEE 3.0 USB DONGLE PLUS (w. native firmware)
Docker Desktop (running on host i.e. Windows): 4.9.1 (81317) Settings > Resources > WSL Integration > “Enable integration with my default WSL distro” and “Enable integration with additional distros: Ubuntu 22.04”

Hello,

Recently tried to get HomeAssistant running on my Windows 11 machine to try out my newly arrived “Sonoff Zigbee 3.0 USB Dongle Plus”.

In Windows the USB-device is identified as “Silicon Labs CP210x USB to UART Bridge (COM5)” under “Ports (COM & LPT)” after installing either the official ( ? ) drivers from here;

or from Sonoff directly;
SONOFF-Zigbee-3.0-USB-dongle-plus-firmware-flashing-.pdf

I then pass my USB-device to my WSL-distribution (Ubuntu 22.04) as per here;
Connect USB devices | Microsoft Docs

Checking “usbipd wsl list” returns (in PowerShell);

BUSID  DEVICE                                                        STATE
1-14   Silicon Labs CP210x USB to UART Bridge (COM5)                 Attached - Ubuntu-22.04

I then run “lsusb” (in my WSL-dist - Ubuntu 22.04) which returns;
Bus 001 Device 009: ID 10c4:ea60 Silicon Labs CP210x UART Bridge

I am using Portainer to manage my Docker containers so the HomeAssistant container is setup using it with the following non-default settings;

  • Env
    TZ = Europe/Stockholm
  • Volumes
Host/volume                     Path in container
homeassistant                  /config
  • Network
    Bridge

  • Port configuration
    8123 > 8123

  • Runtime & Resources > Devices
    host:/dev/ttyUSB0 container:/dev/ttyUSB0

  • Runtime & Resources
    Priviligied Mode

Starting HomeAssistant it automatically detects my Sonoff USB-device;
HomeAssistant_Onboarding_Sonoff_280622

Pressing the device and then confirming that I want it to be setup results after a while in;

Zigbee Home Automation
Failed to probe the usb device

the device then disappears from the printscreen above but is still listed if I do “lsusb” in my WSL-dist.

Finish > Settings > System > Logs;

at: No response to AP command
10:58:34 PM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_xbee/api.py
Retry command 0x0002
10:58:32 PM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_zigate/api.py
No response to command 0x0002
10:58:32 PM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_zigate/api.py
No response to 'Command.device_state' command with seq id '0x02'
10:58:30 PM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_deconz/api.py

Now I’ve read that you should actually do a “bind”-mapping in Portainer of:

Host/volume                     Path in container
/dev/serial/by-id                /dev/serial/by-id

however my WSLs “/dev/serial/by-id” is empty and the examples I’ve seen indicates that there should be a file there named something like “sonoff-zigbee-3-0-usb-dong” (or at least a file that can be assumed to be the Sonoff USB-device).

Also trying to do a bind-mapping in Portainer of above actually results in this;

Host/volume                                                                                                                            Path in container
/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-22.04/62d499dd032f6785fe3affd28998747c6d6e8a4b4ff5de2acdefdce458254eac     /dev/serial/by-id

however “/run/desktop” does not exist, what does exists seems to be;
/mnt/wsl/docker-desktop-bind-mounts/Ubuntu-22.04/
and in that directory there are three very long GUIDs;

/mnt/wsl/docker-desktop-bind-mounts/Ubuntu-22.04$
drwxr-xr-x  2 root root     40 Jun 28 19:01 62d499dd032f6785fe3affd28998747c6d6e8a4b4ff5de2acdefdce458254eac
srw-rw----  1 root docker    0 Jun 28 18:45 71329c4cc6e32171553fa81d044eb31d1a3aac52ba9376c4a99f4505c494cf5b
drwxr-xr-x 10 root root   2900 Jun 28 23:10 938b99e3330802a9290b64452b1b303a7efa94dd8f5fc86b6c941cf0644ce220

and the content of “938b99e3330802a9290b64452b1b303a7efa94dd8f5fc86b6c941cf0644ce220” seems to be the same as “/dev/”.

however even if I specify:

Host/volume                                                                                                                            Path in container
/mnt/wsl/docker-desktop-bind-mounts/Ubuntu-22.04/938b99e3330802a9290b64452b1b303a7efa94dd8f5fc86b6c941cf0644ce220/serial/by-id         /dev/serial/by-id

it reverts back to

Host/volume                                                                                                                            Path in container
/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-22.04/62d499dd032f6785fe3affd28998747c6d6e8a4b4ff5de2acdefdce458254eac     /dev/serial/by-id

Now I might be totally wrong but would appreciate it if someone has gotten this working and if how so.

Thanks / TheSwede86

Maybe the problem is not the setup, however the firmware. I would try to flash with the newest version of zStack, called 20220219.

Sadly not, I followed these instructions;
HowTo: Zigbee – Prepare a Sonoff zigbee 3.0 USB Dongle Plus for zigbee2mqtt - Nerdiy.de - Nerdy DIY HowTo’s about electronic, 3D-printing and more.
and flashed;
CC1352P2_CC2652P_launchpad_coordinator_20220219.zip
and still get this;

at: No response to AP command

12:39:12 AM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_xbee/api.py

Retry command 0x0002

12:39:09 AM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_zigate/api.py

No response to command 0x0002

12:39:09 AM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_zigate/api.py

No response to 'Command.device_state' command with seq id '0x02'

12:39:08 AM – (WARNING) /usr/local/lib/python3.9/site-packages/zigpy_deconz/api.py

the following is shown when running “dmesg” after attaching the usb-device using “usbipd”;

[ 1127.676144] init: (32) ERROR: CreateProcessEntryCommon:440: getpwuid(0) failed 2
[ 1127.676148] init: (32) ERROR: CreateProcessEntryCommon:443: getpwuid(0) failed 2
[ 1127.681475] init: (32) ERROR: CreateProcessEntryCommon:589: execvpe /bin/sh failed 2
[ 1127.681478] init: (32) ERROR: CreateProcessEntryCommon:598: Create process not expected to return
[ 1128.744468] vhci_hcd vhci_hcd.0: pdev(0) rhport(0) sockfd(3)
[ 1128.744470] vhci_hcd vhci_hcd.0: devid(65550) speed(2) speed_str(full-speed)
[ 1128.744499] vhci_hcd vhci_hcd.0: Device attached
[ 1129.023140] vhci_hcd: vhci_device speed not set
[ 1129.093127] usb 1-1: new full-speed USB device number 4 using vhci_hcd
[ 1129.173115] vhci_hcd: vhci_device speed not set
[ 1129.243182] usb 1-1: SetAddress Request (4) to port 0
[ 1129.279529] usb 1-1: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
[ 1129.279530] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1129.279531] usb 1-1: Product: Sonoff Zigbee 3.0 USB Dongle Plus
[ 1129.279532] usb 1-1: Manufacturer: ITead
[ 1129.279533] usb 1-1: SerialNumber: <omitted>
[ 1129.281424] cp210x 1-1:1.0: cp210x converter detected
[ 1129.287099] usb 1-1: cp210x converter now attached to ttyUSB0

when restarting the Home Assistant container and the Sonoff device is autodetected;

[ 1287.891022] cp210x ttyUSB0: usb_serial_generic_read_bulk_callback - urb stopped: -32
[ 1287.891024] vhci_hcd: unlink->seqnum 124
[ 1287.891024] vhci_hcd: the urb (seqnum 124) was already given back
[ 1292.332924] docker0: port 2(veth3e29046) entered disabled state
[ 1292.332965] veth5effa2a: renamed from eth0
[ 1292.470514] docker0: port 2(veth3e29046) entered disabled state
[ 1292.470777] device veth3e29046 left promiscuous mode
[ 1292.470780] docker0: port 2(veth3e29046) entered disabled state
[ 1292.611223] docker0: port 2(veth85c74fb) entered blocking state
[ 1292.611224] docker0: port 2(veth85c74fb) entered disabled state
[ 1292.611278] device veth85c74fb entered promiscuous mode
[ 1292.611325] docker0: port 2(veth85c74fb) entered blocking state
[ 1292.611325] docker0: port 2(veth85c74fb) entered forwarding state
[ 1292.943633] eth0: renamed from veth42580a2
[ 1293.003394] IPv6: ADDRCONF(NETDEV_CHANGE): veth85c74fb: link becomes ready

Hi, just incase this helps anyone else in the future I managed to fix this issue on my setup.

I enabled logging for the ZHA integration and saw that when trying to connect, I was getting a “permission denied” error related to the USB device path (i.e. /dev/serial/…). I run HA on Windows through WSL and although I’d passed the USB to WSL as you mentioned, I had to change my user permission groups by running the command:

sudo usermod -a -G dialout

I also previously added my user to uucp as someone else suggested, but it didn’t work until adding to dialout.

I have a ttyUSB0, but not a `/dev/serial/by-path/ . Can anybody help me out ?

Hi @TheSwede86
Did you ever figure this out? I want to connect Sonoff Zigbee 3.0 USB dongle to a on-prem Kubernetes cluster running on Hyper-V.

Hi Kristian,
What OS do you have running hyper-v (Win 10/11 or server)?
I recently got a Sonoff 3.0 (and an Aeotec 5) running very simply under the default haos virtual disk on a WIindows 2022 Server host. Hyper-v doesn’t support USB pass through, but, since 2016, it does support PCI device pass through - DDA. So I got a PCI USB card, passed that to the vm, plug the devices into the card and they appeared properly in the vm. HA detected them automatically. There’s a writeup of exactly what I did on another thread: https://community.home-assistant.io/t/ha-on-hyper-v-with-z-wave-and-zigbee-it-works/552529?u=blaal02
I don’t know if DDA is supported on win 10/11.

Thank you so much for your kind reply. I run Windows Server 2022. Will follow the thread. I almost gave up

@TheSwede86 how did you deal with reboots. I have this working with usbipd also and docker trying to deal with power failures and getting docker restarted but the usb devices have to be reattached.