OTA update of ESP32 has no effect

Hello @alI,
I have a problem with updating over the air. Everything works well and there are no errors, but the configuration of the ESP32 has not changed after updating.

Steps:

  1. I edit the sensor configuration:
    Example for my home-manager:
esphome:
  name: home-manager
  platform: ESP32
  board: esp32doit-devkit-v1

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "605536c6230043de38d83d82f0eb2467"

wifi:
  ssid: "asdf"
  password: "1234567890"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Home-Manager Fallback Hotspot"
    password: "GxSBcv0amqbl"

captive_portal:

binary_sensor:
# Schalter Büro
  - platform: gpio
    pin:
      number: 17
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Schalter Büro 1"
    device_class: plug
    filters:
      - delayed_on_off: 20ms
    on_press:
      then:
        - switch.toggle: buero_licht
  - platform: gpio
    pin:
      number: 18
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Schalter Büro 2"
    device_class: plug
    filters:
      - delayed_on_off: 20ms
    on_press:
      then:
        - switch.toggle: buero_licht


# Switches aka relais 
switch:
  - platform: gpio
    pin:
      number: 12
      inverted: true
      mode:
        output: true
        open_drain: true
    name: "Licht Büro"
    restore_mode: RESTORE_DEFAULT_ON
    id: buero_licht
  1. I click on validate and everything is okay:
INFO Reading configuration /config/esphome/home-manager.yaml...
WARNING GPIO12 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Configuration is valid!
esphome:
  name: home-manager
  build_path: .esphome/build/home-manager
  platformio_options: {}
  includes: []
  libraries: []
  name_add_mac_suffix: false
esp32:
  board: esp32doit-devkit-v1
  framework:
    version: 1.0.6
    source: ~3.10006.0
    platform_version: platformio/espressif32 @ 3.3.2
    type: arduino
  variant: ESP32
logger:
  baud_rate: 115200
  tx_buffer_size: 512
  deassert_rts_dtr: false
  hardware_uart: UART0
  level: DEBUG
  logs: {}
api:
  port: 6053
  password: ''
  reboot_timeout: 15min
ota:
  password: 605536c6230043de38d83d82f0eb2467
  safe_mode: true
  port: 3232
  reboot_timeout: 5min
  num_attempts: 10
wifi:
  ap:
    ssid: Home-Manager Fallback Hotspot
    password: GxSBcv0amqbl
    ap_timeout: 1min
  domain: .local
  reboot_timeout: 15min
  power_save_mode: LIGHT
  fast_connect: false
  networks:
  - ssid: asdf
    password: '1234567890'
    priority: 0.0
  use_address: home-manager.local
captive_portal: {}
binary_sensor:
- platform: gpio
  pin:
    number: 17
    mode:
      input: true
      pullup: true
      output: false
      open_drain: false
      pulldown: false
    inverted: true
  name: Schalter Büro 1
  device_class: plug
  filters:
  - delayed_on_off: 20ms
  on_press:
  - then:
    - switch.toggle:
        id: buero_licht
  disabled_by_default: false
- platform: gpio
  pin:
    number: 18
    mode:
      input: true
      pullup: true
      output: false
      open_drain: false
      pulldown: false
    inverted: true
  name: Schalter Büro 2
  device_class: plug
  filters:
  - delayed_on_off: 20ms
  on_press:
  - then:
    - switch.toggle:
        id: buero_licht
  disabled_by_default: false
switch:
- platform: gpio
  pin:
    number: 12
    inverted: true
    mode:
      output: true
      open_drain: true
      input: false
      pullup: false
      pulldown: false
  name: Licht Büro
  restore_mode: RESTORE_DEFAULT_ON
  id: buero_licht
  disabled_by_default: false
  interlock_wait_time: 0ms
  1. I choose install and flash over the air and everything works well, but as you can see in the log here, there are many other switches and binary sensors, that I deleted before. I deleted them to test if anything changes. It is the same for the whole configuration. I tried also changing GPIO pins etc, but changes have no effect.
INFO Reading configuration /config/esphome/home-manager.yaml...
WARNING GPIO12 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing home-manager (board: esp32doit-devkit-v1; framework: arduino; platform: platformio/espressif32 @ 3.3.2)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <ESPmDNS> 1.0
RAM:   [=         ]  12.7% (used 41748 bytes from 327680 bytes)
Flash: [=====     ]  49.3% (used 905442 bytes from 1835008 bytes)
========================= [SUCCESS] Took 5.37 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of home-manager.local
INFO  -> 192.168.188.37
INFO Uploading /data/home-manager/.pioenvs/home-manager/firmware.bin (905552 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from home-manager.local using esphome API
WARNING Can't connect to ESPHome API for home-manager.local: Error resolving IP address: [Errno -2] Name or service not known
INFO Trying to reconnect to home-manager.local in the background
INFO Successfully connected to home-manager.local
[11:17:33][I][app:099]: ESPHome version 2021.11.4 compiled on Jan 28 2022, 15:29:35
[11:17:33][C][wifi:488]: WiFi:
[11:17:33][C][wifi:350]:   Local MAC: 94:B9:7E:D4:F7:9C
[11:17:33][C][wifi:351]:   SSID: [redacted]
[11:17:33][C][wifi:352]:   IP Address: 192.168.188.37
[11:17:33][C][wifi:354]:   BSSID: [redacted]
[11:17:33][C][wifi:355]:   Hostname: 'home-manager'
[11:17:33][C][wifi:357]:   Signal strength: -36 dB ▂▄▆█
[11:17:33][C][wifi:361]:   Channel: 6
[11:17:33][C][wifi:362]:   Subnet: 255.255.255.0
[11:17:33][C][wifi:363]:   Gateway: 192.168.188.1
[11:17:33][C][wifi:364]:   DNS1: 192.168.188.1
[11:17:33][C][wifi:365]:   DNS2: 0.0.0.0
[11:17:33][C][logger:233]: Logger:
[11:17:33][C][logger:234]:   Level: DEBUG
[11:17:33][C][logger:235]:   Log Baud Rate: 115200
[11:17:33][C][logger:236]:   Hardware UART: UART0
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Küche Eingang 1'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO13
[11:17:33][D][api:098]: Accepted 192.168.188.85
[11:17:33][D][api.connection:747]: Home Assistant 2021.12.10 (192.168.188.85): Connected successfully
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Küche Eingang 2'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO14
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Küche Ecke WZ 1'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO15
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Küche Ecke WZ 2'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO16
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Büro 1'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO17
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Büro 2'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO18
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Schlafzimmer 1'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO19
[11:17:33][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter Schlafzimmer 2'
[11:17:33][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:33][C][gpio.binary_sensor:016]:   Pin: GPIO21
[11:17:34][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter WZ Ecke Büro 1'
[11:17:34][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:34][C][gpio.binary_sensor:016]:   Pin: GPIO22
[11:17:34][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter WZ Ecke Büro 2'
[11:17:34][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:34][C][gpio.binary_sensor:016]:   Pin: GPIO23
[11:17:34][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter WZ Ecke Badezimmer 1'
[11:17:34][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:34][C][gpio.binary_sensor:016]:   Pin: GPIO25
[11:17:34][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter WZ Ecke Badezimmer 2'
[11:17:34][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:34][C][gpio.binary_sensor:016]:   Pin: GPIO26
[11:17:34][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter WZ Ecke Küche 1'
[11:17:34][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:34][C][gpio.binary_sensor:016]:   Pin: GPIO4
[11:17:34][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'Schalter WZ Ecke Küche 2'
[11:17:34][C][gpio.binary_sensor:015]:   Device Class: 'plug'
[11:17:34][C][gpio.binary_sensor:016]:   Pin: GPIO5
[11:17:34][C][switch.gpio:048]: GPIO Switch 'Lüftung Badezimmer'
[11:17:34][C][switch.gpio:049]:   Pin: GPIO32
[11:17:34][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[11:17:34][C][switch.gpio:048]: GPIO Switch 'Licht Badezimmer'
[11:17:34][C][switch.gpio:049]:   Pin: GPIO27
[11:17:34][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[11:17:34][C][switch.gpio:048]: GPIO Switch 'Licht Küche'
[11:17:34][C][switch.gpio:049]:   Pin: GPIO33
[11:17:34][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[11:17:34][C][switch.gpio:048]: GPIO Switch 'Licht Büro'
[11:17:34][C][switch.gpio:049]:   Pin: GPIO12
[11:17:34][C][switch.gpio:071]:   Restore Mode: Restore (Defaults to OFF)
[11:17:34][C][captive_portal:151]: Captive Portal:
[11:17:34][C][ota:082]: Over-The-Air Updates:
[11:17:34][C][ota:083]:   Address: home-manager.local:3232
[11:17:34][C][ota:086]:   Using Password.
[11:17:34][W][ota:092]: Last Boot was an unhandled reset, will proceed to safe mode in 6 restarts
[11:17:34][C][api:134]: API Server:
[11:17:34][C][api:135]:   Address: home-manager.local:6053
[11:17:34][C][api:139]:   Using noise encryption: NO
[11:17:34][C][mdns:084]: mDNS:
[11:17:34][C][mdns:085]:   Hostname: home-manager

I have also checked the home-manager.yaml file. The file is writable and saved correctly. Does someone have an idea what’s going wrong here?

Tried a clean make?

Yes, i tried that and repeated the steps above, but the problem stays the same.

I have also changed browsers. Tried Chrome and Firefox. I have noticed this behavior before, my solution was to manually override the ESP32 sketch with Blink or something else and then re-upload ESPHome by cable connection.

I’m seeing the same thing on my ESP32 board. The logs indicate the update was successful, but the config changes aren’t applying.

I can connect the board directly to my PC to perform updates, but that’s not ideal - and doing a manual update doesn’t fix OTA updates after that.

EDIT: Rebooted home assistant and redid the OTA update. Seems to have fixed the issue for now.

EDIT2: This allowed me to update once, but it broke again. Rebooting HA has no impact on the issue now.

I got the same problem and it’s driving me nuts… Even with usb serial connection (through esphone web browser) my esp32 won’t change the program after a “successfull” install. I have no clue what’s going on there…

After another sleepless night I found the issue that was causing this behaviour for me: I was using GPIO12 for I2C connected to an external device. GPIO12 by default is used to select the flash voltage on boot for the ESP32. Since the I2C device was pulling the pin up, my ESP32 got initialized with wrong flash voltage.
I could fix it with:
espefuse.py set_flash_voltage 3.3V

1 Like

Could you please explain this fix in more depth? I’m also using GPIO12 and suspect my issue may be the same, but I’m more of a beginner.

I only know how to flash via esphome YAML in home assistant (OTA and via USB)

If you read this page, it gives info about esp32 pins. ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

You will see that GPIO12 has some special functionality, namely the esp32 will refuse to boot if the pin is pulled high while the esp32 is booting.

Given that the esp32 has so many pins, choose another one.

Thanks! I’m a bit more restricted as I’m using the esp32cam, which reserves a bunch of pins - but I can probably still find another option.

Yes, using a different pin is definately the prefered solution. If, like me, you don’t have any other pins available anymore you can use the command like mentioned above. I’m also using Esp32cam btw. Just install esptool.py and execute the command. You can use google to get more infomation about it.
But this is probably only for experienced users as with espefuse you can easily brick your esp32…