ESPHome is not pinging and not accessable from HA with error "Can't connect to ESP"

I have configured HA on my Raspberry Pi Compute Module 4, it works fairly well and collects data from different devices.

But recently, I’ve decided to add ESPHome and have issues during adding a device with error “Can’t connect to ESP. Please make sure your YAML file contains an ‘api:’ line.”.

By direct access in the browser the ESPHome shows the log and data. Even the port is responding from the laptop.

But when I’m trying to ping the local IP from the terminal on HA – it’s not reachable.

The config of ESPHome is below:

  name: esphome-web-6ac0f2
  friendly_name: kitchen-dht

  board: nodemcuv2
    version: recommended

  level: DEBUG

    key: "w564zMwc43MNriycjYmy57nIF8rb3CgOnWyr+z6gryQ="

- platform: esphome


  ssid: !secret wifi_ssid
  password: !secret wifi_password


  platform: dht
  pin: D2
  model: AM2302
    name: "Kitchen Temperature"
    name: "Kitchen Humidity"
  update_interval: 60s

Screenshot of the ping and of the ESPHome in the browser attached. You can see in the log that I’ve tried to connect to the port 6053 from laptop with a command “nc -z -v 6053”.

I would be deeply thankful for the help.

Very interesting. I’ve found that if HA and ESPHome device are connected to the other router (AirRouter HP), then everything goes smoothly.

My main router is TP-Link AX1500 and I didn’t deny anything there, what may cause any issues with the network access between devices.

The only thing I did is defined on TP-Link AX1500 a static IP address for the HA.

sounds like there is some firewall setting on your other router. Do you have some guest network setting on?

No. I just had a fixed static IP address defined for HA on my router. After the removal it works now.

I’m still following how it’s going.

Why are you using two routers? You should stick to one router, two only complicates things unnecessary. Set one of them in AP mode if possible.

My apartment is large, and the main router located with fiber-optic cable located near the entrance. But on a balcony, I have a lot of monitoring equipment (air quality, radiation, etc.) and the Wi-Fi quality is poor, also some devices connected with Ethernet cable. So I’ve placed one more router on a balcony just for the devices there.

You should change the balcony router to be an access point if possible.