ESPHome device wifi connection issue

I’m having trouble getting my device to work. I flashed my config with the device connected directly to my Raspbery Pi running Home Assistant and it says it’s online, however it shows this error in the logs…

INFO ESPHome 2025.6.1
INFO Reading configuration /config/esphome/keg-manager-1.yaml...
INFO Starting log output from 192.168.1.154 using esphome API
INFO Successfully resolved keg-manager-1 @ 192.168.1.154 in 0.000s
WARNING Can't connect to ESPHome API for keg-manager-1 @ 192.168.1.154: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.154', port=6053))]: [Errno 111] Connect call failed ('192.168.1.154', 6053) (SocketAPIError)
INFO Trying to connect to keg-manager-1 @ 192.168.1.154 in the background
INFO Successfully resolved keg-manager-1 @ 192.168.1.154 in 0.000s

wifi setup in yaml looks like this…

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

Maybe my IP address is incorrect? If I remove that line the device appears offline.

Remove that. Replace with:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.1.154
    gateway: 192.168.1.1
    subnet: 255.255.255.0

The “use_address” option does not set a static IP. It is for overriding a set static IP address when changing the address. e.g. if you successfully use the config above then decide you want to change the ip address to 192.168.1.42 you would do:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.1.154  # use this to contact old address
  manual_ip:
    static_ip: 192.168.1.42 # programs new address
    gateway: 192.168.1.1
    subnet: 255.255.255.0

After a successful OTA you then delete the use_address from the config.

Thanks for the quick response. I updated the file but I still get the error. This is what I get in the update…

Updating /config/esphome/keg-manager-1.yaml
------------------------------------------------------------

INFO ESPHome 2025.6.1
INFO Reading configuration /config/esphome/keg-manager-1.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing keg-manager-1 (board: d1_mini; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.3.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.6
RAM:   [====      ]  42.5% (used 34808 bytes from 81920 bytes)
Flash: [=====     ]  49.0% (used 512261 bytes from 1044464 bytes)
========================= [SUCCESS] Took 2.20 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.154 port 8266...
ERROR Connecting to 192.168.1.154 port 8266 failed: [Errno 111] Connection refused
ERROR Connection failed.
======== [ERROR] /config/esphome/keg-manager-1.yaml ========



======================== [SUMMARY] ========================
  - /config/esphome/keg-manager-1.yaml: FAILED

Can you see what address the ESP currently has by looking in your router’s DHCP assignments?

Also is this actually your gateway (I guessed)?

gateway: 192.168.1.1

Do these screenshots help?
Screenshot 2025-06-26 at 9.41.24 AM

It won’t let me upload more than one image. Router is 192.168.1.1

Good that is your gateway.

Is the ESP device listed?

It’s listed under ESPHome Builder tab

On my router all I see are these…
homeassistant 192.168.1.151 DHCP
homeassistant 2600:4040:9ea2:6f00:9af1:2e11:b47c:be26 NDP

You are trying to update over the air (OTA) not using the serial/USB port. You need to direct connect the first time.

When you go to install do not select “wirelessly”. Select “connect to this computer” or whatever it says like that.

After that flash you can then use OTA.

Okay plugged directly into the Pi again and ran an install…

INFO ESPHome 2025.6.1
INFO Reading configuration /config/esphome/keg-manager-1.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing keg-manager-1 (board: d1_mini; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.3.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.6
RAM:   [====      ]  42.5% (used 34808 bytes from 81920 bytes)
Flash: [=====     ]  49.0% (used 512261 bytes from 1044464 bytes)
========================= [SUCCESS] Took 2.20 seconds =========================
INFO Successfully compiled program.
esptool.py v4.8.1
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: c4:d8:d5:2c:e8:46
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00000000 to 0x0007efff...
Compressed 516416 bytes to 361580...
Wrote 516416 bytes (361580 compressed) at 0x00000000 in 8.4 seconds (effective 490.5 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB0 with baud rate 115200

Does that mean it’s successful?

Looks like it.

Check if your ESP is in your DHCP list now.

I’m not seeing anything there that looks like it would be the device. Would it have the name I gave it? “Keg Manager 1”?

I see a wlan0 device might that be it?

Is this the ip address?
192.168.1.154

the ip address of that device is 192.168.1.190

Then no that’s not it. Did home assistant discover it?

It might help if you share the full device config.

Here’s my device config…

esphome:
  name: keg-manager-1
  friendly_name: Keg Manager 1

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "Umb+W4fVdaTt/VFFAsf3lHtO2QFzcWC7Yi4xyXxuKMM="

ota:
  - platform: esphome
    password: "f4f1932374cab6d47206b7c8c5fc29aa"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.1.154
    gateway: 192.168.1.1
    subnet: 255.255.255.0

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

captive_portal:
    
sensor:
  - platform: hx711
    name: "HX711 Value"
    dout_pin: D3
    clk_pin: D2
    gain: 128
    update_interval: 5s

switch:
  - platform: gpio
    name: "Low"
    id: low_led
    pin: D5

    
  - platform: gpio
    name: "Medium"
    id: med_led
    pin: D6

    
  - platform: gpio
    name: "High"
    id: hi_led
    pin: D7        

How do I check to see if Home Assistant discovered it? Sorry I just started using it. I’m not seeing it under the Overview tab, just under ESPHome Builder.

Settings → Devices & Services. There would also be a notification icon lower down in the left menu.

Yeah no notifications and not seeing anything there under discovered. I did add the Fios router though. which says my “External IP” is some value. Not sure if that matters :stuck_out_tongue:

Still no luck connecting. I can plug the device into my Raspberry Pi directly and flash it with no issue but I can’t seem to get it to connect via wifi once it’s unplugged. :confused: