Core: More and more ESPHome devices are falsely disappearing / are offline, but esphome logs shows no errors

Created on 14 Aug 2020  路  19Comments  路  Source: home-assistant/core

The problem


Since about 1 month I'm losing more and more ESPHome devices (which worked fine before) - they suddenly show as offline / not available - even though I can see in the esphome logs that they are connected successfully and report valid data (also the report data api calls are working fine, no errors occuring on the esphome side).

Right now I restarted my home router, and now I have multiple devices with this problem - esphome logs show no issues - but none of the devices are available in the home assistant UI.

I can also ping my devices outgoing from the home assistant server (f.e. via ping t1.local and I can connect the esphome device successfully via telnet).

I deleted the entries and added them again via the integrations UI, but the still keep appearing offline :(
Also tried to delete the corresponding files in the .storage folder, still doesn't work - devices are appearing offline :(

Environment

  • Home Assistant Core release with the issue: 0.114.0
  • Last working Home Assistant Core release (if known): don't know, since about 1 month
  • Operating environment (OS/Container/Supervised/Core): Linux native
  • Integration causing this issue: Esphome
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml

# no sepcial configurations

Traceback/Error logs

unfortunately there are no error logs, neither on the esphome side (via debug log level), nor in the home assistant log.

Additional information

Maybe this is related: https://github.com/esphome/issues/issues/1237 ( but I don't think so, i didnt change any hardware / firmware, only restarted my router and they went offline permanently after router restart).

esphome

All 19 comments

Please post the esphome config entries from your .storage

Do you have any zeroconf errors in the log?

{
    "data": {
        "binary_sensor": [
            {
                "device_class": "connectivity",
                "is_status_binary_sensor": true,
                "key": 2336923543,
                "name": "sonoff_4ch_pro Status",
                "object_id": "sonoff_4ch_pro_status",
                "unique_id": "sonoff_4ch_probinary_sensorsonoff_4ch_pro_status"
            }
        ],
        "device_info": {
            "compilation_time": "Aug 14 2020, 01:17:05",
            "esphome_version": "1.15.0b3",
            "has_deep_sleep": false,
            "mac_address": "60:01:94:CD:31:37",
            "model": "PLATFORMIO_ESP01_1M",
            "name": "sonoff_4ch_pro",
            "uses_password": true
        },
        "sensor": [
            {
                "accuracy_decimals": 0,
                "force_update": false,
                "icon": "mdi:wifi",
                "key": 1429661895,
                "name": "sonoff_4ch_pro WiFi Signal sonoff_4ch_pro",
                "object_id": "sonoff_4ch_pro_wifi_signal_sonoff_4ch_pro",
                "unique_id": "600194cd3137-wifisignal",
                "unit_of_measurement": "dB"
            },
            {
                "accuracy_decimals": 0,
                "force_update": false,
                "icon": "mdi:timer-outline",
                "key": 3693893301,
                "name": "sonoff_4ch_pro Uptime",
                "object_id": "sonoff_4ch_pro_uptime",
                "unique_id": "600194cd3137-uptime",
                "unit_of_measurement": "s"
            }
        ],
        "services": [],
        "switch": [
            {
                "assumed_state": false,
                "icon": "mdi:timer",
                "key": 1264226659,
                "name": "sonoff_4ch_pro Schalter 1",
                "object_id": "sonoff_4ch_pro_schalter_1",
                "unique_id": "sonoff_4ch_proswitchsonoff_4ch_pro_schalter_1"
            },
            {
                "assumed_state": false,
                "icon": "mdi:water",
                "key": 1264226656,
                "name": "sonoff_4ch_pro Schalter 2",
                "object_id": "sonoff_4ch_pro_schalter_2",
                "unique_id": "sonoff_4ch_proswitchsonoff_4ch_pro_schalter_2"
            },
            {
                "assumed_state": false,
                "icon": "mdi:power",
                "key": 1264226657,
                "name": "sonoff_4ch_pro Schalter 3",
                "object_id": "sonoff_4ch_pro_schalter_3",
                "unique_id": "sonoff_4ch_proswitchsonoff_4ch_pro_schalter_3"
            },
            {
                "assumed_state": false,
                "icon": "mdi:reload-alert",
                "key": 1264226662,
                "name": "sonoff_4ch_pro Schalter 4",
                "object_id": "sonoff_4ch_pro_schalter_4",
                "unique_id": "sonoff_4ch_proswitchsonoff_4ch_pro_schalter_4"
            }
        ],
        "text_sensor": []
    },
    "key": "esphome.f532dd83504c4f659c91b5ab5fca0d5e",
    "version": 1
}

No, no errors about zeroconf. I'm also not using MQTT (in general), only the native esphome api connection.

Actually the only log errors are:

2020-08-14 01:28:45 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform esphome does not generate unique IDs. ID sonoff_4ch_probinary_sensorsonoff_4ch_pro_status already exists - ignoring binary_sensor.sonoff_4ch_pro_status

But these have been appearing since a long time (multiple months), and should not be a problem as far as my experience was until now ( reference: https://github.com/home-assistant/core/issues/33649 )

Sorry for the lack of clarity, there should be an entry for the device in .storage/core.config_entries. This is the one that will be the most helpful.

@h0jeZvgoxFepBQ2C Check your ip addresses of your esphome devices. This same exact thing happened to me and it was caused by my router giving a different ip address to my ESPHome devices via DHCP. You'll either want to set a static ip address on the devices or make sure the hostname of the devices can be resolved by homeassistant.

@meichthys thanks for the hint! I realized that some devices were bound via IP, not via hostname.local.. But changing it and restarting home assistant didn't have any effect unfortunately.

Right now I have following entry:

            {
                "connection_class": "local_push",
                "data": {
                    "host": "sonoff_4ch_pro.local",
                    "password": "mypw123",
                    "port": 6053
                },
                "domain": "esphome",
                "entry_id": "acf44817efe34341a3545989412a53c4",
                "options": {},
                "source": "user",
                "system_options": {
                    "disable_new_entities": false
                },
                "title": "sonoff_4ch_pro",
                "unique_id": null,
                "version": 1
            },

I can ping and telnet sonoff_4ch_pro.local on my server 馃

@h0jeZvgoxFepBQ2C Have you tried using the ip address of the device in the host field?
I was seeing the exact same behavior as you. I could ping the device via sonoff_4ch_pro.local, but using that hostname wouldn't work. I ended up having to assign a static ip address to the devices via my router and then put that ip address in the host field. Then, after a reboot things showed up fine.

@meichthys Hm, unfortunately it doesn't change anything. The strange thing is also, that I have some entries specified with "xyz.local" - and some with the IP address. But it's not determinist which of the descriptors work - I have some working with .local and IP, and some not working with .local and IP. :(

@h0jeZvgoxFepBQ2C yeah, there's definitely something off. I still have a few devices that have been acting up and have seen the same thing where some '.local' devices stay connected and others don't. Ip addresses all seem to be working for me except one. I've noticed similar issues with other integrations. So I'm wondering if it isn't something to do with the supervisor.

Hey there @ottowinter, mind taking a look at this issue as its been labeled with an integration (esphome) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

This seems to be fixed for me.
I'm not sure if it was something i changed or if it was an update to ESPHome/Homeassistant/Supervisor.

Can't confirm it, I updated already to the latest versions days ago and I still have the same problems :(

Ok, strange.. At least one device is now online again, the others are still offline. No changes to firmware or network setup... both are registered via "xyz.local" and not via IP in the .storage/ entries file, so it looks like there is really a small fix at least for some devices...

Are you on 0.114.3?

Ok, it really looks like 0.114.3 improved the situation. All my devices are now connected again (some of them I had to completely remove from my .storage/ files and re add them as intergrations - but at least it works now 馃憤

Thank you so much for this fix! 鉂わ笍

I have this issue when reassigning IP of my nodes.
I found that a restart of Home Assistant fixes this, but it would be nice to not restart just for this.
It seems the device is stored with it's hostname when you add a new device and when HA is restarted, it goes back to use IP address instead.

Is this behavior normal or is it a bug ?

I can confirm this behaviour.. you add it via hostname, but in the config files it is stored with the IP address. Thought this is intended, but maybe this is a bug?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piitaya picture piitaya  路  3Comments

sogeniusio picture sogeniusio  路  3Comments

kirichkov picture kirichkov  路  3Comments

flsabourin picture flsabourin  路  3Comments

TheZoker picture TheZoker  路  3Comments