One ESPHome device unable to update? Doesn't build for the latest ESP version since 2 updates ago?

I have one ESPhome device (ESP32 based) that since the last two versions of ESPhome updates refuses to update. All my other devices update just fine.

I’ve tried cleaning build files to no avail. An identical device updates just fine - it’s isolated just to this one. I have no idea what to do next

I can clearly see in the log output from the install/update that it’s not using the latest installed ESPHome version (2024.3.1) for whatever reason it is flashing 2024.3.0 to this device which I assume is why it still thinks it needs to be updated:

INFO ESPHome 2024.3.1
INFO Reading configuration /config/esphome/bedroomtvquad.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing bedroomtvquad (board: mhetesp32devkit; framework: espidf; platform: platformio/[email protected])
--------------------------------------------------------------------------------
Library Manager: Installing esphome/noise-c @ 0.1.4
INFO Installing esphome/noise-c @ 0.1.4
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Resolving dependencies...
INFO Resolving dependencies...
Library Manager: Installing esphome/libsodium @ 1.10018.1
INFO Installing esphome/libsodium @ 1.10018.1
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Installing bblanchon/ArduinoJson @ 6.18.5
INFO Installing bblanchon/ArduinoJson @ 6.18.5
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - framework-espidf @ 3.40406.240122 (4.4.6) 
 - tool-cmake @ 3.16.4 
 - tool-ninja @ 1.7.1 
 - toolchain-esp32ulp @ 2.35.0-20220830 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Reading CMake configuration...
Generating assembly for certificate bundle...
Dependency Graph
|-- noise-c @ 0.1.4
|-- ArduinoJson @ 6.18.5
Linking .pioenvs/bedroomtvquad/firmware.elf
RAM:   [==        ]  16.9% (used 55220 bytes from 327680 bytes)
Flash: [=======   ]  73.9% (used 1356409 bytes from 1835008 bytes)
Building .pioenvs/bedroomtvquad/firmware.bin
Creating esp32 image...
Successfully created esp32 image.
esp32_create_combined_bin([".pioenvs/bedroomtvquad/firmware.bin"], [".pioenvs/bedroomtvquad/firmware.elf"])
Wrote 0x15cb10 bytes to file /data/build/bedroomtvquad/.pioenvs/bedroomtvquad/firmware-factory.bin, ready to flash to offset 0x0
========================= [SUCCESS] Took 64.44 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 10.10.150.53
INFO Uploading /data/build/bedroomtvquad/.pioenvs/bedroomtvquad/firmware.bin (1362704 bytes)
Uploading: [============================================================] 100% Done...

INFO Upload took 18.83 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 10.10.150.53 using esphome API
INFO Successfully connected to bedroomtvquad @ 10.10.150.53 in 11.336s
INFO Successful handshake with bedroomtvquad @ 10.10.150.53 in 0.122s
[13:11:48][I][app:102]: ESPHome version 2024.3.0 compiled on Mar 21 2024, 12:46:52

Please share the sketch of that ESP :wink:

Here ya go!

esphome:
  name: bedroomtvquad

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

wifi:
  ssid: !secret iot_wifi_ssid
  password: !secret iot_wifi_pass

web_server:
  port: 80
  
logger:

sensor:  
  - platform: uptime
    name: bedroomtvquad Uptime Sensor
    id: bedroomtvquad_uptime_sensor
    icon: mdi:clock-start
    update_interval: 60s
  - platform: wifi_signal
    name: bedroomtvquad WiFi Signal
    id: bedroomtvquad_wifi_signal
    update_interval: 60s

# Enable Home Assistant API
api:
  encryption:
    key: !secret base64_key

ota:
  password: !secret esphome_ota_pass

output:
  - platform: ledc
    pin: 16
    frequency: 20000Hz
    id: LED_gpio_16

light:
  - platform: monochromatic
    name: "Bedroom TV Light"
    default_transition_length: 5s
    output: LED_gpio_16

## BLUETOOTH HA PROXY
esp32_ble_tracker:
  scan_parameters:
    interval: 1100ms
    window: 1100ms
    active: true

bluetooth_proxy:
  active: true

Remove that from your sketch as it’s useless and may prevent compilation with latest version of ESPHome and try again to recompile :wink:
You can also do a Clean Build Files (3 little dots on sketch)

Huh… can you explain a bit more why is that? Is there a bug in latest version? If he removes that line esphome will compile with arduino instead esp-idf. When using btproxy esp-idf is highly recommended to use over arduino since it uses way less resources and it’s faster. I have quite a few esp-idf versions myself, running perfectly.
@NOTORIOUSVR : newer shelly devices (gen.3) can have similar problem, as i’ve read, because bootloader is changed in a way that always starts same partition (or something similar). can it be that? But, then again… in this case older esphome’s would have same problems, too, i guess… ?

It is not useless, if you use BT proxy without that it becomes highly unstable and the device is constantly rebooting - which is why it is in ESPhomes directions to use that.

Also as I said I have another device that is identical (in hardware and function) which has the identical sketch and it updates just fine.

It is an older device (along with some others but I tinker so much it could be the oldest at this point) - maybe I should pull it out, and erase/flash with USB cable and see if that resolves the issue!

Thanks for the heads up.

Yes, do that, and flash it with online esphome web interface (use modern format download when compiling). I just remembered that once in the past (although a while ago) file structure was changed and it was advised to flash our devices via usb once again.

yeah that’s the plan! Will update here after.

Thanks!

For any that find this down the road - Flashing the controller directly over USB resolved the issue.