ESP32 Bluetooth node not working

After the latest update my esp32 Bluetooth node that has Xiaomi sensors is no longer working.
It shows up fine in the ESPhome dashboard, as online and with data in the logs, but in HA the sensors are unavailable.

I deleted the node in ESPhome and all the sensors in HA to make sure its completely gone. After the reboot nothing is being discovered. If i try to go to addons and add it by putting in the ip address, it says Device is already configured.

The only sensor that does still work is the binary sensor in the same node.

Im at a loss how to fix this issue, does anyone experience the same ?

esphome:
  name: bluetooth-tracker-upstairs
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

esp32_ble_tracker:
  scan_parameters:
    interval: 30ms
   
# Enable Home Assistant API
api:

ota:
  password: "87417fc83f6a1856e160476b48ae3ae2"

wifi:
  ssid: "xxxx"
  password: "xxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bluetooth-Tracker-Upstairs"
    password: "7IQumJKqyS58"

captive_portal:

sensor:
  - platform: atc_mithermometer
    mac_address: "A4:C1:38:78:E7:79"
    temperature:
      name: "Ac Boven Temperature"
    humidity:
      name: "Ac Boven Humidity"
    battery_level:
      name: "Ac Boven Battery Level"
    battery_voltage:
      name: "Ac Boven Voltage"

  - platform: atc_mithermometer
    mac_address: "A4:C1:38:C8:BA:A5"
    temperature:
      name: "Slaapkamer Temperature"
    humidity:
      name: "Slaapkamer Humidity"
    battery_level:
      name: "Slaapkamer Battery Level"
    battery_voltage:
      name: "Slaapkamer Battery Voltage"    
  
  - platform: atc_mithermometer
    mac_address: "A4:C1:38:BE:D4:85"
    temperature:
      name: "Kamer Kevin Temperature"
    humidity:
      name: "Kamer Kevin Humidity"
    battery_level:
      name: "Kamer Kevin Battery Level"
    battery_voltage:
      name: "Kamer Kevin Battery Voltage" 
  
  - platform: atc_mithermometer
    mac_address: "A4:C1:38:2A:6B:B5"
    temperature:
      name: "Douche Temperature"
    humidity:
      name: "Douche Humidity"
    battery_level:
      name: "Douche Battery Level"
    battery_voltage:
      name: "Douche Battery Voltage"  
   
binary_sensor:
  - platform: status
    name: "Bluetooth Tracker Status"

I was using BLE in passive mode and new BLE integration didn’t work until set BLE to active again…

Could you tell me where you did this?
the node is connected via wifi, and relays the information to HA.
The node IS receiving the bluetooth data fine, is just that they do not show up in HA anymore.

In integrations I added passive BLE monitor. In the configuration for that you can set discovery and active or passive BLE.

thank you, i tried it but it didnt work.
i think the problem lies between HA and ESPhome, as the sensors that are configured in the ESPhome node are not showing up in HA.

@Ryukenden

If you deleted the ESP device then you will need to add it in again first and use the code below. If not just change the code, install and reboot.

from this

esp32_ble_tracker:
  scan_parameters:
    interval: 30ms

to this and you can delete your sensors now. Must restart HA after updating code.

esphome:
  name: bluetooth-tracker-upstairs
  platform: ESP32
  board: esp32dev

# Enable logging
logger:

# For Bluetooth Proxy
esp32_ble_tracker:
###  scan_parameters:
###    interval: 1100ms
###    window: 1100ms
###    active: true

bluetooth_proxy:
   
# Enable Home Assistant API
api:

ota:
  password: "87417fc83f6a1856e160476b48ae3ae2"

wifi:
  ssid: "xxxx"
  password: "xxxx"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bluetooth-Tracker-Upstairs"
    password: "7IQumJKqyS58"

captive_portal:  
   
binary_sensor:
  - platform: status
    name: "Bluetooth Tracker Status"

You can remove the “###” if you would like to use the parameters.

I would also recommend flashing to the latest firmware. You may be okay (try it first) but you have the option to use the new advertising “BTHome” in config settings. If you do the intergration will look like this.

BTHome

website: GitHub - pvvx/ATC_MiThermometer: Custom firmware for the Xiaomi Thermometers and Telink Flasher via USB to Serial converter

Thank you for the reply.
It tells me Component Bluetooth proxy not found though.

Your using BThome which is a different integration that i am using.
But i don’t have problems receiving the Bluetooth info with my Node. Its just not displaying between ESPhome and HA?

to use the bluetooth proxy you must have this in your code.

bluetooth_proxy:

so from this

esp32_ble_tracker:
  scan_parameters:
    interval: 30ms

to this

# For Bluetooth Proxy
esp32_ble_tracker:
###  scan_parameters:
###    interval: 1100ms
###    window: 1100ms
###    active: true

bluetooth_proxy: 

once you done that and restart HA it/should auto discover your Xiaomi sensors. If you use “mijia” as your advertising format you should see a Xiaomi intergradation pop up in auto discovered. If you update to “BTHome” advertising format you will see “BTHome” intergradation pop up. They both work. You then dont need your sensor data in your code.

BTHome is by HA and make sense to upgrade

i put that in my node, but it gives me the error message component not found: bluetooth_proxy

If you want to use new features you also need to update to a version that supports that feature :bulb:

In your case that would be minimum 2022.8.0 - because that was where bluetooth proxies was introduced :raised_hands:

1 Like

Thanks for the advise, i thought it was updating but i guess it didn’t. I re-added it in addon store and its now up to date. The proxy is now accepted.

To fix the whole sensor not showing up. i decided to reflash the board with a different name, and it immediately worked. So i’m not sure what happend in the end.

Thank all of you for lending a hand :slight_smile:

Hi @Ryukenden glad you fixed it and got it working. I thought you updated to the latest and then it didn’t work because in your original code you didn’t have “bluetooth_proxy:”

Looks like two things happened.
1: You thought you had the latest version but didn’t. :pensive: :+1:
2: You needed to add “bluetooth_proxy:” to your code :grinning:

Good thing is that it is working now :facepunch:. Remember to remove all your sensors in your code as they are no longer required.

All other Bluetooth sensors added to your HA will now be auto discovered so long as they are within range of that Bluetooth proxy. Adding 2 lines of code to any existing ESP32 will also make it a Bluetooth proxy and you can space them around your home in order to have good Bluetooth proxy coverage.The developers have done a amazing job :heart:. For anyone else reading this post the two lines you need in your code are.

# For Bluetooth Proxy
esp32_ble_tracker:
bluetooth_proxy:

but check that your ESP32 is okay to use as a proxy hub.

May I suggest that marking you last post as the solution will not help other people that may read this post in the future and marking my first post as the solution by adding “bluetooth_proxy:” and removing your sensor data would fix the problem if you would of had the latest update as suggested in your first sentence.

or marking this post as the solution may help other check if they have updated as well.

1 Like

When I put bluetooth_proxy I get ‘Component not found’.

I am running HA 2022.10.0

Can anybody suggest a solution.

Full code below.

esphome:
  name: fireplacelight

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "52418558709ff7933f7b6e551f9f233e"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Fireplacelight Fallback Hotspot"
    password: "pqfVzxEHqkNV"

captive_portal:

light:
  - platform: neopixelbus
    pin: RX
    num_leds: 60
    type: GRB
    name: "Fireplace_lamp"
    variant: 800KBPS
    color_correct: [95%, 95%, 95%]
    
esp32_ble_tracker:
###  scan_parameters:
###    interval: 1100ms
###    window: 1100ms
###    active: true

bluetooth_proxy: 

first where do you see this?

Clean build files to your ESP and install. Your code is good.

It appears when I paste the line in to the editor. The red cross appears agains the line. Hover over it and it says Component not found. I’ll try a clean install and see what happens.

I just created a new entity etc and pasted just the BLE elements in to the mostly empty config but still the same problem. Its as if ESPHome doesn’t know that command exists.

DOH my fault. I wasn’t running the integrated ESPHOME add-on. I had the old one still installed.

i had the same issue,
make sure you Delete the other Esp addon, AND go to the new one and look for updates. Mine didn’t update apparently.

Thanks for replying. Yep uninstalled the old one and everything worked after an update to all devices.

1 Like

:+1: all good thanks for the info… glad your up and running :grinning: