Allow Deep Sleep ESPhome Devices to install updates using HA

Currently Deep Sleep enabled esphome devices cannot be updated using HA automations or HA, because the devices just won’t show the option to update it in this case.

https://github.com/home-assistant/core/blob/33016c29770de12ea62e9df701be86c56a345b33/homeassistant/components/esphome/update.py#L163 and
https://github.com/home-assistant/core/blob/33016c29770de12ea62e9df701be86c56a345b33/homeassistant/components/esphome/update.py#L129C33-L129C47 prevents ESPHome deep sleep enabled devices to show the update available state or update action.|

I want to update those devices as well. Currently I can disable deepsleep using a switch helper when the deepsleep device wakes up (every 12 hour at least).
I could automate (given HA allows for updating those devices):

  • disable deep sleep if a esphome device needs an update.
  • execute the update if it becomes online
  • check if the version is up-to-date > disable the disabledeepsleep switch > put in deepsleep again

I understand that it might make people scratch their head when they try to manually (in the HA UI) update the device if it is not online (It will not work). So somehow making this change opt-in would be great.

Maybe a global setting on ESPHome integration could do the trick, or just some device configuration in ESPHome yaml?
Anyhow I wanted to post it here as it seems it need code changes on this end as well.

I can look into making a PR myself, but first we need to decide what route makes most sense.

  1. Globally enabled deepsleep devices to show update (behaviour change)
  2. Allow Esphome integration to set a flag to enable updates on deep sleep devices
  3. Extend ESPhome device yaml to include a flag to explicit enable it in combination with deep sleep.

Open for suggestions/feedback