Closed lociii closed 4 years ago
Test to forward the Zigbee coordinator from a Pi Zero W to the NUC using usbip, see thread.
This is just a copy of the contents of the aforementioned thread in case it gets deleted. All credits to luma
lsusb
>> Bus 001 Device 002: ID 0451:16a8 Texas Instruments, Inc.
0451:16a8 is the ID we're looking for.
Install usbip, load the kernel module and set it up to load on boot
sudo -s
apt-get install usbip
modprobe usbip_host
echo 'usbip_host' >> /etc/modules
Add a service definition to expose the device in /lib/systemd/system/usbipd.service
[Unit]
Description=usbip host daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/usbipd -D
ExecStartPost=/bin/sh -c "/usr/sbin/usbip bind --$(/usr/sbin/usbip list -p -l | grep '#usbid=0451:16a8#' | cut '-d#' -f1)"
ExecStop=/bin/sh -c "/usr/sbin/usbip unbind --$(/usr/sbin/usbip list -p -l | grep '#usbid=0451:16a8#' | cut '-d#' -f1`); killall usbipd"
[Install]
WantedBy=multi-user.target
Make the service known, load and start it
sudo systemctl --system daemon-reload
sudo systemctl enable usbipd.service
sudo systemctl start usbipd.service
On Ubuntu usbip is part of the generic tools package, install it and load the virtual USB host controller module
sudo -s
apt-get install linux-tools-generic -y
modprobe vhci-hcd
echo 'vhci-hcd' >> /etc/modules
Add a service definition to make the remote device available in /lib/systemd/system/usbip.service
[Unit]
Description=usbip client
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c "/usr/lib/linux-tools/$(uname -r)/usbip attach -r 10.10.10.10 -b $(/usr/lib/linux-tools/$(uname -r)/usbip list -r 10.10.10.10 | grep '0451:16a8' | cut -d: -f1)"
ExecStop=/bin/sh -c "/usr/lib/linux-tools/$(uname -r)/usbip detach --port=$(/usr/lib/linux-tools/$(uname -r)/usbip port | grep '<Port in Use>' | sed -E 's/^Port ([0-9][0-9]).*/\\1/')"
[Install]
WantedBy=multi-user.target
Replace 10.10.10.10 by your IP address and 0451:16a8 by the ID of your USB device
Make the service known, load and start it
sudo systemctl --system daemon-reload
sudo systemctl enable usbipd.service
sudo systemctl start usbipd.service
Switch done. Everything working as expected except for Philips outdoor motion sensor SML002. See https://github.com/zigpy/zigpy-cc/issues/57
ZHA light groups aren't working as well. Using HA light groups as a workaround.
Group control fixed in https://github.com/zigpy/zigpy-cc/issues/58 and waiting for release
@lociii Seen you posted in https://github.com/zigpy/zigpy-cc/issues/58 and got other alternative serial-over-network tips if don't want to move your NUC:
The first tip is to use ESP8266 with Jeelabs ESP-LINK firmware instead of a Pi Zero W. Function is same if can connect via serial:
The second cutting-edge tip is to buy the new Sonoff ZBBridge and run Tasmota with its serial-bridge, it is an all-in-one device:
PS: Regarding your Bitron AV2010/32 wall thermostat, open new issue on -> https://github.com/zigpy/zha-device-handlers/issues PPS: Somewhat related issue posted here but that is not quite on-topic https://github.com/zigpy/zha-device-handlers/issues/357
Oh wow. Thanks @Hedda
I got USBIP running on a Pi 3 since a while and it's working like a charm. Will check out your other proposals nevertheless. However I'd prefer not to buy another zigbee coordinator as the CC26X2R1 I'm currently using was quite expensive :-) For the group support it's just a matter of time until @sanyatuning changes are published.
For the Bitron AV2010/32 I just didn't update the list. They're working flawlessly.
So the last thing that's not working yet, is the SML002 Philips outdoor motion sensor from https://github.com/zigpy/zigpy-cc/issues/57
Will all work out sooner or later. People are spending their spare time to make all of this work, so I will have to be calmly waiting :-)
Cool! If you have the skill then you too can help with quirks for devices, checkout -> https://github.com/zigpy/zha-device-handlers
Based on the discussion in https://github.com/zigpy/zigpy-cc/issues/57 it seems like the Philips SML002 needs some changes either to zigpy-cc or zigpy core. At least with my amateur knowledge of how zigbee communicates, it cannot be fixed in a quirk. Even if I would love to help, this goes way beyond what I'm currently capable of :)
Group support merged into HA core master https://github.com/home-assistant/core/pull/39318
Switched now from zigpy-cc to zigpy-znp and everything is working properly!
Pros:
Cons:
Comparison: