Failed to start Bluetooth: adapter 'hci0' not found

Switch to VMware - did it 3 years ago - works flawlessly ever since.

I used the btrestart.sh script from here and Bluetooth started working.

bton:

#!/bin/bash
sudo rfkill unblock bluetooth
sudo systemctl start bluetooth
sleep 1
bluetoothctl power on
exit 0

btoff:

#!/bin/bash
bluetoothctl power off
sudo systemctl stop bluetooth
sudo rfkill block bluetooth
exit 0

btrestart:

#!/bin/bash
bluetoothctl power off
sudo systemctl stop bluetooth
sudo rfkill block bluetooth
sudo rfkill unblock bluetooth
sudo systemctl start bluetooth
sleep 1
bluetoothctl power on
exit 0

Thanks @FutureTense for your suggestion,

unfortunately I am running Homeassistant core and cant utilise systemctl, rfkill etc. via any ssh-plugin. I already found several posts talking about it without any helpful solution.

Can you elaborate on how to got it to work?

I have the same issue currently with a built-in Intel Bluetooth chip on a mini PC running windows as the host, virtual box for the VM. I have had the same issue with a Zigbee dongle connected via USB (even with an extension cable). Prior to the most recent windows update, I could disable and re-enable any USB device in windows and it would work again in the VM (HA), but after the most recent window... come to think of it HA update as well, even if I disable and re-enable the USB device in windows, it doesn't work automatically in home assistant again. I have to go into home assistant and remove the previous entry for the device and then re-add it under Settings > Devices and Services.

Prior to these updates, I was able to create a CMD or power shel script that I could trigger with task scheduler 30 seconds after PC boot up to automatically disable and re-enable the device so it would start working in HA again, but that no longer works.

Well... I think I found the problem for one of the issues. It seems in their infinite wisdom, Microsoft decided to disable running scripts by default in a recent update. to fix this, you can open power shell as admin and run the following command
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
This should enable scripts to run under the current user profile. I'm not sure if it will re-enable running scripts via task scheduler. I expect it will as long as the task is created by the same user.

Still working on trying to disable / re-enable on reboot to see if I can get home assistant to automatically recognize the device and let it work normally again.

After moving to Linux, I am back using VirtualBox and the USB passthrough is still a bit of a headache.

In my case I got around it by taking the BT-USB dongle completely out of the equation.
I am using one of my Shelly relais as a BT proxy and therefore get the BT data through the Shelly integration via Wifi.

No more USB required.

1 Like

where there's a will, and a budget, there's a way.

For anybody running Home Assistant in Virtual Box in a Windows host machine, I have come up with a solution that works for my given hardware (integrated Bluetooth adapter on mini PC (technically connects via USB it's just not removable))

I found if I disabled and re-enabled the Bluetooth device after Home Assistant starts, it will hand off to home assistant, but home assistant will still pretend it can't see the device. If I then disable, and re-enable the virtualbox USB driver in windows device manager, Home Assistant will magically see the device and start using it normally again.

With the help of Google, I made the following .bat script you can copy and paste it into notepad then save as a .bat file. you will need to change the parenthesized bits to match your uniqe device instance paths (these can be found in device manager > device right click > properties > details tab > property drop down, choose "device instance path")

you might have to play around a little bit to figure out which component needs to be disabled and re-enabled, but at least I can start using USB devices with home assistant again

@echo off
:: Disable Intel Bluetooth
pnputil /disable-device "USB\VID_8087&PID_0AAA\5&1BFF3BC1&0&10"
:: Wait 5 seconds
timeout /t 5
:: Re-enable Intel Bluetooth
pnputil /enable-device "USB\VID_8087&PID_0AAA\5&1BFF3BC1&0&10"
:: Wait 5 seconds
timeout /t 5
:: Disable Virtualbox USB
pnputil /disable-device "USB\VID_80EE&PID_CAFE\5&1BFF3BC1&0&10"
:: Wait 5 seconds
timeout /t 5
::Re-enable Virtualbox USB
pnputil /enable-device "USB\VID_80EE&PID_CAFE\5&1BFF3BC1&0&10"
pause

You can also automate this to run via task scheduler. I have it set to run 1 minute after windows boots up so home assistant has time to launch in the VM before the devices are disabled and re-enabled. It's important to run task scheduler as admin, and set the user to system (or an admin, but just an admin account didn't work for me so I set it to run as system)

there's also a chance you don't need the 2nd half of the script that disabled and re-enables the virtualbox USB driver. For me it is critical, but you can tweak the script as you need.

Bluetooth proxy will happily run on a $3 ESP32 board - you don't necessarily need a Shelly.
If you're already running ESPHome on ESP32, then it's free & all you have to do is add a couple of lines in the config.

Good point ShadowFist - in my case the Shellys were already installed for different purposes.
One of them has to work 2 jobs now :slight_smile: :rofl:!

Back to work Shelly! Cracks whip