Skip to content

Instantly share code, notes, and snippets.

@MrEbbinghaus
Created July 16, 2024 13:55
Show Gist options
  • Select an option

  • Save MrEbbinghaus/14c5bce221ecf59234e75a89e0df20b1 to your computer and use it in GitHub Desktop.

Select an option

Save MrEbbinghaus/14c5bce221ecf59234e75a89e0df20b1 to your computer and use it in GitHub Desktop.
Home Assistant auto-update on patch
alias: HA core auto-update
description: Update HA core if there is a patch update
mode: single
trigger:
- platform: time
at: "03:00:00"
condition:
- condition: state
entity_id: update.home_assistant_core_update
state: "on"
- condition: template
value_template: >-
{% set current_version =
version(state_attr("update.home_assistant_core_update",
"installed_version")) %}
{% set latest_version =
version(state_attr("update.home_assistant_core_update", "latest_version"))
%}
{% set version_diff = (latest_version - current_version) %}
{{ diff.patch and not (diff.major or diff.minor or diff.modifier) }}
alias: Test if only a patch update
action:
- service: update.install
target:
entity_id: update.home_assistant_core_update
data:
backup: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment