alfwro13
(Andre W.)
October 7, 2022, 7:54am
1
It would be great if ESPHome automatically handled updates for devices that go to sleep.
It could work something like this:
In ESPHome - mark device to auto-update next time it is online
on the device itself have a config section that would say, next time you are online (or once a day or at specific time, or once a week, etc) check with the server if there are updates and if they are install them then go to sleep.
I know that there are workarounds involving MQTT or scripts but this should not be this complicated.
mmiller7
(Matt Miller)
November 28, 2022, 11:24pm
2
Or an alternative, would be nice if you could call a service to do it. Then you could do it on demand from an automation.
gdam12886
(Gdam12886)
December 17, 2022, 8:57pm
3
It is a bit of workaround but I built a service to automate firmware update of devices.
First you will need the the SSH & Web Terminal addon. This Guide was also very helpful in setting up the ability to use the shell command.
Next you need a shell command to run the update:
shell_command:
esphome_update_device: ssh -i /config/.ssh/id_rsa [email protected] “sudo docker exec -t -w /config/esphome addon_5c53de3b_esphome sh -c ‘esphome run {{device}}.yaml --device OTA --no-logs’”
Now you can run the service:
service: shell_command.esphome_update_device
data:
device: smartplug1
Additionally, I added a service call to the device’s configuration so that is shows under the device integration.
button:
- platform: template
name: “${friendly_name} Update”
entity_category: config
device_class: update
on_press:
- homeassistant.service:
service: shell_command.esphome_update_ device
data:
device: ${device_name}
Jpsy
(Jörg Wagner)
June 20, 2024, 12:32pm
4
This is now possible since ESPHome 2024.6 through: ota.http_request.flash
I also opened a discussion how to best use this new feature:
ESPHome 2024.6 has been released and with it the new option to poll new firmware OTA instead of pushing it from the ESPHome dashboard in HA:
ota.http_request.flash
While this is surely interesting to update devices in foreign networks (i.e. commercial devices with an option to update), my personal interest is mainly to improve my own update procedures for my deep sleep devices. Such devices are usually sleeping when you try to push a new firmware to them and so the update fails. The usual solu…