Update Home Assistant Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
sytone
Posts: 6
Joined: Wed Jul 19, 2017 4:05 am

Re: Update Home Assistant

Post by sytone »

I just updated to 160 and installing docker, going to play with Hass.IO on it and see if it is work adding this as a install option.
baz123
Posts: 166
Joined: Thu Jan 12, 2017 9:23 pm

Re: Update Home Assistant

Post by baz123 »

sytone wrote:I just updated to 160 and installing docker, going to play with Hass.IO on it and see if it is work adding this as a install option.
I did this on a V158 image and it worked great.

https://community.home-assistant.io/t/d ... s-io/40622
Narfel
Posts: 17
Joined: Wed Jan 31, 2018 10:19 am

Re: Update Home Assistant

Post by Narfel »

Thanks Sparky, the script works like a charm. I'm on an rpi0w/dietpi running mosquitto, samba and home assistant. Since 6.2 all of those work flawless. Before i had problems with mosquitto, but that has since been resolved due to a new binary for arm6l.
Sparky wrote:Using systemctl with HomeAssistant that was installed with the DietPi menu system requires referencing the service as:
home-assistant
So:
systemctl stop home-assistant.service
will not work. This works:
systemctl stop home-assistant

Same story for systemctl start, restart & status.
I modified your code below with fixes, I can't currently test it since I'm running hass.io. When mosquitto, samba and home assistant installs are fixed for rpi0w, I will go back to dietpi.
sytone wrote:Here you go, there will be a homeassistant-update.sh in that directoy at some point, have not had time to get to it. Put this in a updatehs.sh file and run it.

Code: Select all

#!/bin/bash

HA_USER="homeassistant"
HA_USERROOT="/home/$HA_USER"
HA_SRVROOT="/srv/homeassistant"
HA_PYENV_ACTIVATION="export PATH=\"$HA_USERROOT/.pyenv/bin:\$PATH\"; export PYENV_VIRTUALENV_DISABLE_PROMPT=1; eval \"\$(pyenv init -)\"; eval \"\$(pyenv virtualenv-init -)\""
HA_PYTHON_VERSION="3.6.3"

echo "Stopping HA..."
systemctl stop home-assistant

echo "Updating HA"
su --shell /bin/bash --command "cd $HA_SRVROOT; $HA_PYENV_ACTIVATION; pyenv activate homeassistant-$HA_PYTHON_VERSION; pip3 install --upgrade homeassistant" $HA_USER

echo "Starting HA..."
systemctl start home-assistant

echo "Checking to see if up (Localhost must be in http trusted_networks)"
start=$(date '+%s')

until curl --silent --show-error --connect-timeout 1 -X GET -H "Content-Type: application/json" -k https://127.0.0.1:8123/api/ | grep -q 'API running'; do
    date '+[%Y-%m-%d %H:%M:%S] --- Home Assistant is starting, please wait...'
    systemctl status home-assistant
    sleep 10
done

dur=$(($(date '+%s') - start))

echo -e "\e[00;32mHome Assistant is ready! ($dur second delay)\e[00m"
Post Reply