Why port 6053

As I am having a big problem with my ESP32 connecting to wifi, I would like to know why it wants to connect to port 6053, and not any other open port I may have.


Because that it the port that the author chose to run it on.

Just like someone years ago chose port 80 to run http on and 443 to run https on and 25 to run smtp and… It is purely arbitrary.

1 Like

OK thanks, so can any other port be used then.

1 Like

Yes, the docs are clear https://esphome.io/components/api.html

But why would you want to? It will not help you connect to wifi.

Why does it need to? And what do you mean by “and not any other open port”?

This is internal, you shouldn’t need to be ‘opening’ ports.

But, if you do need to, it can be set in the api section of the esphome config…

Edit - i take it the forum’s on a go slow, @nickrout’s post wasn’t there for me when I posted!

i have been having a major problem getting the ESP32 to connect in esphome. When I run the log file it fails to connect. That is why I asked about the port .

So it connects to wifi but then home assistant cannot connect to port 6053 in the esp?

If you have logs, why not post them, its the normal thing to do when debugging.

No, not quite right.
The ESP32 is seen in my router DHCP client list,and I have added its’ IP address to the reserved section.
When I add esphome as an intergration, then add the ip address, press submit, I get this:
Can’t connect to ESP. Please make sure your YAML file contains an ‘api:’ line.
It does contain an api line.

  name: comp_led
  platform: ESP8266
  board: nodemcuv2

  ssid: "TP-LINK_2.4GHz_3AB2AF"
  password: "mypass"
  # Optional manual IP

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Comp Led Fallback Hotspot"
    password: "TqOEt5ZXyaLP"


# Enable logging

# Enable Home Assistant API
  port: 6053
  password: 'mypass'
  reboot_timeout: 15min


My comp_led.yaml log :
NFO Reading configuration /config/esphome/comp_led.yaml…
INFO Starting log output from using esphome API
INFO Connecting to (
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to [Errno 111] Connection refused). Re-Trying in 1 seconds
INFO Connecting to (
WARNING Initial connection failed. The ESP might not be connected to WiFi yet (Error connecting to [Errno 111] Connection refused). Re-Trying in 1 seconds

The ESP32 is connected to my computer by USB cable, if it makes any difference

The problem is not the port number, unless you have set up some sort of wifi LAN firewall but you’d know if you had. With my modules, my api section only contains the password, and it works fine on the default port 6053.

What happens if you disconnect from the USB cable and run the ESP by itself? Also, if you don’t need external access for any reason, remove the Virgin Media DNS server entries.

1 Like

I have decided to return the device as its not going to happen for me. This is the 3rd device I have tried and non of them have connected to my network.
I have disabled my firewall and reflashed the ESP, but still no connection.

Thanks anyway

So you should get a log through your serial connection.

Ok but how or where do I get the serial connection. There is only a usb port on the ESP32, and as far as I can see no serial connection in or on the HA .

You flash it the first time over the usb serial connection.

Ok so you mean by using a usb cable?

Yes that is right. It’s how you do the first flash remember :slight_smile:

Ok I have flashed the ESP32 using NodeMCU-PyFlasher, with a downloaded bin file from HA, then tried adding the ESP32 by integration, now the ESP32 can’t connect., and I can’t ping its ip address either now

Also when I run a serial monitor on an arduino IDE I get lines like this scrolling up the screen, and the led on the ESP32 constantly flashing:

09:20:31.763 -> 1162 mmu set 00080000, pos 00080000
09:20:31.796 -> 1162 mmu set 00090000, pos 00090000

Just out of interest, when in HA, my ESP32 couldn’t connect to, where is that port number it is looking for.


Flash it with ESPhome - that’s the software you’re trying to use and that’s why homeassistant is trying to reach it on port 6053.

If you’re using homeassistant, there is an esphome addon. All you have to do is connect the board via USB to your homeassistant host computer and select flash by USB from the dropdown.

In my homeassistant, the top right dropdown only has OTA, no other option.

Thanks anyway

Have you plugged the board into the USB port? If you’re running in some kind of virtualization you’ll need to pass the USB port through.

Thanks, but the ESP32 is kaput after flashed it with NodeMCU, and it was not recognised in HA / esphome.
I have ordered another one.