ESPHome Bluetooth Proxy is killing my ESP32 D1 Mini

I have multiple ESP32 D1 Mini devices that run on ESPHome. I wanted to add a Bluetooth Proxy to them, but every time I try, the devices go offline and remain like that until I upload a clean install without the Bluetooth code using a USB cable.

To troubleshoot this issue, I tested it on a new ESP32 D1 Mini device that had no pre-existing code. I installed the basic code, and everything worked fine. However, as soon as I added the ESPHome Bluetooth proxy code and installed it, the device goes into offline mode, and I cannot not do anything until I installed a clean code without the Bluetooth code.

What could be causing this problem, and what am I doing wrong?

Here is my code with Bluetooth Proxy in the end.

esphome:
  name: bluetooth-proxy-test
  friendly_name: Bluetooth Proxy Test

esp32:
  board: esp32dev
  framework:
    type: esp-idf

logger:

api:

ota:

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

  ap:

captive_portal:

### THE PROBLEM STARTS WHEN I ADD THE FOLLOWING CODE:
esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true

Not sure if it’s your problem or not, but I had to remove captive portal on all my BT Proxies (my memory is it wouldn’t even compile, but it’s been a long time).

Also, per the docs you shouldn’t be specifying the interval or window unless you’re using Ethernet. I doubt this is your problem though.

Thank you for your suggestion, but it did not help. I installed a new code and it went offline again. I had to restore it using a USB cable.

Here is my latest code that I used:

esphome:
  name: bluetooth-proxy-test
  friendly_name: Bluetooth Proxy Test

esp32:
  board: esp32dev
  framework:
    type: esp-idf

logger:

api:

ota:

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

  ap:

esp32_ble_tracker:
  scan_parameters:
    active: true

bluetooth_proxy:
  active: true

Not sure what you mean by “offline”. In HA? Rebooting? Not even booting?
What does the (USB) ESP log tell?

Offline in ESPHome and they device is down because I cannot ping it anymore.
image

And the logs through USB?

Sorry, but I do not know how to collect them and where can I find them? When I upload a new code, I do not see any errors.

Is it possible that my ESP32 D1 Minis have problems with Bluetooth? Should I try to purchase them again? Does anyone can recommend me ESP32 D1 Mini that tested and works as a Bluetooth Proxy?

My logs in ESPHome add-in do not show me anything after the update started. When I use Logs on the web.esphome.io page, they freeze and I cannot download logs. I tried it multiple times and I tried it using Microsoft Edge and Google Chrome. It freezes here:

Can you link to which board you are using?

I use this and I tried it on two of them with the same result. https://www.amazon.com/gp/product/B09C5RDZ8G/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Have you tried a different power supply and USB cable?

One of them I tried with a power supply. The second one is plugged in to my computer because I continue uploading codes.

A common solution for those “s_prepare_reserved_regions” errors seems to be to do a clean build

1 Like

Thank you! It fixed my problem. I am new to ESPHome. What is this option and how often do I have to use it?

It just removes the files that were downloaded/generated to compile the firmware. Old files can lead to compile errors like you were seeing. It’s a good first step to troubleshoot issues during the firmware compile process like you were seeing in the logs.

It’s a good idea to do a clean build when adding or removing components, or after an esphome update.
Most of the time, the build will just fail for a random reason, but you were unlucky in that it failed at runtime instead.

Great! Good to know. Thank you everyone for helping me!