Port 3232 failed: [Errno 111] Connection refused

When I try to update the ESPHome firmware 2025.5 to my ESP8266 via HA update functionality I get this message:

Error during OTA (Over-The-Air) of flexispot.yaml; Try again in ESPHome dashboard for more information

Within ESPHome Addon I tried to update to the latest firmware, everythings looks good till the end when this Port-3232 failed message comes:

INFO ESPHome 2025.5.0
INFO Reading configuration /config/esphome/flexispot-ek5-new.yaml...
WARNING 'flexispot_ek5': Using the '_' (underscore) character in the hostname is discouraged as it can cause problems with some DHCP and local name services. For more information, see https://esphome.io/guides/faq.html#why-shouldn-t-i-use-underscores-in-my-device-name
INFO Generating C++ source...
INFO Compiling app...
Processing flexispot_ek5 (board: wemos_d1_mini32; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- AsyncTCP-esphome @ 2.1.4
|-- WiFi @ 2.0.0
|-- FS @ 2.0.0
|-- Update @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.3.0
|-- DNSServer @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- noise-c @ 0.1.6
RAM:   [=         ]  12.5% (used 41104 bytes from 327680 bytes)
Flash: [=====     ]  52.6% (used 965989 bytes from 1835008 bytes)
========================= [SUCCESS] Took 4.35 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of flexispot_ek5.local in mDNS
INFO Connecting to 192.168.178.52 port 3232...
ERROR Connecting to 192.168.178.52 port 3232 failed: [Errno 111] Connection refused
ERROR Connection failed.

Does anyopne how I can solve this?

Post your yaml as well.

Sure, no problem:

substitutions:
  device_name: Flexispot EK5
  name: flexispot_ek5
  min_height: "70.0" # cm
  max_height: "120.0" # cm
  ssid: !secret wifi_ssid
  wifi_password: !secret wifi_password
  ap_fallback_password: "MnANX95MWad8"         #changed
  tx_pin: D5 # TXD 2
  rx_pin: D6 # RXD 2
  screen_pin: D2
  encryption_key: "iOZqtvw31Yy6sasRl5h2DElG2VDlqW2WjJEKObdN8bg!" #changed

#web_server:
#  port: 80

external_components:
  source: github://iMicknl/LoctekMotion_IoT
  components: [ loctekmotion_desk_height ]

esp32:
  board: wemos_d1_mini32
  framework:
    type: arduino

esphome:
  name: ${name}
  friendly_name: ${device_name}
  comment: Used to control your ${device_name} standing desk via Home Assistant.

  # Wake Desk by sending the "M" command
  # This will pull the current height after boot
  on_boot:
    priority: -10
    then:
      - button.press: button_m


# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: ${encryption_key}

ota:
  platform: esphome
#  port: 3232

wifi:
  ssid: ${ssid}
  password: ${wifi_password}

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name} Fallback Hotspot
    password: ${ap_fallback_password}

captive_portal:

uart:
  - id: desk_uart
    baud_rate: 9600
    tx_pin: ${tx_pin}
    rx_pin: ${rx_pin}
    # debug:

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 60s

  - platform: uptime
    name: Uptime

  - platform: loctekmotion_desk_height
    id: "desk_height"
    name: Desk Height
    on_value_range:
    - below: ${min_height}
      then:
        - switch.turn_off: switch_down
    - above: ${max_height}
      then:
        - switch.turn_off: switch_up
    on_value:
      then:
        - cover.template.publish:
            id: desk_cover
            position: !lambda |-
                // The sensor outputs values from min_height (cm) to max_height (cm)
                // We need to translate this to 0 - 1 scale.
                float position = (float(x) - float(${min_height})) / (float(${max_height}) - float(${min_height}));
                return position;
        - component.update: set_desk_height

switch:
  - platform: gpio
    name: "Virtual Screen" # PIN20
    pin:
      number: ${screen_pin}
      mode: OUTPUT
    restore_mode: ALWAYS_ON
    entity_category: "config"
    internal: true

  - platform: uart
    name: "Up"
    id: switch_up
    icon: mdi:arrow-up-bold
    data: [0x9b, 0x06, 0x02, 0x01, 0x00, 0xfc, 0xa0, 0x9d]
    uart_id: desk_uart
    send_every: 108ms
    internal: true

  - platform: uart
    name: "Down"
    id: switch_down
    icon: mdi:arrow-down-bold
    data: [0x9b, 0x06, 0x02, 0x02, 0x00, 0x0c, 0xa0, 0x9d]
    uart_id: desk_uart
    send_every: 108ms
    internal: true

  - platform: uart
    name: "Alarm off"
    id: switch_alarm
    icon: mdi:alarm
    data: [0x9b, 0x06, 0x02, 0x40, 0x00, 0xAC, 0x90, 0x9d]
    uart_id: desk_uart
    send_every: 108ms
    on_turn_on:
      - delay: 3000ms
      - switch.turn_off: switch_alarm
    entity_category: "config"

  - platform: uart
    name: "Child Lock"
    id: switch_child_lock
    icon: mdi:account-lock
    data: [0x9b, 0x06, 0x02, 0x20, 0x00, 0xac, 0xb8, 0x9d]
    uart_id: desk_uart
    send_every: 108ms
    on_turn_on:
      - delay: 5000ms
      - switch.turn_off: switch_child_lock
    entity_category: "config"

button:
  - platform: template
    name: "Preset 1"
    icon: mdi:numeric-1-box
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x04, 0x00, 0xac, 0xa3, 0x9d]

  - platform: template
    name: "Preset 2"
    icon: mdi:numeric-2-box
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x08, 0x00, 0xac, 0xa6, 0x9d]

  - platform: template
    name: "Sit" # Preset 3 on some control panels
    icon: mdi:chair-rolling
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x00, 0x01, 0xac, 0x60, 0x9d]

  - platform: template
    name: "Stand" # Preset 4 on some control panels
    icon: mdi:human-handsup
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x10, 0x00, 0xac, 0xac, 0x9d]

  - platform: template
    name: "Memory"
    id: button_m
    icon: mdi:alpha-m-box
    entity_category: "config"
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x20, 0x00, 0xac, 0xb8, 0x9d]

  - platform: template
    name: "Wake Screen"
    id: button_wake_screen
    icon: mdi:gesture-tap-button
    entity_category: "config"
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x00, 0x00, 0x6c, 0xa1, 0x9d]

  - platform: template
    name: "Alarm"
    id: button_alarm
    icon: mdi:alarm
    on_press:
      - uart.write:
          id: desk_uart
          data: [0x9b, 0x06, 0x02, 0x40, 0x00, 0xAC, 0x90, 0x9d]

  - platform: restart
    name: "Restart"
    entity_category: "config"

cover:
  - platform: template
    id: "desk_cover"
    icon: mdi:desk # or mdi:human-male-height-variant
    name: "Desk"
    device_class: blind # makes it easier to integrate with Google/Alexa
    has_position: true
    position_action:
      - if:
          condition:
            - lambda: !lambda |-
                return pos > id(desk_cover).position;
          then:
            - cover.open: desk_cover
            - wait_until:
                lambda: |-
                  return id(desk_cover).position  >= pos;
            - cover.stop: desk_cover
          else:
            - cover.close: desk_cover
            - wait_until:
                lambda: |-
                  return id(desk_cover).position <= pos;
            - cover.stop: desk_cover
    stop_action:
      - switch.turn_off: switch_up
      - switch.turn_off: switch_down
    open_action:
      - switch.turn_off: switch_down
      - switch.turn_on: switch_up
    close_action:
      - switch.turn_off: switch_up
      - switch.turn_on: switch_down
    optimistic: false

number:
  - platform: template
    name: "Desk Height"
    id: set_desk_height
    min_value: ${min_height}
    max_value: ${max_height}
    icon: "mdi:counter"
    unit_of_measurement: "cm"
    device_class: "distance"
    step: 0.1
    lambda: !lambda |-
      return id(desk_height).state;
    set_action:
      - if:
          condition:
            - lambda: !lambda |-
                return x > id(desk_height).state;
          then:
            - cover.open: desk_cover
            - wait_until:
                lambda: |-
                  return id(desk_height).state  >= x;
            - cover.stop: desk_cover
          else:
            - cover.close: desk_cover
            - wait_until:
                lambda: |-
                  return id(desk_height).state <= x;
            - cover.stop: desk_cover

You will find hard time mixing two different MCUs.

Which one you have?

Its a D1-mini. I red somewhere that I can specify as wemos_d1_mini32.
I’ve now added port 8266 to the OTA section and I’ve got it compiled.

INFO Successfully compiled program.
INFO Connecting to 192.168.178.52 port 8266...
INFO Connected to 192.168.178.52
INFO Uploading /data/build/flexispot_ek5/.pioenvs/flexispot_ek5/firmware.bin (971760 bytes)
INFO Compressed to 639087 bytes
Uploading: [============================================================] 100% Done...

INFO Upload took 5.23 seconds, waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.178.52 using esphome API

Thanks for the help! Sometimes it just requires the right question…

D1 mini has esp8266 chip,
Wemos d1 mini esp32 has esp32 chip.
They have next to nothing in common.

You are fully right. Thanks!
This is the right setup:

esp8266:
  board: d1_mini

Much better! :+1: