How to upate Home Assistant Core?

I installed home assistant core on Raspberry OS per the getting started guide. (This may have been mistake #1 as I’m not really an ‘experienced user’. More… adventurous or stupid I guess.

I noticed early on that I don’t have an addon store, a supervisor option. When looking for a backup solution (with no addon available) someone said I should just do it manually. Fair enough, I installled duplicity-S3, found the location of the config folder and added a cron job. Good stuff.

Now I see that a new update is out and I go looking for the update button. er… no - i google and find https://www.home-assistant.io/common-tasks/os/ which gives two options to update…the first directs me to the Supervisor panel (which I don’t have)… and the second gives me the CLI ha command. So I ssh in and get ha command not found. Maybe I have to run this from the Python venv enviroment… so I get in there and run it… same problem.

So my question is … how on earth do I do an update to my home assistant core configuration? (I’ve put a lot of hours into setting up Mqqt intergrations and automations so I’d really not want to start fresh with Home Assistant Operating System (though I guess I might have to).

Thoughts appreciated.
Cheers
Bill

Office top of my head you activate your venv and type

pip3 install homeassistant --upgrade

Or something very similar.

1 Like

The official syntax was

pip3 install --upgrade homeassistant

It used to be nicely explained in the docs. It was all deleted about 3 weeks ago in some ‘getting started update’. Here’s one of the relevant old files:

Now, you’re on Raspberry Pi OS and use HA Core in a venv. If you just went ahead and updated, then you would run into Python version problems, as the Python version that comes with Raspberry Pi OS is not compatible with HA anymore. You will have to backup your configuration, delete your old venv, update Python (usually by manually recompiling it), create a new venv using the new Python, reinstall HA and finally restore your configuration.

If you want to go this way (it’s easier than it sounds), there are lots of guides on the internet that explain how to update Python. Alternatively, you can migrate to one of the other, easier HA installation methods.

2 Likes

Thanks so much for this … it’s great to get some definitive direction - instead of guessing.

Just a followup. You describe the issue of Python version conflicts. I sort of get that… unlike HA OS and the Docker option - Python and Home Assistant aren’t ‘bound’ in a container. But I guess I only have to worry about this if the new release of Home Assistant is using an upgraded Python version (or if I upgrade - which I would’nt since its a dedicated Pi).

But how would I know what version Home Assistant is expecting? Python 3.8.0 is from 2019 and that’s the version we were directed to in the installation. I believe the latest Python release is 3.9.2. Maybe just try the upgrade without touching Python and see what happens?

Cheers and thnks again.

Here are the steps to update HA in a venv (old but I think they are still valid):

$ sudo systemctl stop [email protected] 
$ sudo su -s /bin/bash homeassistant
$ source /srv/homeassistant/bin/activate
$ pip3 install --upgrade homeassistant
$ exit
$ sudo systemctl start [email protected]

If necessary change the user “homeassistant” in the second line to whatever user you used to install HA.

10 Likes

Well, it was moved to a common tasks page :wink:

Which happens about every December. So this coming December you’ll need to ensure you’re on (at least) 3.9.x with that venv.

Follow the release notes :wink: They tell you in advance when a Python version is being deprecated, and then the last release to support it also tells you.

Of course, if you switch to running HA Container (aka HA natively in Docker) all these problems vanish :wink:

(me, I’m still running Core, but I’m more than a little at home on *nix)

1 Like

Yes, indeed it was ! My bad. Maybe it was just a little late yesterday, but I was unable to find this page anywhere obvious. It is not linked in the official new HA installation guide (I checked the RPI and the generic Linux guides) and Google didn’t seem to have indexed it in any obvious way either. Anyway, good to know it didn’t vanish :grinning:

I wouldn’t worry, some of us have been here for years and can’t find half of the things we want to direct people to in the documentation any more since it was refactored.

I actually tried to find it in the documentation myself to point you to and couldn’t, hence why my post started “off the top of my head…”

1 Like

The instructions were nice and clear and only took 10 minutes to execute.

Home Assistant 2021.3.1

Thank again for the great responses.

I might open a new topic on migrating from Core to HA OS (if I can’t find a write-up). Just to have in my back pocket… lol. I imagine it’s just a question of pulling my backed up config folder to a new install.
Cheers.

Yup. That’s all there is to it when migrating between any install method. If you’re moving between versions that supports snapshots you can obviously use those, but your config folder is all that matters for HA itself.

… Make sure to get ALL of your configuration directory including the hidden items.

I did eventually migrate to Home Assistant OS. I fiddled a bit with the restoring the configs but I ended up just recreating things and using the core configuration to just remind me of stuff I’d done. It just seemed cleaner that way since I was having to deal with environmental changes like IP address - and using the MQQT addon (instead of having it external).
One thing that did occur to me was that I guess you need to put in the ssh/cli addon first in order to be able to resore your config.