BLE custom component

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?

That’s it!

That’s correct. I’m hoping this is something that will update over time so it can be associated with a Person on HA

I also use them to monitor miflora plant sensors

1 Like

Mhh, that is a bummer as I use persons. I found this but did not check in detail.

I had looked at that but I didn’t get around to testing it. It is a bit annoying but I don’t see much of a difference in using it a binary sensor. I just group all binary sensors under a group for me and that will trigger all automations

This problem resolved for me.
My fork for bluetooth le tracker. Works with Rp4

Before I have this error

custom_components.ble_track.device_tracker: BLEError during Bluetooth LE scan: Unexpected error when scanning: Set scan parameters failed: I/O error
  - platform: ble_track
    track_new_devices: true
    device_id: hci0
    scan_duration: 20
    interval_seconds: 12

PS. Many thanks rodrig.toni for idea

1 Like

Hi all,

i try to find a solution to follow up Gigaset Keeper beacon. i try to use this script device_tracker.py in custom_components\ble_track and i put

  - platform: ble_track
    track_new_devices: true
    interval_seconds: 15

in configuration.yaml
HA reports me that “Platform error device_tracker.ble_track - Integration ‘ble_track’ not found”
Could you provide me tip to solve this issue ?
Thanks
Lolo

that didn’t solve my problem still have the same error as you

Logger: custom_components.ble_track.device_tracker
Source: custom_components/ble_track/device_tracker.py:84
Integration: ble_track (documentation)
First occurred: 4:40:24 PM (8 occurrences)
Last logged: 4:41:59 PM

BLEError during Bluetooth LE scan: Unexpected error when scanning: Set scan parameters failed: I/O error

and also have :
Logger: pygatt.backends.gatttool.gatttool
Source: /usr/local/lib/python3.8/site-packages/pygatt/backends/gatttool/gatttool.py:352
First occurred: 4:40:24 PM (8 occurrences)
Last logged: 4:41:59 PM

those two error are together, after a few days it will be up to 39932 occurrences

But my bluetooth device are reporting value, but it’s other stuff that is crashing, like zwave dongle…

I have this problem now no matter which component I use. I’m using hassos and the only way to make the issue go away is to perform a host reboot.

Unfortunately the problem always reappears a few days later.

Update: rebooting has started to make no difference in the number of errors I was seeing. I decided to give @davefrooney’s ble_track component another try and the errors have stopped!