This is only a brief note on how I resolved an issue updating some static ESPHome configurations on my devices. I rarely do updates to this software, mainly because my devices are VLAN’d off, isolated from the wider network and most changes don’t bring new functionality or features to the devices I have. But I do update it every few months and occasionally there are breaking changes made to the config definitions, and these are to be expected. However, in some cases, the changes result my devices being “stuck” in a bad state. I believe this is at least partially due to the use of packages, but I haven’t verified this fully.
The situation is basically the following: an update needs to be made to a external package for the configuration to compile, and this change is uploaded, but the local copy of the packages in ESPHome can only get refreshed if the configuration can compile (as I currently understand it). I could be wrong about that last part, but I’ve waited around for some time and didn’t see it resolve on it’s own.
So this, more or less, results in the device being unable to update. Unfortunately there is no button or UI element that I can see which will force a package refresh. Best as I can tell, you need to SSH into the device to manually refresh things and the mechanism for this changed sometime in the past year or so. I’m also running the Home Assistant OS (HAOS), which runs ESPHome addon as a Docker container; this information may vary for other installation methods.
Previously, you could use the SSH server addon (Terminal & SSH) and find the relevant files in the /config folder I believe. However, the local cache for these was moved elsewhere, and the new path doesn’t seem to be mounted in the addon_core_ssh
container. On my system, I need to SSH into the actual HAOS system as root, the process for enabling this is described in Debugging the Home Assistant Operating System.
From there, you can docker exec
into the ESPHome container (eg: docker exec -it addon_<ID>_esphome /bin/bash
). From there, you’ll need to go to /data/packages
and then to each of the subdirectories listed; they will be named as some hash string, and each will correspond to a particular package. In my case, I would go into each of these and run a git pull
, which performed the necessary update and afterwards I could successfully compile the configurations for each of my devices.
I found this information via the Home Assistant Community Forums at some point (which can be immensely helpful), but lost the link to the actual thread. I’m noting this down for my reference, and sharing in case it helps others. There’s probably a lesson for me in here to switch over to OTA updates, but my version works well-enough and I think this is only the second time I hit this problem.
For a quicker reference, these are basically the necessary commands – again, on my system:
$ ssh root@homeassistant -p 22222
# docker exec -it addon_<hash>_esphome /bin/bash
# cd /data/packages
# cd <hash-1>
# git pull
# cd ../<hash-2>
# git pull
...
Leave a Reply