I wrote automation I’d like to share for thoughts, feedback and improvements.
The automation auto-updates to minor updates providing they match the same base version your running. It happens at 4am each day and only whilst someone is at home to provide a fail safe.
Whenever a new version becomes available and it matches your current installed version but is a bump from say .1 to .2 or .2 to .3 the update will run.
Usually each minor update to Home Assistant core beyond YYYY.MM.1 and above are bug fixes and minor improvements that shouldn’t cause any major breaking changes.
Interested to hear your thoughts and if it is helpful to anyone else.
alias: "[System] Auto-update home assistant to minor updates of same version"
description: >-
Triggers when there's a matching update with major.minor version, patch number
is 1 or above.
trigger:
- platform: time
at: "04:00:00"
condition:
- condition: template
value_template: >
{% set latest_version = state_attr('update.home_assistant_core_update',
'latest_version') %}
{% set installed_version = state_attr('update.home_assistant_core_update',
'installed_version') %}
{% if latest_version in ['unknown', 'unavailable', none] or
installed_version in ['unknown', 'unavailable', none] %}
false
{% else %}
{% set lv_parts = latest_version.split('.') %}
{% set iv_parts = installed_version.split('.') %}
{{
latest_version != installed_version and
lv_parts[0] == iv_parts[0] and
lv_parts[1] == iv_parts[1] and
lv_parts[2] | int >= 1
}}
{% endif %}
alias: Test if minor version update is available
- condition: state
entity_id: binary_sensors.house_occupied
state: on
action:
- service: notify.mobile_devices
data:
title: Auto update
message: >-
Starting auto update to {{
state_attr('update.home_assistant_core_update', 'latest_version') }}.
- service: update.install
metadata: {}
data: {}
target:
entity_id: update.home_assistant_core_update
enabled: true
mode: single