Automatic or script driven updating

So, I’ve finally stopped fiddling with my HomeAssistant configuration so I’ve set it to run via systemd.

I know the code below won’t work, but I’m wondering is it possible to get a script to do updates for me with something like:

script:
    update_script:
        sequence:
            - shell_command:
                run_update: 'pip3 install --upgrade homeassistant && sudo systemctl start home-assistant@pi'

I would advise against it.
A new release can have breaking changes. If you update without reading release notes - you HA instance might become broken.

I would probably have it as a script, so I would still trigger it manually.

I would also like to see something similar…

You could use something like this

#!/bin/bash
oVer=$(curl -s https://home-assistant.io/| grep -o '<h1>C.*</h1>'|sed 's/\(<h1>Current Version: \|<\/h1>\)//g')
lVer=$(cat /root/.homeassistant/.HA_VERSION)
if [ "$oVer" != "" ] && [ "$oVer" != "$lVer" ] ; then
/usr/local/bin/pip3 install --upgrade homeassistant
/usr/sbin/service home-assistant@root restart
curl "https://api.simplepush.io/send/XXXXXXX/Hass Update! https://home-assistant.io/blog/" >/dev/null 2>&1
fi

Maybe this works with shell_command?

shell_command:
  hass_update: 'pip3 install --upgrade homeassistant && sudo systemctl start home-assistant@pi'

automation

- alias: Update hass
  trigger:
    platform: whatever
    entity_id: whatever
#  condition:
#    condition: whatever
  action:
    service: shell_command.hass_update
1 Like

How ironic is it that automation software doesn’t automatically update itself? :slight_smile:

this works on virtual env?

1 Like