Error resolving IP address of new esp32 (esphome)

Hello Home Assistant community,
thanks you for having me!

I am really new with this, and going my way trough tutorials :slight_smile: (and I also understand that this is a 3rd party issue… but maybe someone had the same problem?).
I managed to have one ESP32 talk with Home Assistant (didn’t do anything with it yet, just uploaded the basic code so I could do OTA later). No issue whatsoever.
Then wanted to to the same with my second ESP32. I only changed the name of the node (esp32_02 instead of esp32_01).

For some reason, it doesn’t seem to see my wifi…

INFO Reading configuration /config/esphome/esp32_02.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/esp32_02
Processing esp32_02 (board: esp-wrover-kit; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10004.200129 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
Dependency Graph
|-- <AsyncTCP-esphome> 1.1.1
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.7
|   |-- <AsyncTCP-esphome> 1.1.1
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size /data/esp32_02/.pioenvs/esp32_02/firmware.elf
Checking size /data/esp32_02/.pioenvs/esp32_02/firmware.elf
RAM:   [=         ]  12.9% (used 42304 bytes from 327680 bytes)
Flash: [=====     ]  47.5% (used 871530 bytes from 1835008 bytes)
========================= [SUCCESS] Took 10.56 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of esp32_02.local
ERROR Error resolving IP address of esp32_02.local. Is it connected to WiFi?
ERROR (If this error persists, please set a static IP address: https://esphome.io/components/wifi.html#manual-ips)
ERROR Error resolving IP address: Error resolving address with mDNS: Did not respond. Maybe the device is offline., [Errno -5] No address associated with hostname

I did the exact same thing as for the first one, except for the name…
Any idea what I did wrong here?

Thank you!

Edit : Should I change the port somewhere? When I validate the yaml they have the same port, wondering if this might cause the issue. Not sure how to do that though…

I am going to answer to myself, in case other people have the same issue :wink:

So any extra esp32 I tried to add ended with the same (possibly mDNS related) issue. I found this page about static IP’s, but didn’t manage to create any connection here either.

After a bit of research I found ESPHome-Flasher… off course the disto listed doesn’t work on my Mac (Catalina), but installing it with pip from the command line worked.

I just want to share similar issue and how I resolved it. I have esp32 and use esphome within docker (dont forget about mapping usb device). I had errors like OP Error resolving IP address of pir_esp.local. Is it connected to WiFi? After this, I tried to set manual IP but then I got error No route to host. Here is my config

docker-compose.yaml

version: '3'
services:
  esphome:
    container_name: esphome
    image: esphome/esphome
    volumes:
      - /home/pi/homeassistant_new/esphome/config:/config
      - /etc/localtime:/etc/localtime:ro
    environment:
      - UDEV=1
    devices:
      - "/dev:/dev"
    restart: always
    privileged: true
    network_mode: host

pir_esp.yaml

esphome:
  name: basement

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: arduino

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  password: "pass"

ota:
  password: "pass"

wifi:
  ssid: "No wifi here"
  password: "secretpass"
  power_save_mode: none
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Basement Fallback Hotspot"
    password: "j3JsCttbOcXb"
  use_address: 192.168.0.230
  manual_ip:
    static_ip: 192.168.0.230
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 192.168.0.1
    dns2: 192.168.0.1

captive_portal:

binary_sensor:
  - platform: gpio
    pin: 13
    name: "PIR Sensor"
    device_class: motion

I was desperate BUT, I changed cable for another one (connecting esp32 with raspberry) and it worked! This config is valid also without setting manual IP.

Solution: Use cables that supports data transfer.