USB devices not showing in hardware list on Virtualbox VM install of Home Assistant

Hey guys,
I run Home Assistant on an always on Mac Mini in my home.
I run it as a Virtual Machine using VirtualBox.
For the most part things are pretty smooth.
I just got a Sonoff Zigbee CC2531USB dongle that is pre-flashed with the CC2531ZNP-Prod firmware so should be plug and play for several Zigbee integrations within Home Assistant https://www.itead.cc/cc2531-usb-dongle.html

I have plugged it in to a USB port on my Mac Mini, then I have connected it to my running Home Assistant VM and I see this output in the console:

new full-speed USB device number 4 using ohci-pci 
New USB device found, idVendor=0451, idProduct=16ae, bcdDevice=95.28 
New USB device strings: Mfr=1, Product=2, SerialNumber=0 
Product: CC2531 USB Dongle 
Manufacturer: Texas Instruments 

When I look in supervisor/hardware in my Home Assistant GUI there are no devices, even after restarting, rebooting, creating a fresh install and trying it on that.
I’m wondering if anyone has an idea why this might be happening and how to solve it so I can get up and running with this.

thanks for any help you can offer.

It’s not a Home Assistant thing, it is a virtualbox thing. You need to make your USB devices available in Virtualbox.

I tried that by opening the VM settings, going to ports, USB, and adding a filter for the USB device.
Then I started the VM.
The device didn’t show.
i went to devices, USB, and connected that device and got a message “Failed to attach the device to the virtual machine”.
Any tips on what I might be missing here?

As Francis already said and I also said in another topic with a similar problem a few hours ago. This is a Virtualbox issue, not a Home Assistant issue. It’d be better to ask this in a virtualbox forum.

Hi @Meph88,

Dunno why they bother give replies to you like they do.

I assume you’re using VB 6.x
What are you running inside the VM? I will assume Ubuntu:

  • Start the VM
  • Plugin the USB, make sure it is recognized by Windows
  • In VB Manager, open Settings to the VM
  • Use the + to add the CC2531
  • Unplug the CC2531
  • Reboot the entire VM
  • Insert the CC2531

Now, in Ubuntu, do cd /dev/serial/by-id/ and do a ls you should hopefully now see the TI

VB Manager:

List the serial interface in Ubuntu:

7 Likes

I appreciate it when someone is as helpful as you are even though I’m not the OP and the thread is old. This is the closest answer I’ve found to my dilemma. Believe it or not, I figured out the steps you gave by piecing together replies in several different things I found online. Wish I had seen yours first. I can get my USB device to work in my Virtual Box (6.1) and make it available to my Home Assistant instance running on it.
My current problem is that when I restart my Windows machine (in anticipation to what it will do during a power loss) the Virtual machine does not see the USB device. If I look for it in the USB icon beneath the running script window, it’s not there even. I tried disabling it in Windows to prevent Windows from “grabbing” it with no effect. The only way I can get it to the VB is to pull it out and replace it - then it shows in the USB icon and I can enable it. Is there an easy way to get the Virtual machine to see it on a Windows reboot?

Hi @DaveW1, thank you for your kind words. Unfortunately I can not assist in your question as I just tried VM for my own testing “just had to try it”. I ended up with what suits my needs the best - have a dedicate machine for my HA as I build a system to run continuously to control my household. Here there will be a huge amount of opinions, but logically - for me - less things in between the running hardware and Home Assistant, the better it is. Running Home Assistant as bare bone as possible seems logical the safest route. That is how I achieved my stability. An Intel NUC running Home Assistant OS for production environment. No Windows, no VM’s, no Ubuntu… Just… Home Assistant.

Hi @DaveW1, here is what I did to solve your exact problem. Not a walk in the park, but it seems to do the job (more on that at the end of the post):

  • Use a USB extension cable to connect the dongle to the host.
  • Hack the USB extension cable to have the USB power line (positive, not gnd) going through a normal-closed relay.
  • Set up a command_line sensor in HA to detect when the Zigbee dongle has disappeared. I gave it a 30-second scan_interval and this command:
    'if [ -e /dev/serial/by-id ]; then [[ $(ls /dev/serial/by-id/* | grep Sonoff_Zigbee) != "" ]] && echo "true" || echo "false"; else echo "false"; fi'
  • Set up an automation in HA to post a message to the MQTT broker when the above sensor indicates the dongle is no longer connected. Something like “reconnect_zigbee”.
  • Use a Raspberry Pi on which I wrote an MQTT listener. Whenever the listener gets the above message, it opens the relay on the USB extension cable for 2 seconds and then closes it back. This is enough to cause a physical disconnect/reconnect of the dongle, so Virtualbox and HA detect it again.

All worked fine until I moved my VM to a Windows 11 machine. Now even a physical reconnect won’t fix it, I need to reboot the VM entirely. I am still looking for a fix to this.

Hope this helps you and anyone else who may be frustrated with this Virtualbox bug.

Thanks for the input - I appreciate it.

TBH I forgot about this thread entirely. I had a similar setup with a USB extension (6") using a Sonoff and calling an off/delay/on in an automation every time Home Assistant starts. Then a restart of Home Assistant to find it there. NOT very efficient. It worked until it didn’t - probably my crappy wiring job on the tiny wires and me moving it around without a case.

Funny thing is, it suddenly started working on its own. Maybe I tinkered with the USB in the Virtual Box - like I know I already did before reaching out for help. In any case it sees the USB when VB (or Windows/ the computer) restarts. I remember also messing around in Device Manager in Windows (10) but I don’t remember how or if it made a difference. Only mentioning it because I swear I remember the stick showing up as 2 COM ports and it doesn’t anymore. I think it’s under USB composite now. Possibly just a 3rd (20th) time is the charm situation. In any case, if it isn’t broke (yet) I’m not gonna fix it. One other thing (that shouldn’t matter) - I have it plugged into a USB3 on the front panel and it used to be in the back (USB2 maybe?). I should start writing things down and following up on my posts - sorry

1 Like

I have Blue Iris running on my machine as well - that’s why I am using Windows/Virtual Machine. I was using a PI but the restart time was abysmal and there’s the memory card deterioration factor as well

Thanks for your reply.
I am running HA in a VM on a Windows laptop, so I don’t need a UPS. :slightly_smiling_face:

After hours of trying to get my son off zigbee stick working, refreshing the firmware, changing settings, restarting repeatedly, eventually my googling led me to your answer. Thank you very much indeed, adding that filter fixed it. I’d not seen this mentioned anywhere else and, like the OP, I’m running HA on an old Mac mini via virtual box.

I really appreciate your help. Thanks again.

The answer in this post Unable to find devices on HA running on virtualbox - #9 by Gibber solved the issue for me!