Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth LE tracker not starting and not discovering new devices #89293

Open
ProtoxiDe22 opened this issue Mar 7, 2023 · 17 comments
Open

Bluetooth LE tracker not starting and not discovering new devices #89293

ProtoxiDe22 opened this issue Mar 7, 2023 · 17 comments

Comments

@ProtoxiDe22
Copy link
Contributor

The problem

Since quite some time, the bluetooth le tracking integration hasn't been working properly, i've tested this on my already working device and on a brand new homeassistant install (old installation is a rpi4, new installation is HAOS install on x86 nuc, so 2 very different platform with same result).

If no known_devices.yaml file is present, or no devices are set to tracked in the file, the integration just outright refuses to start, as per the logs i have put below.

If a tracked BLE device is present in the known_devices.yaml the integration seem to start properly, with no error at all in console, but no new devices are discorvered and written in the known_devices.yaml file,

If device is tracked by putting all the correct data in the known_devices.yaml file manually, the tracking seems to work properly

What version of Home Assistant Core has the issue?

2023.3.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

bluetooth_le_tracker

Link to integration documentation on our website

https://www.home-assistant.io/integrations/bluetooth_le_tracker/

Diagnostics information

No response

Example YAML snippet

device_tracker:
  - platform: bluetooth_le_tracker

Anything in the logs that might be useful for us?

2023-03-07 16:54:49.210 WARNING (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] No Bluetooth LE devices to track!
2023-03-07 16:54:49.212 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy bluetooth_le_tracker

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Mar 7, 2023

@SpartanTech
Copy link

Also an issue for me

@SpartanTech
Copy link

Any update?

@PW999
Copy link

PW999 commented Aug 21, 2023

I'm currently running HA 2023.8.3 on HAOS 10.5.

It's been broken for a long time. When known_devices.yaml is empty, I get the same log messages as @ProtoxiDe22 .
When I restore my old known devices file, I don't get any message and I can see the devices in Home Assistant, but none of them are tracked.

E.g. configuration.yaml

  - platform: bluetooth_le_tracker
    interval_seconds: 30
    consider_home: 240
    new_device_defaults:
      track_new_devices: true

known_devices.yaml

...
tv_samsung_led50:
  icon: mdi:television
  mac: BLE_12:34:56:78:90:12
  name: '[TV]Samsung LED50'
  picture:
  track: true
...

Results in this entity
image

but it never gets home...

With the above config, when I run bluetoothctl from the console, I see a lot of activity without me actually starting a scan, which is probably the result of HA doing bluetooth scans.
With passive scanning enabled in the bluetooth integration, I still see some bluetooth devices in bluetoothctl with starting a scan in it, so I guess that's bluetooth_le_tracker doing it's work ?

So I enabled debug logging for the bluetooth_le_tracker and it does add the devices from known_devices.yaml to the devices that need tracking, but that's the only output it ever outputs.

2023-08-21 17:48:36.784 DEBUG (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Adding BLE_XXX to BLE tracker
2023-08-21 17:48:36.784 DEBUG (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Adding BLE_XXX to BLE tracker
2023-08-21 17:48:36.784 DEBUG (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Adding BLE_XXX to BLE tracker
2023-08-21 17:48:36.784 DEBUG (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Adding BLE_XXX to BLE tracker
2023-08-21 17:48:36.784 DEBUG (MainThread) [homeassistant.components.bluetooth_le_tracker.device_tracker] Adding BLE_XXX to BLE tracker

Maybe I need to add some more debug logging to see what it's actually doing.

//update: So far I've got it working with the bluetooth integration set to passive scanning and manually calling scan le from bluetoothctrl.
I also I set the scanning mode to PASSIVE in the callback registration.

    cancels = [
        bluetooth.async_register_callback(
            hass,
            _async_update_ble,
            BluetoothCallbackMatcher(
                connectable=False
            ),  # We will take data from any source
            bluetooth.BluetoothScanningMode.PASSIVE,
        ),
        async_track_time_interval(hass, _async_refresh_ble, interval),
    ]

It seems to me there's something wrong with the active scanning of the bluetooth integration.
With passive scanning and running scan le I see this as output
image

With active scanning this is the output
image
It only discovers 3 of my Hue lamps and I see them pop up in the logs of the bluetooth_le_track

2023-08-21 19:38:53.030 WARNING (MainThread) [custom_components.custom_bluetooth_le_tracker.device_tracker] See device: X - Hue Lamp
2023-08-21 19:38:53.032 WARNING (MainThread) [custom_components.custom_bluetooth_le_tracker.device_tracker] See device: Y - Hue Lamp
2023-08-21 19:38:53.033 WARNING (MainThread) [custom_components.custom_bluetooth_le_tracker.device_tracker] See device: Z - Hue Lamp

Very strange ...

//update2: in the screenshot you can also see a DEL event for my TV ... I didn't turn it off, it's strange that it doesn't see it anymore as soon as I enable active scanning (and stop scanning from bluetoothctrl using scan off).

@kittenmcnuggets
Copy link

Following

@PW999
Copy link

PW999 commented Aug 26, 2023

I'm not really sure if something has already been fixed, but I've been running the dev branch locally on my desktop and the bluetooth_le tracker works fine for LE devices:

image

Non-LE devices might briefly show home when these devices were previously paired, after that they just go away forever.

I think in the past the bluetooth_le tracker also tracked non-LE devices and we were used to this working.

@kittenmcnuggets
Copy link

Mine seemed to not start or generate a known devices file. Then after I manually created one with a known working ble Mac, it would add it as an entity, but it did nothing and I have been unable to delete the entity even after removing the kd.yaml.

@bcutter
Copy link

bcutter commented Nov 4, 2023

Same for me. Started when upgrading from HA Core 2023.3.6 to 2023.4.6. Worked perfectly before that update!

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@bcutter
Copy link

bcutter commented Feb 2, 2024

Is this maybe just a logger warning if the known_devices.yaml does not contain at least one device to track?

I think I might have changed that back then... but just an assumption.

@KlausHans
Copy link

Still an issue 2024.4.1. I've set up Bluetooth LE Tracker according to the documentation https://www.home-assistant.io/integrations/bluetooth_le_tracker/
There is no known_devices.yaml generated.

Logger: homeassistant.components.device_tracker
Quelle: components/device_tracker/legacy.py:363
Integration: Geräte-Tracker (Dokumentation, Probleme)
Erstmals aufgetreten: 13:47:27 (1 Vorkommnisse)
Zuletzt protokolliert: 13:47:27

Error setting up platform legacy bluetooth_le_tracker

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@mark-szabo
Copy link

still persisting issue

@npa-homeassistant
Copy link

I have the same problem. BLE tracking was working fine for ages, but has now completely stopped. I have removed and re-added the Bluetooth integration to no avail. As above, I can see devices in bluetoothctl, but none are making it to HA. It's a real disappointment as I had quite a few automations triggering on BLE trackers.

@Condorello
Copy link

My Odroid N2 stop seen the iBeacon tags if i update HassOS to a version over 12.2. Probably there's something with the bt kernel driver in the newer version....

@poseidogithub
Copy link

Hello my experience is the following, bare minimun esp32 ESPHOME code (wifi + webserver) works perfect. as sonn as I add the bluetooth_le_tracker all starts working funny, I open the device on the brwoser, it reboots...

So only solution for me is to go back to 2023.11 ESPHOME version and recompile the code there, it works. (only issue is that I get a waringn that I believe it has to do with this new "feature" where ble_le_tracking does not want to coexist with wifi.

[13:46:18][W][component:214]: Component esp32_ble_tracker took a long time for an operation (0.09 s).
[13:46:18][W][component:215]: Components should block for at most 20-30ms.

@doxsch
Copy link

doxsch commented Oct 27, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests