ESPHome BLE Gateway and other BLE components

I’m trying to get this working on a Switchbot Plug Mini (ESP32-C3) and when I add the ble_gateway config and install, I get errors saying: “undefined reference to `vtable for esphome::ble_gateway::BLEGateway’”

Is there something obvious that I’m doing wrong?

HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40407.240606 (4.4.7) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Reading CMake configuration...
No dependencies
Linking .pioenvs/sbotplug-ab1fdc/firmware.elf
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: .pioenvs/sbotplug-ab1fdc/src/main.o: in function `setup()':
/data/build/sbotplug-ab1fdc/src/main.cpp:287: undefined reference to `vtable for esphome::ble_gateway::BLEGateway'
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: /data/build/sbotplug-ab1fdc/src/main.cpp:287: undefined reference to `vtable for esphome::ble_gateway::BLEGateway'
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: /data/build/sbotplug-ab1fdc/src/main.cpp:288: undefined reference to `vtable for esphome::ble_gateway::BLEGateway'
/data/cache/platformio/packages/toolchain-riscv32-esp/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld: /data/build/sbotplug-ab1fdc/src/main.cpp:288: undefined reference to `vtable for esphome::ble_gateway::BLEGateway'
collect2: error: ld returned 1 exit status
*** [.pioenvs/sbotplug-ab1fdc/firmware.elf] Error 1
========================= [FAILED] Took 14.78 seconds =========================

Hello,

Should works, similar problem can happened with ESP-IDF if you add new component and not cleanup build files. In ESPHome dashboard select … for this device choose Clean Build Files and try to install again.

But be very careful with ESP32-C3 and Bluetooth, device can fail to boot. Do you use Bluetooth in this device before? Please read my post here

Hi everyone, first of all, let me thank the developer who created this great component.

Currently I have created one BLE gateway and using it well.
But I want to add a new Passive BLE device LYWSD03MMC that is far away from the gateway (i.e. on the opposite side of the house).

My question here is, is it okay to add another ESP32 with BLE gateway installed, so that there are a total of 2 ESP32 with BLE gateways installed in the house?

Of course I know I can just do it, but I’m writing this to reduce trial and error.

Yes yo can!
If you want more info watch this:

and read this:

Just saw this, this is exactly what I need for a couple projects. Thanks OP!

Thank you so much. I’ll give it a try soon.

Sure, this is exactly how this designed, to extend BLE range you can install as many gateway/proxy as you need.

Instead of adding a ble gateway in a remote location, would it be enough to just put an esp32 board there with the bluetooth_proxy: option set?

Yes, but keep in mind that BLE Gateway and BLE Proxy (bluetooth_proxy) it’s a different things. BLE Gateway can only receive BLE data and send it to Passive BLE Monitor integration for decode. BLE Proxy it’s a part of Home Assistant and use build-in BLE devices plugins for decode data and can also send data back to BLE devices (if you specify active: true in its configuration).

So if you already familiar with BLE Gateway and has it configured, you can just add extra ESP32 with same BLE Gateway configuration as one which you already have.

Ah, that makes sense now, thanks for the detailed explanation.

Hello,

Does myhomeiot_ble_client working for anybody with last ESPHome? It seems, based on examples from repo, it isn’t.

Who interested, can test ESPHome implementation of Apple AirPods/Beats status reported by BLE advertisement. It’s should work with any models but if you find that your model/color doesn’t reported correctly (shows numbers instead text description) please post it here and I will update. For headset like AirPods Max status reported as for the right bud.

Enjoy!

I have a ChefIQ thermometer that works in Home Assistant with Passive BLE Monitor and a USB bluetooth adapter plugged into Home Assistant. This setup works great inside the house, but I want to extend bluetooth so I can use the thermometers outside. I have an ESP32 that I successfully flashed with ESPHome Bluetooth Proxy and added BLE Gateway and it shows my thermometers sending packets. Home Assistant developer tools shows events firing on esphome.on_ble_advertise, but I’m failing to understand what needs to be configured in Home Assistant so Passive BLE Monitor picks up what the gateway is sending.

You need to configure automation which receives this events and send it to Passive BLE Monitor (using service ble_monitor.parse_data), example you can find here.

PS: Passive BLE Monitor doesn’t required to have build in ESPHome Bluetooth Proxy, Bluetooth Proxy sends data to Home Assistant Bluetooth stack so you can see supported devices in Home Assistant without Passive BLE Monitor.

automation:
  - alias: ESPHome BLE Advertise
    mode: queued
    trigger:
      - platform: event
        event_type: esphome.on_ble_advertise
    action:
      - service: ble_monitor.parse_data
        data:
          packet: "{{ trigger.event.data.packet }}"
          gateway_id: "{{ trigger.event.data.gateway_id if trigger.event.data.gateway_id is defined else 'unknown' }}"

Thank you! The automation was the missing piece. And thank you for the tip about not needing the proxy, everything is working now!

How do you configure the db so you dont end up with a ton of entries from this automation?

As usual in Home Assistant:

recorder:
  ...
  exclude:
    entity_globs:
      ...
      - automation.esphome_ble_advertise