BLE custom component

Hi, I’m getting a warning: No Bluetooth LE devices to track! followed by the error: Error setting up platform bluetooth_le_tracker using the custom BLE component.

I’ve manually created a known_devices.yaml file and added my BLE device.

The USB adapter I’m using works perfectly using hcitool lescan hci2 (and I set the hci_device option in configuration.yaml).

Any suggestions? Thanks :slight_smile:

My guess is that track_new_devices is set to no (or not set) and there are no BLE Devices in the known_devices.yaml file

this is more stable than stock one, for me.
Anyway I also have frequantly crashes. I’m running hass 0.87.0 on a rpi3b+ with hassio 2.8
I guess the problem is related to my xiaomi hygro-thermo BT sensor
polling + device tracking = instability :frowning:

I also wanted to confirm that the custom component is working for me while the stock one not. I have installed home assistant on a raspberry pi 3b with dietpi in a venv environment. I am using the ble tracker to check my xiaomi amazfit bip watch to check my presence. I have a lot of errors in the log and yet sometimes home assistant sees me as away for few minutes when I am at home. But is a really giant improvement than the stock one. I also confirm that adding " blacklist_names seems to help.

Probably to have fewer errors in being recognised as at home or not I should play with how often the scanning is happening and when I can still be considered home. Has anyone found a nice combination for how to set these variables?

@kevjs1982 It looks like the BLE component has been updated in 92.0. Have they adopted a similar approach to you now?

After 0.92 update I am getting this error:
Integration ble_tracker not found when trying to verify its device_tracker platform.

I was having issues with the new 94 update so I edited the official component and created my own custome component.

How this helps people who are having issues

Please not that the manifest and init files are required since 92

1 Like

Hi.
can you write the example of configutarion in configuration.yaml?
i put this:

  - platform: ble_track
    interval_seconds: 10
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False

it´s correct?
Thanks

Sure, this is all I have

  - platform: ble_track
    track_new_devices: false
    interval_seconds: 15

Not sure, I really need to upgrade my Home Assistant version and test it out, still on 0.88.1, IIRC 0.89 broke the TP Link Switches I used and that dampened my enthusiasm for updating.

Unfortunately mines not as stable as I’d like. Seems to fall over about once a week, I wish esphome would treat BLE as a device tracker, and have some form of blacklist.

@davefrooney I tried using your custom component. Here is my hassio log:
No Bluetooth LE devices to track!

10:56 PM custom_components/ble_track/device_tracker.py (WARNING)

You are using a custom integration for ble_track which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

10:56 PM loader.py (WARNING)

known_devices.yaml is not being created but I can see BLE devices with hcitool:
paul@hassio:~$ hcitool lescan
LE Scan …
6A:BF:83:1A:A2:35 (unknown)
6A:BF:83:1A:A2:35 (unknown)
69:04:D2:FB:DF:5E (unknown)
69:04:D2:FB:DF:5E (unknown)
42:CE:C8:58:03:CB (unknown)
42:CE:C8:58:03:CB (unknown)

Do you have a known_devices.yaml created? I manually update mine with the devices I want to track

Can’t get it to work. Copied your folder into mine but get this error when validation config:

Platform error device_tracker.ble_track - Integration ‘ble_track’ not found.

Edit: I was missig pygatt on my system. After installing it, it gave no error. But no devices found. Even my self edited device in known_devices.yaml isn’t responding.

What does your known devices look like? Here is a sample of mine

dave_ble:
  hide_if_away: true
  icon:
  mac: BLE_EB:DD:EE:CC:AA:FF
  name: Dave BLE
  picture:
  track: true

It should then appear in HA

image

After some trying and some HA restarts it started to work.

@davefrooney Are you running this on a NUC? Your components works but has a similar outcome vs the standard one, at least on my system; After a few hours it stops detecting anything.

Im running on a Pi 3B+. I have noticed it is less stable recently. I’ve started using ESPHome on an ESP32. This has been very reliable over the last couple of months.
I have grouped the built in BLE and ESPHome into a single entity for each persona

Ah, never looked into this. BLE tracking worked really nice with my Google home but when that stopped working I have tried ‘monitor’ but never got that working properly and several customer versions of BLE_tracking components. I just use it to track some BLE_trackers on a keychain as an extra as they have Iphone which are not tracked reliable.

How does the ESPhome work for you? Is it easy to set up? Just want it for BLE_tracking

I never tried ‘monitor’ I had looked at it but it seemed to need another Pi to run. I have the same use case as you. I have a BLE tag on my keys that I use to detect when I come and go. I then trigger multiple automations based on this.

So far ESPhome has been the most reliable system I have used. I have 2 ESP32’s around my place that detect the tags in seconds. Setup is very straight forward. You connect the device to your HA device with USB and run a wizard. After that you can do updated OTA. You would add similar code as below to track each BLE device. It’s a really nice and stable solution

# Example configuration entry
esp32_ble_tracker:

binary_sensor:
  - platform: ble_presence
    mac_address: AC:37:43:77:5F:4C
    name: "ESP32 BLE Tracker Google Home Mini"

Just ordered one. Should be in tomorrow.

I guess follow instructions mentioned here?

Do I understand correctly that these create a binary sensor for presence and not a device_tracker?