Upgrading Home Assistant

I run Home Assistant Core on a Raspberry Pi. I installed it in a Python venv and now and then I feel a need to upgrade. Today was such a day.

So, having backed everything up, I went for the plunge. Let’s install version 2025.1.2.

The usual dance goes a bit like this:

sudo systemctl stop homeassistant
sudo su homeassistant
cd /opt/homeassistant
source bin/activate
pip install --upgrade homeassistant
exit
sudo systemctl start homeassistant

Then all the dependencies are installed, so I usually go for a coffee, and once things have settled down (I use top to check that the system is idle), I usually restart homeassistance, just to make sure that it stops and starts nicely.

This time, I had no such luck. Lots of little issues. The major one seemed to be that import av in one of the core modules suffered from some sort of ValueError exception.

Having duckducked the issue for a while, I realized this meant that I had to do the upgrade from Python 3.12 to 3.13. Upgrading va to version 14.x using pip does not help. Since I always forget how to do this, I’m now writing this blog post.

Recollecting the steps, the moves are, more or less these:

sudo apt-get install python3.13 python3.13-venv python3.13-dev
sudo systemctl stop homeassistant
sudo su homeassistant
cd /opt/homeassistant
mkdir old
mv bin/ cache/ include/ lib/ lib64 LICENSE pyvenv.cfg share/ old
python3.13 -m venv .
source bin/activate
pip install homeassistant
exit
sudo systemctl start homeassistant

Again, restarting Home Assistant takes a while and a bit more since all the dependencies are built. Go grab a snack or just a quiet coffee and, viola, you will end up with a fresh install of Home Assistant version 2025.1.2

4 thoughts on “Upgrading Home Assistant”

  1. why use top to deduce the successful restart when you can create an automation in home assistant that sends a notification when it starts?

  2. Interesting post, since usually one does not read anything about HA or iobroker etc on the planet. Indeed I have an iobroker instance running connected to the heat pump also via raspberry pi. What raspi do you have exactly for HA? What version, what RAM? Next time, I’d opt for HA as well, but since everything is up and running with iobroker right now, it would mean a lot of work to migrate.

  3. I used to run HA the same way, but realized that there are better ways to spend time. So I switched to running it in a container, which together with podman-auto-update service works really well. Yes, I had to give up some control and efficiency, but it seems worth it. I haven’t looked at automatic post-upgrade verification, but at least plan B if upgrade goes wrong is to revert to previous hash (which is printed in the logs). Would be also nice to set up automatic snapshotting of data volume before update, but it’s for the future.

  4. I just needed a way to see when things calmed down (all the dependencies are installed) – no need for notifications or such.

Comments are closed.