ESPHome - Device not showing as Online (But it is)

I have an ESPHome device that I have moved to a new VLAN and it is up and running and available in HA. (So I don’t think there is anything wrong with my firewall rules)

However it will not show as Online in the ESPHome dashboard and hence I can’t reflash it

Is there anything I can do to force it to appear?
Other than to flash it again manually and try again.

I obviously wasn’t expecting to see much else but the error in the log might help someone know what is going on?

Thanks.


The logs…

INFO Starting log output from esp32-cam01.local using esphome API
WARNING Can't connect to ESPHome API for esp32-cam01.local: Error resolving IP address: [Errno -5] No address associated with hostname
INFO Trying to reconnect to esp32-cam01.local in the background

ESPHome Dahsboard…
image


Integration…


My router sees it perfectly well too…

The correct hostname resolution in the ESPHome dashboard is quite cumbersome.
For me the easiest and best way so far was to specify a dedicated IP address for my ESPHome devices with manual_ip and to specify with use_address that this IP adress should be used for connections.

This then looks like this, for example:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  reboot_timeout: 8hours
  ap:
    ssid: "${devicename}"
    password: !secret fallback_password
  manual_ip:
    static_ip: 192.168.178.200
    gateway: 192.168.178.1
    subnet: 255.255.255.0
  use_address: 192.168.178.200

Thanks, I’m not mad keen on giving static IP addresses to all my IoT devices as that seems like a huge admin overhead.

But in any case that won’t help me right now because I can’t change the config as I can’t reach the device to flash it. Except manually which I can do as it is a test device sitting on my desk. I just wondered if there was an alternative less fiddly than digging out my FTDI and some jumper cables (lazy? me?)

OK, The plot thickens…

I re-flashed it manually and gave it a different name test-esp32-cam

It joins the network and I ‘adopted’ it in HA and everything works except it is still not seen on-line by ESPHome.

Also using a basic network scanner it seems the device has not taken the name I gave it and also has had the last 3 bytes of the mac address of the device added to the (host)name despite not using

image


‘Wrong’ hostname:


Correct entity names:


I have no idea what is going on here but it feels like ESPHome doesn’t handle changes to device very well?

Anyone got any ideas, please?

I’d really like to move all my IoT devices to the new VLAN but it isn’t looking like ESPHome is going to make it easy for me!


#==================
#=== Substitutions
#==================
substitutions:
  device_name: test-esp32-cam
  friendly_name: Test ESP32-Cam
#==================

esphome:
  name: ${device_name}
  platform: ESP32
  board: esp32dev

wifi:
  ssid: !secret wifi_IoT_ssid
  password: !secret wifi_IoT_password
  fast_connect: True
  
  ap:
    ssid: ${device_name}_Hotspot
    password: !secret access_point_password

You can also download the binary with the changed config file and upload it wie the web dashboard of your esp device (If you have configured it).

I can’t see a use_address entry in your config

Why do I need that?
Isn’t that only for static IP?

EDIT:
Hang on… do you mean this?

image

Exactly the same outcome:

‘Wrong’ hostname (still includes part of the mac id)
Works perfectly inside HA
Doesn’t appear on-line in ESPHome dashboard

wifi:
  ssid: !secret wifi_IoT_ssid
  password: !secret wifi_IoT_password
  fast_connect: True
  use_address: test-esp32-cam.local

do you run ESPHome in a docker container (not add-on)?

if you do there is a setting to use to keep your devices as ‘online’. I had the same issue that some of my devices would show offline even when they weren’t and adding the setting to the ESPHome Docker command fixed it.

here is my whole docker command for reference:

sudo docker run -d --name="esphome" --restart=unless-stopped -p 6052:6052 -p 6123:6123 -e ESPHOME_DASHBOARD_USE_PING=true -v /home/finity/docker/esphome:/config esphome/esphome /config dashboard

if you use the add-on I can’t help you but I’m sure there has to be an equivalent function for use there.

No I don’t, I use the add-on.
But maybe there is a clue in there somewhere.
Thanks

1 Like

OK, I think it must have something to do with the VLANs.
I re-flashed to 192.168.1.x and it popped straight into HA and the ESPHome dashboard.

I still have some anomalies and questions though such as, why did it work on HA but not the ESPHome dashboard?

Anyway, consider this post closed (unless someone reading this far has an answer of course!!).
I’m going to start another one specifically about ESPHome and VLANs.

Thanks.

You must use an IP address and not a host name!
It looks like the hostname resolution does not work in your network. Then the easiest way is to address the devices directly via the IP address.

Yes, I think It’s been solved by allowing mDNS on my VLANs

Thanks.

A little bit late with the information, but I’ve just run into this. If you run the ESPHome as an addon in the configuration of the addon press the ‘Show unused optional configuration options’ and there is an option for ‘Use ping for status’.

2 Likes

this solved my problem.

If you are running ESPHOME in docker. You need this + mDNS. I run my devices in a separate subnet isolated from internet. Here is what i used:

version: '3'
services:
  esphome:
    container_name: esphome
    image: esphome/esphome
    volumes:
      - /home/esphome/config:/config  # your home dir path here
      - /etc/localtime:/etc/localtime:ro
      - /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket
    restart: unless-stopped
    ports:
      - "6052:6052"
      - "6123:6123"
    environment:
      - ESPHOME_DASHBOARD_USE_PING=true
    network_mode: host