dboris Posted October 7, 2023 Share Posted October 7, 2023 (edited) Hello, thanks for this awesome plugin ! However I have an issue with Home Assistant and the new Sonoff ZigBee bridge USB Key. Each time my Unraid server comes out of sleep, I get a Virsh error on this USB device. I originally wanted to script a disconnection and reconnection of the key but your plugin provide a simpler way to do it than on the VM page. I just have to do VM detach and VM attach to some the error :). Would there be a way for me to script this, simpler, using your plugin ? If I could externally call your functions, it would be a neat way to do it. Thanks. Edited October 7, 2023 by dboris Quote Link to comment
SimonF Posted October 7, 2023 Author Share Posted October 7, 2023 22 minutes ago, dboris said: Hello, thanks for this awesome plugin ! However I have an issue with Home Assistant and the new Sonoff ZigBee bridge USB Key. Each time my Unraid server comes out of sleep, I get a Virsh error on this USB device. I originally wanted to script a disconnection and reconnection of the key but your plugin provide a simpler way to do it than on the VM page. I just have to do VM detach and VM attach to some the error :). Would there be a way for me to script this, simpler, using your plugin ? If I could externally call your functions, it would be a neat way to do it. Thanks. Are you using the S3 sleep plugin? Another users was doing something similar in the early days. Example of commands to run. rc.usb_manager is the name of the functions now the below was before the plugin was renamed. Quote Link to comment
dboris Posted October 7, 2023 Share Posted October 7, 2023 (edited) I edited these commands by replacing and name of the VM with "HomeAssistant"... But somehow it calls a halt of the system and shut my sytem off when I wake it from sleep. Ah ah ah. I will investigate :). Edited October 7, 2023 by dboris Quote Link to comment
dboris Posted October 7, 2023 Share Posted October 7, 2023 1 hour ago, dboris said: I edited these commands by replacing and name of the VM with "HomeAssistant"... But somehow it calls a halt of the system and shut my sytem off when I wake it from sleep. Ah ah ah. I will investigate :). unraid.usbip-gui is not installed. Seems that's a common issue. I tried reinstalling the plugin and rebooting without success. Quote Link to comment
SimonF Posted October 7, 2023 Author Share Posted October 7, 2023 1 minute ago, dboris said: unraid.usbip-gui is not installed. Seems that's a common issue. I tried reinstalling the plugin and rebooting without success. unraid.usbip-gui was the original name for usb_manager. replace rc.unraid.usbip-gui with rc.usb_manager Quote Link to comment
dboris Posted October 8, 2023 Share Posted October 8, 2023 It works. Reboot bug was because somehow virsh wasn't interpreting the VM name when using parenthesis. So the script part for sleep is : virsh suspend HomeAssistant rc.usb_manager vm_action HomeAssistant disconnect And wake up : rc.usb_manager vm_action HomeAssistant prepare virsh resume HomeAssistant 1 Quote Link to comment
shremi Posted October 12, 2023 Share Posted October 12, 2023 Hello i am trying to add my rtl 433 USB device to my home assistant VM . I am getting some virsh errors. root@Tower:~# cat /usr/local/emhttp/state/usb.ini | grep error virsherror = "" virsherror = 1 virsh = "error: Failed to attach device from /tmp/libvirthotplugusbbybusHassio-003-004.xml error: unable to stat: /dev/serial/by-id/: No such file or directory And the weirdest thing root@Tower:~# cd /dev/serial/by-id/. bash: cd: /dev/serial/by-id/.: No such file or directory I am at a lost in here , any advice on how to proceed ???? Quote Link to comment
SimonF Posted October 12, 2023 Author Share Posted October 12, 2023 Are you trying to connect as serial? Try with just these two Quote Link to comment
shremi Posted October 13, 2023 Share Posted October 13, 2023 On 10/12/2023 at 5:57 AM, SimonF said: Are you trying to connect as serial? Try with just these two Yeah i am trying to add my usb-rtl dongle to my home assistant VM , from what i read , it is required to connect as serial for home assistant. Quote Link to comment
SimonF Posted October 13, 2023 Author Share Posted October 13, 2023 6 minutes ago, shremi said: Yeah i am trying to add my usb-rtl dongle to my home assistant VM , from what i read , it is required to connect as serial for home assistant. As far as I know only conbee ii needs to be connected as serial in HA. Your dev does not have a serial option hence the path is missing on the host. Quote Link to comment
dopeytree Posted November 9, 2023 Share Posted November 9, 2023 (edited) I know this is really for VM's but it would be awesome if it could show the correct mappings that can be copied into docker configs. It's easy enough to go to /bus/usb/001/009 but its not as easy to find the /dev/ttly84575 type code Also bus numbers seem to change on reboots. What do you guys do for docker usb passthroughs? I guess this is why folks run home assistant as a VM lol. Trying to add the motherboard's intel bluetooth chip & a zigbee usb stick.. Strange though as frigate docker using google coral usb was handsfree working. Edited November 9, 2023 by dopeytree Quote Link to comment
SimonF Posted November 10, 2023 Author Share Posted November 10, 2023 14 hours ago, dopeytree said: I know this is really for VM's but it would be awesome if it could show the correct mappings that can be copied into docker configs. It's easy enough to go to /bus/usb/001/009 but its not as easy to find the /dev/ttly84575 type code Also bus numbers seem to change on reboots. What do you guys do for docker usb passthroughs? I guess this is why folks run home assistant as a VM lol. Trying to add the motherboard's intel bluetooth chip & a zigbee usb stick.. Strange though as frigate docker using google coral usb was handsfree working. Is it the serial port mappings you are looking for? This will show links to tty dev. root@computenode:~# ls -l /dev/serial/by-id/ total 0 lrwxrwxrwx 1 root root 13 Nov 10 07:33 usb-0658_0200-if00 -> ../../ttyACM0 lrwxrwxrwx 1 root root 13 Nov 10 11:55 usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_-if00 -> ../../ttyACM1 Quote Link to comment
SimonF Posted November 10, 2023 Author Share Posted November 10, 2023 1 hour ago, dopeytree said: Do you have an example type of device and how you find the mapping? This is one of the ways I get info. adding -a will walk up the tree. udevadm info -q property -n /dev/bus/usb/001/012 root@computenode:~# udevadm info -q property -n /dev/bus/usb/001/012 BUSNUM=001 DEVNAME=/dev/bus/usb/001/012 DEVNUM=012 DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5.4 DEVTYPE=usb_device DRIVER=usb ID_BUS=usb ID_MODEL=0200 ID_MODEL_ENC=0200 ID_MODEL_ID=0200 ID_REVISION=0000 ID_SERIAL=0658_0200 ID_USB_INTERFACES=:020201:0a0000: ID_VENDOR=0658 ID_VENDOR_ENC=0658 ID_VENDOR_ID=0658 MAJOR=189 MINOR=11 PRODUCT=658/200/0 SUBSYSTEM=usb TYPE=2/0/0 USEC_INITIALIZED=42627407 Quote Link to comment
jzhvymetal Posted November 17, 2023 Share Posted November 17, 2023 Love the plug, and it works great. Is there a way to run a script when it detects a device? I have a KVM that has a USB hub that passes a USB keyboard/mouse dongle. I would like it to start a VM if it is not already running. Is it possible to add the option in the plugin to start the VM when a USB device is detected? Quote Link to comment
SimonF Posted November 17, 2023 Author Share Posted November 17, 2023 15 minutes ago, jzhvymetal said: Love the plug, and it works great. Is there a way to run a script when it detects a device? I have a KVM that has a USB hub that passes a USB keyboard/mouse dongle. I would like it to start a VM if it is not already running. Is it possible to add the option in the plugin to start the VM when a USB device is detected? I did start to look at adding option to run a script but have not implemented as yet. But if it is just starting the VM if not started that should be a simple-ish add. Or option to run a user script from squids plugin may also be do-able. 1 Quote Link to comment
SimonF Posted November 17, 2023 Author Share Posted November 17, 2023 7 hours ago, jzhvymetal said: Love the plug, and it works great. Is there a way to run a script when it detects a device? I have a KVM that has a USB hub that passes a USB keyboard/mouse dongle. I would like it to start a VM if it is not already running. Is it possible to add the option in the plugin to start the VM when a USB device is detected? Add a switch to the settings to start vm when a device is connect if shutdown. release 2023.11.17 Quote Link to comment
jzhvymetal Posted November 17, 2023 Share Posted November 17, 2023 (edited) Thanks you work fast. I tried it but does not seem to start the VM. Is at the start of the Plugin or when the USB device is plugged in and discovered? Edited November 17, 2023 by jzhvymetal Quote Link to comment
SimonF Posted November 17, 2023 Author Share Posted November 17, 2023 12 minutes ago, jzhvymetal said: Thanks you work fast. I tried it but does not seem to start the VM. Is at the start of the Plugin or when the USB device is plugged in and discovered? I will be when the device is plugin. How have you set up the mapping? also what usb manager messages do you have in the log? Quote Link to comment
jzhvymetal Posted November 18, 2023 Share Posted November 18, 2023 13 minutes ago, SimonF said: I will be when the device is plugin. How have you set up the mapping? also what usb manager messages do you have in the log? Mapping in post above. Logs are below. I just updated the usb plugin do I need to restart Unraid? Quote Link to comment
SimonF Posted November 18, 2023 Author Share Posted November 18, 2023 9 minutes ago, jzhvymetal said: Mapping in post above. Logs are below. I just updated the usb plugin do I need to restart Unraid? No need to restart unraid. sorry just seen the mapping. I will need to test with a vm with a space in name tomorrow as late here now. Quote Link to comment
jzhvymetal Posted November 18, 2023 Share Posted November 18, 2023 3 minutes ago, SimonF said: No need to restart unraid. Have you set the switch in the device mappings as per my screen shot you will need to enable start vm switch. Yes I did.....see below. The KVM switches in a USB hub that the dongle is connected. Switching KVM port, It works perfect when the VM is on. When VM is off it does not start the VM. Quote Link to comment
SimonF Posted November 18, 2023 Author Share Posted November 18, 2023 1 minute ago, jzhvymetal said: Yes I did.....see below. The KVM switches in a USB hub that the dongle is connected. Switching KVM port, It works perfect when the VM is on. When VM is off it does not start the VM. I updated my post above. Will do some more testing tomorrow Quote Link to comment
jzhvymetal Posted November 18, 2023 Share Posted November 18, 2023 Just now, SimonF said: I updated my post above. Will do some more testing tomorrow Ok thanks. No rush. I have my Unraid server 20m away in basement but I have my work laptop to start the VM. Most say to leave the VM running but I notice there is 40w less draw when it is sleeping. The goal is to start the VM remotely by just switching the KVM. In case others want a simular setup below is the hardware I'm using. Addional hub is not required but I use it be able to mount external storage without KVM on the Unriad port. KVM https://www.amazon.com/dp/B0C5WMSRSC?psc=1&ref=ppx_yo2ov_dt_b_product_details This USB Hub https://www.amazon.com/dp/B0BMFDLRSQ?psc=1&ref=ppx_yo2ov_dt_b_product_details Usb Extension Cable https://www.amazon.com/dp/B00AA0U08M?psc=1&ref=ppx_yo2ov_dt_b_product_details Quote Link to comment
jzhvymetal Posted November 18, 2023 Share Posted November 18, 2023 (edited) 54 minutes ago, SimonF said: No need to restart unraid. sorry just seen the mapping. I will need to test with a vm with a space in name tomorrow as late here now. Again no rush......I tried renaming the VM to "Windows_11" and remapping the dongle and sitll does not start. It might be that the device is casecaded with multiple USB hubs? Let me know if there anything else needed for testing. BR Here is my setup Unraid Server -> Active USB cable -> Powered USB Hub -> Powered KVM with switched USB HUB -> Logitech Keyboard/Mouse Dongle Edited November 18, 2023 by jzhvymetal Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.