Limiting Bluetooth Proxy to scan for specific device?

New to Bluetooth in home assistant so this may be a very dumb question.
I have setup an m5stack-atom-lite to scan for my leLink Bluetooth OBD thingy in hopes of pulling car data into HA.

The Bluetooth OBD has been working fine for years with an iPhone app and now intermittently with HA.

The logs seem to show it detecting tons of devices i don’t care about and regularly giving this warning.

[W][esp32_ble_tracker:114]: Too many BLE events to process. Some devices may not show up.

Is there some way to limit it only look for the specific device ID I care about?

Maybe I am missing something basic and asking the wrong question.

Thanks.

You haven’t showed your yaml, so hard to say. But are you filtering for the Mac of the device?

Thanks Nick.
I have not figured out how to do that (filter).
This is the config pretty much straight from configuring the proxy.
Cannot understand the docs to understand what I need to do differently.

substitutions:
  name: m5stack-atom-lite-a11728
  friendly_name: Bluetooth Proxy a11728
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/m5stack/m5stack-atom-lite.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: REMOVED

esp32_ble_tracker:
  on_ble_advertise:
    - then:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true

logger:
  level: VERY_VERBOSE

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password


Well for a start your ble settings are wrong. You have it set for a wired Ethernet device. See the docs.

That docs also set out how to filter.

Any specific docs or examples you recommend?

I have been through these but cannot make much sense of it. For example I don’t see where I’ve configured it for wired connection or anything about filtering by MAC.

Have a look at the Bermuda integration from HACS:

Their Wiki is relatively accessible (and sometimes quite amusing), and, yes, you can scan for specific devices.

“For WiFi-based proxies, changing the interval or window from their default values may result in an unstable WiFi connection. Using the default values for interval and window will usually resolve any instability.”

Remove the interval and window lines in your YAML so that you instead use the default values. And yes, that part of the docs is unnecessarily confusing. :slight_smile

I would start with that and see if your problems go away, as I have a ton of WiFi based proxies with a LOT of BT traffic in my area and haven’t ever seen the error you’re getting.

On my M5Stack-atom-lites I have this:

substitutions:
  name: m5stack-atom-lite-9f8c10-2
  friendly_name: Bluetooth Proxy bedroom
  
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/m5stack/m5stack-atom-lite.yaml@main

esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}

api:
  encryption:
    key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

bluetooth_proxy:
  active: true

esp32_ble_tracker:
  scan_parameters:
    active: True
    interval: 320ms
    window:   300ms

The settings are not quite default, but recommended for Bermuda.

What exactly are you trying to do? There is no point in enabling Bluetooth proxy unless you want to pass a BLE device through to home assistant when it has an integration already in home assistant. For example I have a bthome device BTHome - Home Assistant which I could use with HA with a Bluetooth adapter that is directly attached to my HA machine, or by proxying it through esphome’s Bluetooth proxy.

If you are wanting to get data from another BLE device, then you have to be able to figure out the manufacturer sends over BLE. I’ll find an example and post it.

Here is an example Cheap 15$ Air quality monitor: ESP32, Bluetooth & Home assistant ·

Thanks folks. I reset the config to the default and added the interval and window lines @jackjourneyman recommended.

Not currently seeing the “too many BLE events to process error” but I am getting a steady stream of activity in the logs and these warnings:

[10:04:22][W][component:237]: Component esp32_ble_tracker took a long time for an operation (104 ms).
[10:04:22][W][component:238]: Components should block for at most 30 ms.

I am 1/2 way there but still getting partial and intermittent data which I assume (possibly wrongly) is due to the amount of bluetooth traffic being processed, vast majority of which I don’t care about.

Re @nickrout

What exactly are you trying to do? There is no point in enabling Bluetooth proxy unless you want to pass a BLE device through to home assistant when it has an integration already in home assistant .

Exactly this. I am using nissan-leaf-obd-ble integration, which admittedly is very new.

It is receiving data but intermittently and inconsistently. Some data will populate but not others, then entities go “unknown” even when car is on and in range of the proxy. Few pics below.

When I look at the ESPHome live logs, it is a steady stream of traffic so my best guess was it cannot keep up with the device I care about. I assumed there would be a simple way to specify which device(s) to pay attention to and which others to ignore.

How close is your BT Proxy device to your car? In my experience, the range is pretty poor, especially when an active connection is required (which I assume this uses).

Probably 8-10’ from house to driveway. I also seemed to have the problem with proxy powered in the car in the drive.

Will continue experimenting with placement to see where is most reliable.

In general though, am I just off in my thinking that if I only care about device X, I would config the proxy somehow to just scan for that device and ignore all else?

It seems to be doing a whole lotta work for nothing in the logs.

I’m not aware of any way to limit what is proxied; kind of the whole point of the proxy is to blindly pass everything it sees on to HA and let it sort it out.

Is that clear line of sight or is there a wall, etc. in the way? In my experience, that might work if it’s clear LOS but otherwise you’ll likely have issues.

Thanks much and good to know re the filters or lack thereof.

Definitely a wall between inside sensor and outside driveway, but I am having some luck with placement along a basement window. Will continue to experiment and learn as we go here.

Getting there.

I wasn’t aware of that custom integration, so thanks for clarifying. Poorly documented as it is!

Just reviewed this ESP32 Bluetooth Low Energy Device — ESPHome and noted that you have very verbose logging set. Try removing that and see what happens.

And it seems to me that OBD is going to create a lot of data compared to the average BLE device data. Also the 10m theoretical range of BLE is often illusory. Have you thought of using a wifi OBD dongle?

The integration is very new and I am glad it exists!

I think I’m getting this working more or less now mostly by adjusting location of my proxy. Have been very happy with the OBD as it has been very reliable with Leaf Spy Pro and draws no power when car is off.

Getting a few basics like odometer and SOC pulled in from my very basic, no connectivity car, is most of what I need.

1 Like

Also. Good shout. Set back to debug.

1 Like