Those commands do work, but you may have to change it to reflect your install, as these commands assume you are running on a Raspberry Pi with the All-In-One installer
Here is what I run:
Stop HASS (just in case)
sudo systemctl stop home-assistant
Then copy and paste ALL of the following at once in the terminal:
sudo su -s /bin/bash hass <<‘EOF’
source /srv/hass/hass_venv/bin/activate
pip3 install --upgrade homeassistant==0.28.2
exit
EOF
It works well to put all of this into a bash script, with a variable input for the version number so that you can use this in future if you need to downgrade. I also have a script for this to upgrade easily as well:
The Upgrade Script:
Create a file called ha_upgrade:
sudo nano /usr/local/bin/ha_upgrade
Then paste the following:
#!/bin/bash
# Stop HASS
sudo systemctl stop home-assistant
# Become user 'hass'
sudo su -s /bin/bash hass <<'EOF'
# Activate the virtualenv
source /srv/hass/hass_venv/bin/activate
# Upgrade Home Assistant
pip3 install --upgrade homeassistant
exit
EOF
# Restart HASS
sudo systemctl start home-assistant
Then type CTRL-X, then Y and then Return
Then make it executable:
sudo chmod +x /usr/local/bin/ha_upgrade
Now you should be able to run the following from anywhere to upgrade:
ha_upgrade
The Downgrade Script:
Create a file called ha_downgrade:
sudo nano /usr/local/bin/ha_downgrade
Then paste the following:
#!/bin/bash
# Stop HASS
sudo systemctl stop home-assistant
# Become user 'hass'
sudo su -s /bin/bash hass <<'EOF'
# Activate the virtualenv
source /srv/hass/hass_venv/bin/activate
# Downgrade Home Assistant
pip3 install --upgrade homeassistant==$1
exit
EOF
# Restart HASS
sudo systemctl start home-assistant
(even though you are downgrading, you still need to include the --upgrade line. Its weird, but the install is going to “upgrade” all the dependencies, which in this case is actually upgrading to a previous version, so it seems counter intuitive, but it is necessary)
Then type CTRL-X, then Y and then Return
Then make it executable:
sudo chmod +x /usr/local/bin/ha_downgrade
Now you should be able to run the following from anywhere to downgrade:
ha_downgrade “0.28.2”