Warning when updating devices from ESPHome Builder

Hi, I’m getting the following warning when installing updates from ESPHome Builder:

WARNING Can’t connect to ESPHome API for sonoff-14 @ 192.168.2.97: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)

This is happening with all the devices associated to HASS via ESPHome, and started after installing the latest version.

No YAML, impossible to tell what is wrong, but I would guess your network configuration is incorrect.

This post offers some tips: ESPHome device can't connect after HA restart - #7 by zoogara

Thanks, but that’s not the problem

You can post your yaml and logs or wait for wild guesses…

1 Like

I have the same issue. Exact same error. Here is the YAML for one of my devices, though all of them are showing the same error.

esphome:
  name: "esp32-light"
  friendly_name: LED Light

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "KEY"

ota:
  - platform: esphome
    password: "PASSWORD"

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

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

captive_portal:

i2c:
  sda: GPIO21
  scl: GPIO22

font:
  - file: "gfonts://Roboto"
    id: roboto_20
    size: 20
  - file: "gfonts://Material+Symbols+Outlined"
    id: icons_48
    size: 48
    glyphs: ["\U0000e9f5", "\U0000e9f6"]

display:
  - platform: ssd1306_i2c
    id: led_light_display
    model: "SSD1306 128x32"
    address: 0x3C
    pages:
      - id: page1    
        lambda: |-
          it.printf(0, 16, id(roboto_20), TextAlign::CENTER_LEFT, "OFF");
          it.printf(66, 16, id(icons_48), TextAlign::CENTER, "\U0000e9f6");
          it.printf(124, 16, id(roboto_20), TextAlign::CENTER_RIGHT, "ON");
      - id: page2    
        lambda: |-
          it.printf(0, 16, id(roboto_20), TextAlign::CENTER_LEFT, "OFF");
          it.printf(66, 16, id(icons_48), TextAlign::CENTER, "\U0000e9f5");
          it.printf(124, 16, id(roboto_20), TextAlign::CENTER_RIGHT, "ON");
      

light:
  - platform: esp32_rmt_led_strip
    id: led_light
    name: "LED Light"
    pin: GPIO16
    chipset: WS2812
    rgb_order: GRB
    num_leds: 48
    rmt_channel: 0
    default_transition_length: 0.3s
    on_turn_on:
      then: 
      - display.page.show: page1  
      - component.update: led_light_display
    on_turn_off:
      then:
      - display.page.show: page2
      - component.update: led_light_display

binary_sensor:
  - platform: gpio
    device_class: light
    name: "Toggle Switch"
    pin:
      number: GPIO18
      mode:
        input: true
        pullup: true
    filters:
      - delayed_on: 10ms
    on_release: 
      then:
        - lambda: |-
            auto call = id(led_light).toggle();
            call.perform();
  - platform: gpio
    pin: GPIO12
    name: "Motion Sensor"
    device_class: motion
    id: esp32_pir_sensor
    on_press: 
      then:
        - light.turn_on:
            id: led_light
            brightness: 85%
            red: 0.88
            green: 0.85
            blue: 0.8
        - script.execute: off_timer

script:
  - id: off_timer
    mode: restart
    then:
      - delay: 5min
      - light.turn_off:
          id: monitor_led_strip
          transition_length: .3s

Highly unlikely, since your device name is not the same as the one mentioned by the OP.

Assuming you meant the rest of the message was the same, the comment I made previously still applies. There is a networking issue.

How are you updating your devices?
What do the device’s logs show? (will need to use a USB connection to see them probably)

I didn’t say I have the exact same message. I said I have the same error. I’m not sure why my error is different if my error message and referenced error object are the same.

WARNING Can't connect to ESPHome API for esp32-light @ 192.168.X.XX: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)

My network is running on eero devices. There has not been an update to the software recently. This device was on the network operating normally for the last 2 months without any issues or warnings in the logs. I updated to the latest version of ESPHome, and then this error popped up on first boot from that update.

If it is in fact a networking issue, is there something I can do? Longer timeout for the api object?

Are you sure IP has not changed?
Is it online and functional?

Your error message says HA can’t connect to your device at the specific address (that you obscured). How did you update/program the device?

What you have is a failure to communicate. There are more reasons for this (failure) than are for it to work correctly.

If the uploader can still communicate, perhaps it is doing it differently (using a different IP address for instance).

Can you find the IP address of the device from the eero UI? Does it show the device as connected? What IP address is it using?

Have you tried connecting to the device directly (using USB) to get the logs? What does it think?

I get the same error (maybe since last ESPHome update).
Here some more log:

======================== [SUCCESS] Took 239.47 seconds ========================
INFO Successfully compiled program.
INFO Connecting to 192.168.188.157 port 3232...
INFO Connected to 192.168.188.157
INFO Uploading /data/build/esp-ultrasonic/.pioenvs/esp-ultrasonic/firmware.bin (918816 bytes)
Uploading: [============================================================] 100% Done...


INFO Upload took 18.55 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.188.157 using esphome API
INFO Successfully resolved esp-ultrasonic @ 192.168.188.157 in 0.000s
WARNING Can't connect to ESPHome API for esp-ultrasonic @ 192.168.188.157: Error while starting connection: Starting connection cancelled (APIConnectionCancelledError)
INFO Trying to connect to esp-ultrasonic @ 192.168.188.157 in the background
INFO Successfully resolved esp-ultrasonic @ 192.168.188.157 in 0.000s
INFO Successfully connected to esp-ultrasonic @ 192.168.188.157 in 0.219s
INFO Successful handshake with esp-ultrasonic @ 192.168.188.157 in 0.096s
[15:49:02][I][app:164]: ESPHome version 2025.7.0 compiled on Jul 18 2025, 15:45:57
[15:49:02][C][wifi:613]: WiFi:
[15:49:02][C][wifi:434]:   Local MAC: 3C:8A:1F:5D:9A:10
[15:49:02][C][wifi:439]:   SSID: [redacted]
[15:49:02][C][wifi:442]:   IP Address: 192.168.188.157
[15:49:02][C][wifi:446]:   BSSID: [redacted]
[15:49:02][C][wifi:446]:   Hostname: 'esp-ultrasonic'

As screenshot due to the colors:

I don’t have any issues otherwise, the devices are working.

Either ignore the error message (if it only shows up once at update time and everything is working fine after, it might be a timing issue with the device not being ready when it tries the first time, since it just started) or answer all the questions to get help, but it does sound like a timing issue.

Its a harmless race that the device came online right as it was trying to connect so it canceled the stalled attempt and reconnected right away. We should downgrade that to something other than a warning now that 2025.7.x is faster at reconnecting so its more likely to happen (which is a good thing overall).

1 Like