Created
July 16, 2024 13:55
-
-
Save MrEbbinghaus/14c5bce221ecf59234e75a89e0df20b1 to your computer and use it in GitHub Desktop.
Home Assistant auto-update on patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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