Bluetooth Dongle (added) how to scan for devices?

Good evening. I have installed a long-range USB Bluetooth Dongle (one officially supported according to the repo). I have installed the device into my host and passed thru the USB port to the VM. From the command line I can see that my device is hci0. I can go to bluetoothctl and see a bunch of devices being found.

I have added the Bluetooth Integration into Home Assistant and I can see the hci0 tag there but from there I’m lost and cannot find where to see or add found bluetooth devices to known_devices or even make them appear in the devices/entities list.

Any ideas? Did I miss something that my three hours of Google didn’t find?

4 Likes

I got about as far as you on a RPi4 so suspect from the 2022.08 release party video there are extra controls about to appear from the dev channel releases.

I’m only expecting BT Low Energy broadcasts to appear, and did feel a little foolish waving a BTLE Braun toothbrush at HASS as a test!

2 Likes

f you’ve been following the HA documentation here’s a note: it may require several reboots to be recognized

2 Likes

@pepe59 How will they appear? Just as another discover device? When I run the bluetoothctl command I can find 20-30 bluetooth devices using the command line, but not sure where they will appear in HA.

2 Likes

If I understood it correctly, the devices are discovered automatically and according to the documentation it is possible to find them:

The Bluetooth integration will detect nearby Bluetooth devices. Discovered devices will show up in the discovered section on the integrations page in the configuration panel.

1 Like

I have the same question.
bluetoothctl list returns:

➜  ~ bluetoothctl list
Controller 04:EA:56:63:BB:94 homeassistant [default]

and bluetoothctl devices returns:

➜  ~ bluetoothctl devices
Device E4:2B:55:A7:31:F5 E4-2B-55-A7-31-F5
Device 6F:C3:D4:AB:32:B2 6F-C3-D4-AB-32-B2

But, I see nothing in the integration.

1 Like

Same thing here. I’ve restarted a few times. Just a little lost on why my 30 devices or so that’s appearing via command line to not show up in integrations. Wonder if something is broken?

1 Like

I have seen this, https://github.com/home-assistant/core/issues/75049

Not sure if it’s applicable here yet or not. Seems a breaking change a few version ago was in fact Bluetooth Tracker?

1 Like

@pepe59 @stevemann I think I found out why. The documentation may be a little lacking. I was expecting to be able to connect Home Assistant to any of my Bluetooth devices. If it’s a speaker, perhaps stream music to that speaker.

Apparently that may not be the case. I purchased a Govee bluetooth temp/humidity sensor and as soon as I turned the device on HA found the device and allowed me to setup. It appears that only devices that have “HA” support will appear in the list. Hopefully in the future we can see other Bluetooth devices similar to how ours phones can connect to many different speakers, etc.

3 Likes

Bluetooth is a family of protocols, which can make it confusing.

Automation almost always uses Bluetooth Low Energy BTLE which is very different from Bluetooth Audio (which has several profiles itself just to be even more confusing…).

The recent development work makes connecting software to Bluetooth easier, however this is currently for Bluetooth Low Energy devices. BTLE often works by broadcasting one-to-many without pairing - like shouting “I’m a thermostat and it is 20C” reguarly.

That’s why the device appeared - it was broadcasting BTLE Advertisement messages, the new integration noticed, checked it was supported, and added it.

The distinction between BTLE and BT was discussed by Nick on the 2022.08 release party video.

The Media player could in theory send audio to a conventional Bluetooth speaker (AD2P), but this is more dependent on the host operating system, and separate from BTLE.

8 Likes

@FloatingBoater ank you for that! That actually makes sense and explains a lot. I’ve purchased 5 of the Govee sensors now. Is there a list somewhere of what BTLE devices are compatible with HA so far? Just looking for different ideas, it’s been a little while since I’ve added some fundamental useful automations to our mix.

Curious to know about door locks? I picked this door lock up which connects to the tuya app but wondered if it would connect directly to HA.

1 Like

The key point here is the fondations for much improved BTLE support were only partly released in 2022.08 - there is a lot of work to be done by core and integration developers before the specifics of GUI and device support are settled.

Where is there a list of supported devices? My guess is only in the GitHub repositories - Use the Source, Luke! :slight_smile:

The best source I know for BTLE lock information is (again!) the 2022.08 release party video as bdraco (J. Nick Koston) demos support for Yale Access / August locks.

As locks are an actuator (not just a sensor), BTLE does need to pair. The video demo shows this process live, although the difference between general BTLE and HomeKit-specific protocols is hazy to me.

Tuya did get a bit of HASS fanfare with some form of contribution last year, but I get the impression that the relationship stalled with code maintenance. ISTR the Tuya integration was cloud-based, implying Wi-Fi only, rather than BTLE - and the Tuya Integration docs do ominously say “except the lock and remote platform”. No Tuya BTLE locks, then?

As for the linked lock - don’t ask an engineer about locks and expect a good answer! :lock: :slight_smile:
For a start, micro-USB on the rain-soaked insecure outside, and back-up keys on the inside seems backwards. Might be OK on an internal door, but in the UK such a lock would invalidate my home insurance. :grimacing:

1 Like

TL;DR - Supported BTLE devices with new-stye integrations are in GitHub with an explanation and plans in HACS

Basically, bdraco (J. Nick Koston) has created a set of BTLE foundations making it easier to create integrations for individual BTLE devices/ brands/ types (e.g. Bleak client + DBUS integration + BLE parser, etc).

Originally, he had a Passive BLE Monitor integration which lists lots of devices and can be installed from HACS. The current work is to create individual integrations for different devices using the new BTLE foundations.

The BLE Monitor docs hopefully better explain the list of devices that WERE supported, and shows the work-in-progress creating new integrations.

UPDATE: HASS 2022.11 includes more BTLE integrations

This process was originally written using 2022.08, before developers had started to add support for BTLE devices. 2022.11 now includes the Oral-B integration so several toothbrush devices are now supported without any set-up needed - detection is automatic.

These instructions may still be useful for contributors to gather and debug BTLE manufacturer_data to allow new devices to be supported with additional work from developers. :hammer_and_wrench: :mage:t2:

Sniffing BTLE with the new foundations - ADVANCED

I tried installing the Passive BLE Monitor from HACS, but removed it and instead used bdraco’s live demo on the 2022.08 video as a guide to change the new Bluetooth component log level.

  • Add a line into configuration.yaml to get access to the Logger Service:
# Get access to logger.set_level service following bdraco live demo
# https://youtu.be/m9gKFH8WlzY?t=3297
logger:
  default: warn
  • Restart HASS
  • Set Bluetooth logging back to debug
    • Developer Tools → Services → logger → YAML (change from warn to debug)
service: logger.set_level
data:
  homeassistant.components.bluetooth: debug
  • Terminal tail -f /root/config/home-assistant/.log
  • Watch for devices in the log, noting addresses and data
  • Set the logging back to warn to not fill up the uSD
    • Developer Tools → Services → logger YAML (change from back to warn)
service: logger.set_level
data:
  homeassistant.components.bluetooth: warn

By doing this, I was able to see my Oral-B toothbrush, which for no useful purpose has an App and broadcasts via BTLE:

2022-08-13 16:30:02.239 DEBUG (MainThread) [homeassistant.components.bluetooth] Device detected: DE:AD:BE:EF:00:00 with advertisement_data: AdvertisementData(local_name='Oral-B Toothbrush', manufacturer_data={220: b'\x03V\x05\x02 \x00\x0e\x04\x01.\x04'}) matched domains: set()

Why? Do you really need to ask? :slight_smile: :hammer_and_wrench: :mage:t2:

Kudos to Nick / bdraco for this work (and performing a live demo so I could follow his lead).

UPDATE: Release 2022.11 now includes the Oral-B integration which installs automatically when a supported device is detected.

2 Likes

Ok, now what?

I found my BT Temperature and humidity sensor:

2022-08-24 23:32:38.935 DEBUG (MainThread) [homeassistant.components.bluetooth] Device detected: A4:C1:38:43:0E:8E with advertisement_data: AdvertisementData(local_name='Govee_H5074_0E8E', manufacturer_data={60552: b'\x00\xd0\t\x19\x14d\x02', 76: b'\x02\x15INTELLI_ROCKS_HWPu\xf2\xff\xc2'}, service_uuids=['0000ec88-0000-1000-8000-00805f9b34fb']) matched domains: set()

And a couple of other unidentified devices:

2022-08-24 23:31:16.903 DEBUG (MainThread) [homeassistant.components.bluetooth] Device detected: FA:F8:C4:0A:00:81 with advertisement_data: AdvertisementData(manufacturer_data={76: b'\x12\x02\x00\x02'}) matched domains: set()

2022-08-24 23:32:35.864 DEBUG (MainThread) [homeassistant.components.bluetooth] Device detected: 4D:1A:93:11:6C:65 with advertisement_data: AdvertisementData(manufacturer_data={76: b'\x02\x15\x1c\xa9.#\xf0\x87M\xf7\xb9\xa2\xfdKqjK\xf6\x02\xe9\x00\x00\x03'}) matched domains: set()

Is there a way to identify the two unidentified devices?

Use a search engine to look for bluetooth mac address lookup.

Just like Ethernet and WLAN, BTLE devices have a 48-bit MAC address starting with a 24-bit manufacturer code.

The known device is by Telink Semiconductor; the two others look to be unknown, possibly due to MAC address randomisation - devices send ever-changing “fake” MAC to avoid tracking.

The next steps towards a driver (if no one else has been there before you…) are all about logging lots of data under controlled conditions, writing custom code to look for patterns, and reverse engineering the undocumented data formats. You might get lucky poking about in GitHub and blogs for hints, or the format might be the same as several other devices.

Just remember to set debigging back to debug before your disk fills up. :slight_smile:

1 Like

I was able to get multiple BLE sensors integrated. I think, because this was my first time with BLE, that I was expecting a bunch of “around the house bluetooth” products to appear. Turns out that was not the case – but I’m just as satisfied with my new BLE temp sensors.

So how do I add a Bluetooth device that comes up as a controller or keyboard so I can use the input to trigger stuff?

You can’t use controllers nor sound devices - the HASS integration is for Bluetooth Low Energy (BTLE), not Bluetooth.

Automation almost always uses Bluetooth Low Energy BTLE which is very different from “standard” Bluetooth Audio (which has several profiles itself just to be even more confusing…).

2 Likes

What about the one from hacs that’s says Bluetooth? Not the one that says passive Bluetooth.