ESPHome device shows offline but connected when I check my router

I can’t seem to understand why the ESPHome device I is listed in my routers wifi connections but ESPHome sees it as offline. The only way to fix it is to reboot the router but this happens everytime the ESP device loses power.

Is there a way to fix this?

In the EspHome addon log it shows: edit?configuration=sprinkler_system.yaml (0.0.0.0) seems as if the IP is messed…

Device code:

esphome:
  name: sprinkler_system
  platform: ESP8266
  board: nodemcuv2
  includes:
    - shift_register_switch.h
  libraries:
    - [email protected]

wifi:
  ssid: "wifi_spot"
  password: "password"

switch:
  - platform: custom
    lambda: |-
      std::vector<switch_::Switch *> switches;
      for(int i = 0; i < 8; i++) {
          auto zone_switch = new ShiftRegisterSwitch(i);
          App.register_component(zone_switch);
          switches.push_back(zone_switch);
      }
      return switches;

    switches:
      -  name: "Sprinkler Zone 1"
         inverted: yes
      -  name: "Sprinkler Zone 2"
         inverted: yes
      -  name: "Sprinkler Zone 3"
         inverted: yes
      -  name: "Sprinkler Zone 4"
         inverted: yes
      -  name: "Sprinkler Zone 5"
         inverted: yes
      -  name: "Sprinkler Zone 6"
         inverted: yes
      -  name: "Sprinkler Zone 7"
         inverted: yes
      -  name: "Sprinkler Zone 8"
         inverted: yes

status_led:
    pin: 16

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

text_sensor:
  - platform: version
    name: esphome_sprinkler_system_esphome_version

Try using a static IP in your configuration. You could also try pinging “sprinkler_system.local” to see if mDNS is working properly. mDNS is how esphome determines if devices are on/offline, be default.

2 Likes

And if the suggestion from iridris isn’t working, you can set the option status_use_ping in the settings of your ESPHome installation (howeve you installed it). This changes the way ESPHome is looking for your device (with IP and not mDNS).

3 Likes

The static ip in the config did the trick, tks!

2 Likes

from HA yellow
image

from my pc

Pinging eh-switch-sonoff-m5-32ae70.local [192.168.50.121] with 32 bytes of data:
Reply from 192.168.50.121: bytes=32 time=479ms TTL=255
Reply from 192.168.50.121: bytes=32 time=71ms TTL=255
Reply from 192.168.50.121: bytes=32 time=91ms TTL=255
Reply from 192.168.50.121: bytes=32 time=127ms TTL=255

wifi signal is … OK thought the ping i ms seems quite high [23:22:15][C][wifi:367]: Signal strength: -52 dB ▂▄▆█

config

substitutions:
  hostname: eh-switch-sonoff-m5

esphome:
  name: $hostname
  comment: EH Shop Switch 2btn sonoff
  name_add_mac_suffix: True

wifi:
  use_address: 192.168.50.121

show as offline in eshome

name_add_mac_suffix is not resolved by the dashboard (makes sense)

1 Like

I know this thread is old, but if someone encounters this problem do the following:
-assign a static IP address to the ESP Device then define its address in the config
-remove the line „name_add_mac_suffix” from the config

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.0.123
    gateway: 192.168.0.1
    subnet: 255.255.255.0
2 Likes

The issue for showing a device as offline in the esphome dashboard (while it is online and working) has two valid solutions:

  • fix mDNS in your network (Frequently Asked Questions — ESPHome)

    By default ESPHome uses mDNS to show online/offline state in the dashboard view.

  • set status_use_ping

    Alternatively, you can make esphome use ICMP pings to check the status of the device with the Home Assistant add-on "status_use_ping": true

2 Likes

Since you sound really confident about the valid solutions, can you tell me why my online device is still showing offline?

I have status_use_ping: true, and the status detection in esphome dashboard worked fine until I added a second device. Connection to device works fine, including viewing the logs wirelessly (from the esphome dashboard, ironically). I have since removed one of the devices, but nothing changed.

Both devices were unique in every aspect, IP, hostname, api key and ota password, so I’m just clueless.

There is also another issue, where it shows the update button (and HA notification) when the device has an esp firmware update available, but it doesn’t go away after pushing the update to the device. So, I’m wondering if there are some general issues in the whole device status thing in esphome.

I am neither confident nor knowledgeable but I have had everything go wrong at one time or another… so far I have found a fix for everything … however I usually sleep on the problem… do some more reading and find a solution on here somewhere!! For the nodes which showed as offline… I think I didn’t pursue it but eventually a new flash, firmware update and reboot sorted it… and worse case was a complete nuke of the dashboard and folders. A post of your yaml might be a good place to start.

Clearly there is, because ESPHome devices do not work like any other device. They’re not cable of stable MDNS and according to forum, require static IPs, which is a silly to suggest.

I forgot to get back to this, because I eventually switched from home assistant OS to core + esphome and the issues just went away. Same configs and all, so my guess now is that it had something to do with containers. And yes, they had (and have) static IPs

I’m on HASSOS+esphome and the problem persists.

1 Like