Skip to content

Instantly share code, notes, and snippets.

@piitaya
Last active November 29, 2023 09:19
Show Gist options
  • Save piitaya/7ee4e6e6431775a065bc08d2d2839ff4 to your computer and use it in GitHub Desktop.
Save piitaya/7ee4e6e6431775a065bc08d2d2839ff4 to your computer and use it in GitHub Desktop.
blueprint:
name: Home Assistant Auto-update
description: Auto-update Home Assistant when a new update is available
domain: automation
author: Piitaya
source_url: https://gist.github.com/piitaya/7ee4e6e6431775a065bc08d2d2839ff4
input:
core_entity:
name: Core
description: Core update entity
selector:
entity:
filter:
- domain:
- update
integration: hassio
multiple: false
os_entity:
name: Operating system
description: Operating system update entity
selector:
entity:
filter:
- domain:
- update
integration: hassio
multiple: false
supervisor_entity:
name: Supervisor
description: Supervisor update entity
selector:
entity:
filter:
- domain:
- update
integration: hassio
multiple: false
backup:
name: Backup
description: Creates a backup before starting the update.
default: false
selector:
boolean: {}
trigger:
- platform: state
entity_id:
- !input core_entity
- !input os_entity
- !input supervisor_entity
to:
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: !input core_entity
attribute: in_progress
state: false
- condition: state
entity_id: !input supervisor_entity
attribute: in_progress
state: false
- condition: state
entity_id: !input os_entity
attribute: in_progress
state: false
action:
- if:
- condition: state
entity_id: !input core_entity
state: "on"
- condition: state
entity_id: !input supervisor_entity
state: "off"
then:
- service: update.install
data:
backup: !input backup
target:
entity_id: !input core_entity
- if:
- condition: state
entity_id: !input supervisor_entity
state: "on"
then:
- service: update.install
data: {}
target:
entity_id: !input supervisor_entity
- if:
- condition: state
entity_id: !input os_entity
state: "on"
then:
- service: update.install
data:
backup: !input backup
target:
entity_id: !input os_entity
mode: queued
max: 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment