ESPHome devices are not available right after poweron

When Tasmota device powers up it immediately connects to the MQTT broker and sends first message that it is available. HA gets this from MQTT promptly within milliseconds.

ESPHome doesn’t work this way. HA itself connects to the ESPHome device via API. When the device is not running and HA tries to connect API then it takes time until connection times out. HA retries indefinitely but there are also retry timeouts and it takes time when HA sees the device. It may take seconds before user can see and control the ESPHome device.

As long as HA is usually more stable than EPHome device, we need some sort of direct notification from ESPHome device to HA when it boots up. MQTT is a good candidate for this functionality but this needs changes in both platforms to keep API still in use in parallel with MQTT notification functionality.

For example, this would be very useful for lights that are still switched on/off by regular switches in addition to HA automations.

This doesn’t need MQTT at all.

Devices could be teached to connect back on startup (e.g., using an ESPHome configuration).

Another improvement is in the ESPHome integration itself, it could trigger DHCP or mDNS advertisements to reconnect sooner (which would be practically instantly).

Those mDNS and DHCP advertisements are already handled by the integration, but don’t trigger a reconnect in case nothing changed (so that is where the possible improvement is at).

…/Frenck

mDNS and DHCP works only when the LAN is the same. In most cases, it’s anyway a good idea to put HA to the same LAN (auto discovery etc) but this is not always possible.

Some router integration can also read DHCP, ARP or similar info but these integrations poll routers and don’t get this info instantly. API reconnect still works much faster usually.

Anyway, it is good to know if some work is going on because this is the main reason I still keep Tasmota running in multiple devices.

That is. That said, if running an advanced network like that, Home Assistant will still assume you are able to handle those cases yourself. It will not be just ESPHome that will cause issues if you don’t set this up fully.

It already does that, but it obviously doesn’t work unless they are on the same network :scream:

One way to improve this would be to hard code the ha ip address and a set of credentials per device in the api field and have it ping ha with its ip when it boots to tell it to reconnect now. But that sounds painful to maintain for everyone.

Oh! Nice! Missed that one :tada: :heart:

What do you mean by painful to maintain? Do you mean the HA IP address in ESPHome device config? It should be optional anyway and used only in case it is necessary. But I can understand that this is not a priority at all now when the same LAN already works. Still would be nice to have something for such functionality in the future.

Yes, and creating credentials for each esp to allow it to ping HA. Maintaining the credentials and config for all of your esphome devices would be not so fun especially if the HA ip ever changes