We are using HassOS on Raspberry Pi 4, so there are 3 layer to keep updated:
- HassOS
- Supervisor
- Core
The goal is to have a zero touch system with the latest and greatest. To keep updating it is quite tedious.
The first 2 components are more stable, so auto-update approach for them seems appropriate. The core is trickier as major versions contain many breaking changes, so they require more attention. Minor versions for core seem also quite safe for auto-update mechanism.
We also have a daily backup (by the âGoogle Drive Backupâ add-on), which is a safety-net in case something goes wrong with the auto-update (which never happened for us).
Here is how we implemented the above:
automations.yaml
- id: ha_new_version
alias: ha_new_version
trigger:
- platform: state
entity_id: binary_sensor.home_assistant_versions_update_available
condition: "{{ int(states('sensor.home_assistant_versions').split('.')[-1]) == 0 }}"
action:
- variables:
message: >
Version {{ states('sensor.home_assistant_versions') }} is available.
The installed one is {{ states('sensor.current_version') }}.
- service: notify.mobile_app_amits_phone
data:
message: "{{ message }}"
- service: notify.gmail
data:
title: "Home Assistant New Version"
message: "{{ message }}"
- id: ha_new_minor_version
alias: ha_new_minor_version
trigger:
- platform: state
entity_id: binary_sensor.home_assistant_versions_update_available
condition: "{{ int(states('sensor.home_assistant_versions').split('.')[-1]) > 0 }}"
action:
- service: shell_command.update_core
- service: notify.gmail
data:
title: "Home Assistant New Minor Version"
message: >
Version {{ states('sensor.home_assistant_versions') }} was installed.
- id: update_ha
alias: update_ha
trigger:
- platform: time
at: "03:32:00"
action:
- service: shell_command.update_supervisor
- service: shell_command.update_os
configuration.yaml
shell_command:
update_core: 'curl -X POST http://supervisor/core/update -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)"'
update_supervisor: 'curl -X POST http://supervisor/supervisor/update -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)"'
update_os: 'curl -X POST http://supervisor/os/update -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)"'