Big update - 4/7/2022
As of release 2022.4.0
of HA, this package is now a blueprint!
Now all you have to do to get update notifications for everything is this:
- Click the import button
- Create an automation out of the blueprint
- Fill in the inputs based on what features you want to enable (there’s a few options, the descriptions should explain them).
I’m going to leave the original package info below in a collapse for reference. For people not yet on 2022.4
or people that want to leverage the curling supervisor’s API technique for other use cases (I’ve seen it pop up in a few other places around the forum).
And definitely @ me if you have any issues. I did have to rewrite the entire thing to be a single automation which was quite a lot of yaml. I tested the various options but its possible I missed something. If you find something definitely let me know so I can get it fixed up.
Original Package for HA prior to 2022.4.0
Note: For those that have been following this project from the beginning, there used to be a lot more information here. Turns out posts have a limit of 32k characters so I chopped out everything besides the actual packages. If you’re interested in my explanation of the parts you’ll have to look at the post’s history, sorry about that.
Update Notifications package
sensor:
# Sensor to track available updates for supervisor & addons
- platform: command_line
name: Supervisor updates
command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
value_template: "{{ value_json.addons | length }}"
unit_of_measurement: pending update(s)
json_attributes:
- update_available
- newest_version
- current_version
- addons
binary_sensor:
# True if there's updates available for any HACS components or Addons
- platform: threshold
name: Updater HACS
entity_id: sensor.hacs
upper: 0.5
- platform: threshold
name: Updater Addons
entity_id: sensor.supervisor_updates
upper: 0.5
- platform: template
sensors:
# True if there's an update available for supervisor
updater_supervisor:
friendly_name: 'Updater Supervisor'
device_class: problem
value_template: "{{ state_attr('sensor.supervisor_updates', 'update_available') }}"
availability_template: "{{ states('sensor.supervisor_updates') | int(-1) > -1 }}"
alert:
# Update is available - un-acknowledgeble, auto-dismiss, me only
# Wait 5 minutes before first to give core config check time to run
ha_update_available:
name: HA has an update
entity_id: binary_sensor.updater
state: 'on'
can_acknowledge: false
repeat:
- 5
- 360
skip_first: true
title: 'Update for HA available'
message: "New version is {{ state_attr('binary_sensor.updater', 'newest_version') }}. Currently on {{ states('sensor.current_version') }}"
notifiers:
- 'me'
data:
tag: 'ha-update-available'
url: 'http://hassio.local/hassio/addon/core_check_config'
ttl: 21600
# Supervisor update is available - un-acknowledgeable, auto-dismiss, me only
supervisor_update_available:
name: Supervisor has an update
entity_id: binary_sensor.updater_supervisor
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA Supervisor available'
message: "New version is {{ state_attr('sensor.supervisor_updates', 'newest_version') }}. Currently on {{ state_attr('sensor.supervisor_updates', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'supervisor-update-available'
url: 'http://hassio.local/hassio/dashboard'
ttl: 21600
# HACS repos have updates available - unacknowledgeable, auto-dismiss, me only
hacs_update_available:
name: HACS repos have updates
entity_id: binary_sensor.updater_hacs
state: 'on'
can_acknowledge: false
repeat: 360
title: "Updates available in {{ states('sensor.hacs') }} HACS repo{% if states('sensor.hacs') | int > 1 %}s{% endif %}"
message: ""
notifiers:
- 'me'
data:
tag: 'hacs-update-available'
url: 'http://hassio.local/hacs/installed'
ttl: 21600
# Addons have updates available - unacknowledgeable, auto-dismiss, me only
addon_update_available:
name: Addons have updates
entity_id: binary_sensor.updater_addons
state: 'on'
can_acknowledge: false
repeat: 360
title: "Updates available for {{ states('sensor.supervisor_updates') }} HA addon{% if states('sensor.supervisor_updates') | int > 1 %}s{% endif %}"
message: ""
notifiers:
- 'me'
data:
tag: 'addon-update-available'
url: 'http://hassio.local/hassio/dashboard'
ttl: 21600
automation:
- id: '1585256741683'
alias: Check config with update
description: Starts the check config addon when an update becomes available
trigger:
- entity_id: binary_sensor.updater
platform: state
to: 'on'
condition: []
action:
- data:
addon: core_check_config
service: hassio.addon_start
Package with additions for audio, dns and others
See this post for reasoning behind these additions.
Update Notifications package + audio, dns, cli, multicast and core
sensor:
# Sensor to track available updates for supervisor & addons
- platform: command_line
name: Supervisor updates
command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
value_template: "{{ value_json.addons | length }}"
unit_of_measurement: pending update(s)
json_attributes:
- update_available
- newest_version
- current_version
- addons
# Sensors to track updates to other core components (audio, dns, CLI and multicast)
- platform: command_line
name: Updater Audio
command: 'curl http://supervisor/audio/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
- platform: command_line
name: Updater DNS
command: 'curl http://supervisor/dns/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
- platform: command_line
name: Updater CLI
command: 'curl http://supervisor/cli/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
- platform: command_line
name: Updater Multicast
command: 'curl http://supervisor/multicast/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
- platform: command_line
name: Updater Observer
command: 'curl http://supervisor/observer/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
# Alternate updater sensor for core since binary_sensor.updater is very slow to recognize updates
- platform: command_line
name: Updater Core
command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
binary_sensor:
# True if there's updates available for any HACS components or Addons
- platform: threshold
name: Updater HACS
entity_id: sensor.hacs
upper: 0.5
- platform: threshold
name: Updater Addons
entity_id: sensor.supervisor_updates
upper: 0.5
- platform: template
sensors:
# True if there's an update available for supervisor
updater_supervisor:
friendly_name: 'Updater Supervisor'
device_class: problem
value_template: "{{ state_attr('sensor.supervisor_updates', 'update_available') }}"
availability_template: "{{ states('sensor.supervisor_updates') | int(-1) > -1 }}"
alert:
# Update is available - un-acknowledgeble, auto-dismiss, me only
# Wait 5 minutes before first to give core config check time to run
ha_update_available:
name: HA has an update
entity_id: sensor.updater_core
state: 'on'
can_acknowledge: false
repeat:
- 5
- 360
skip_first: true
title: 'Update for HA available'
message: "New version is {{ state_attr('sensor.updater_core', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_core', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'ha-update-available'
url: 'http://hassio.local/hassio/addon/core_check_config'
# Supervisor update is available - un-acknowledgeable, auto-dismiss, me only
supervisor_update_available:
name: Supervisor has an update
entity_id: binary_sensor.updater_supervisor
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA Supervisor available'
message: "New version is {{ state_attr('sensor.supervisor_updates', 'newest_version') }}. Currently on {{ state_attr('sensor.supervisor_updates', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'supervisor-update-available'
url: 'http://hassio.local/hassio/dashboard'
# Audio update is available - un-acknowledgeable, auto-dismiss, me only
audio_update_available:
name: Audio has an update
entity_id: sensor.updater_audio
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA Audio available'
message: "New version is {{ state_attr('sensor.updater_audio', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_audio', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'audio_update_available'
url: 'http://hassio.local/hassio/dashboard'
# DNS update is available - un-acknowledgeable, auto-dismiss, me only
dns_update_available:
name: DNS has an update
entity_id: sensor.updater_dns
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA DNS available'
message: "New version is {{ state_attr('sensor.updater_dns', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_dns', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'dns_update_available'
url: 'http://hassio.local/hassio/dashboard'
# CLI update is available - un-acknowledgeable, auto-dismiss, me only
cli_update_available:
name: CLI has an update
entity_id: sensor.updater_cli
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA CLI available'
message: "New version is {{ state_attr('sensor.updater_cli', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_cli', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'cli_update_available'
url: 'http://hassio.local/hassio/dashboard'
# Multicast update is available - un-acknowledgeable, auto-dismiss, me only
multicast_update_available:
name: Multicast has an update
entity_id: sensor.updater_multicast
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA Multicast available'
message: "New version is {{ state_attr('sensor.updater_multicast', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_multicast', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'multicast_update_available'
url: 'http://hassio.local/hassio/dashboard'
# Observer update is available - un-acknowledgeable, auto-dismiss, mike only
observer_update_available:
name: Observer has an update
entity_id: sensor.updater_observer
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA Observer available'
message: "New version is {{ state_attr('sensor.updater_observer', 'newest_version') }}. Currently on {{ state_attr('sensor.updater_observer', 'current_version') }}"
notifiers:
- 'me'
data:
tag: 'observer_update_available'
url: '/hassio/dashboard'
# HACS repos have updates available - unacknowledgeable, auto-dismiss, me only
hacs_update_available:
name: HACS repos have updates
entity_id: binary_sensor.updater_hacs
state: 'on'
can_acknowledge: false
repeat: 360
title: "Updates available in {{ states('sensor.hacs') }} HACS repo{% if states('sensor.hacs') | int > 1 %}s{% endif %}"
message: ""
notifiers:
- 'me'
data:
tag: 'hacs-update-available'
url: 'http://hassio.local/hacs/installed'
# Addons have updates available - unacknowledgeable, auto-dismiss, me only
addon_update_available:
name: Addons have updates
entity_id: binary_sensor.updater_addons
state: 'on'
can_acknowledge: false
repeat: 360
title: "Updates available for {{ states('sensor.supervisor_updates') }} HA addon{% if states('sensor.supervisor_updates') | int > 1 %}s{% endif %}"
message: ""
notifiers:
- 'me'
data:
tag: 'addon-update-available'
url: 'http://hassio.local/hassio/dashboard'
automation:
- id: '1585256741683'
alias: Check config with update
description: Starts the check config addon when an update becomes available
trigger:
- entity_id: sensor.updater_core
platform: state
to: 'on'
condition: []
action:
- data:
addon: core_check_config
service: hassio.addon_start
And now there’s host update notifications! There’s a bunch of caveats to this one though so please read this post below for details
Supervisor Integration (2/24/2022 Update)
This package uses the update_available
binary sensors created by the supervisor integration instead of curling supervisor. This is preferred to the old way of curling supervisor for everything if you have these sensors. However you must remember to enable the update_available
sensors for each addon, they all start disabled.
This package still includes a better update available sensor for core (the native updater only updates once a day) and the automation that starts the config check addon when a core update becomes available. Although the value of that check is still debatable since it returns a lot of false positives.
It drops all the sensors tracking updates for supervisor and the various supervisor plugins (audio, dns, cli, etc.) Those weren’t very helpful in reality since all those all auto-update, the sensors rarely even noticed an update before it happened. If you want to know about updates to those I suggest watching the repos for supervisor and each plugin instead.
Update Notifications, supervisor integration
sensor:
# Alternate updater sensor for core since binary_sensor.updater is very slow to recognize updates
- platform: command_line
name: Updater Core
command: 'curl http://supervisor/core/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" 2> /dev/null | jq ''{"newest_version":.data.version_latest,"current_version":.data.version, "update_available":.data.update_available}'''
scan_interval: 300
value_template: "{% if value_json.update_available %}on{% else %}off{% endif %}"
json_attributes:
- update_available
- newest_version
- current_version
# Reads the log of the check config addon to see if it passed or failed, updated mainly via automation
- platform: command_line
name: Check config addon status
scan_interval: 300
command: 'curl http://supervisor/addons/core_check_config/logs -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" 2> /dev/null | grep -E ''\[[0-9]{2}:[0-9]{2}:[0-9]{2}\] (ERROR:.+?The configuration check did not pass!|INFO:.+?Configuration check finished - no error found! :\))'' | sed -r ''s/(.*) (ERROR|INFO):.*/\2 \1/'''
value_template: "{{ value | lower | regex_replace('^info', 'pass') }}"
binary_sensor:
# True if there's updates available for any HACS components or Addons
- platform: threshold
name: Updater HACS
entity_id: sensor.hacs_updates
upper: 0.5
- platform: threshold
name: Updater Addons
entity_id: sensor.addon_updates
upper: 0.5
template:
binary_sensor:
# True if there's an update available and the config check has completed or its been 20 minutes
- name: core_has_update
unique_id: '9108f22a9aac4ef6b167f20da7c476ec'
device_class: problem
state: >-
{{ is_state('sensor.updater_core', 'on') and (
states.sensor.updater_core.last_changed < states.sensor.check_config_addon_status.last_changed and
not is_state('sensor.check_config_addon_status', '') or
(now() - timedelta(minutes=20)) > states.sensor.updater_core.last_changed
) }}
sensor:
# Count of the number of addons with updates available
- name: addon_updates
unique_id: '85bdfbe83e534821950f0763f0a8b025_addon_updates'
unit_of_measurement: update(s)
state: >-
{{ expand(
integration_entities("hassio")
| select('search', '_update_available(_\d+)?$')
| reject('search', '_operating_system_')
) | selectattr('state', 'eq', 'on')
| list | count }}
alert:
# core_has_update sensor waits up to 20 minutes for config check addon to run before becoming true
ha_core_update_available:
name: Core has an update
entity_id: binary_sensor.core_has_update
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA Core available'
message: >-
New version is {{ state_attr('sensor.updater_core', 'newest_version') }}.
Currently on {{ state_attr('sensor.updater_core', 'current_version') }}.
Config check has
{% if states('sensor.check_config_addon_status') | regex_search('^error') %}
failed, check before updating.
{% elif states('sensor.check_config_addon_status') | regex_search('^pass') %}
passed, feel free to update.
{% else %}
not completed, check the addon to see what happened.
{% endif %}
notifiers: 'me'
data:
tag: 'ha_core_update_available'
group: Updates
channel: Updates
ttl: 21600
url: '/config/dashboard'
sticky: 'true'
actions:
- action: URI
title: Changelog
uri: 'https://github.com/home-assistant/core/releases/latest'
- action: URI
title: Open config check
uri: '/hassio/addon/core_check_config/logs'
ha_os_update_available:
name: OS has an update
entity_id: binary_sensor.home_assistant_operating_system_update_available
state: 'on'
can_acknowledge: false
repeat: 360
title: 'Update for HA OS available'
message: >-
New version is {{ states('sensor.home_assistant_operating_system_newest_version')
}}. Currently on {{ states('sensor.home_assistant_operating_system_version') }}
notifiers: 'me'
data:
tag: 'ha_os_update_available'
group: Updates
channel: Updates
ttl: 21600
url: '/config/dashboard'
sticky: 'true'
actions:
- action: URI
title: Changelog
uri: 'https://github.com/home-assistant/operating-system/releases/latest'
hacs_update_available:
name: HACS components have updates
entity_id: binary_sensor.updater_hacs
state: 'on'
can_acknowledge: false
repeat: 360
title: >-
Updates available for {{ states('sensor.hacs_updates')
}} HACS component{% if states('sensor.hacs_updates') | int > 1 %}s{% endif %}
message: "Click to see repositories"
notifiers: 'me'
data:
tag: 'hacs_update_available'
group: Updates
channel: Updates
ttl: 21600
url: '/hacs'
sticky: 'true'
addon_update_available:
name: Addons have updates
entity_id: binary_sensor.updater_addons
state: 'on'
can_acknowledge: false
repeat: 360
title: >-
Updates available for {{ states('sensor.addon_updates')
}} HA addon{% if states('sensor.addon_updates') | int > 1 %}s{% endif %}
message: "Click to see addons"
notifiers: 'me'
data:
tag: 'addon_update_available'
group: Updates
channel: Updates
ttl: 21600
url: '/hassio/dashboard'
sticky: 'true'
automation:
- id: '1585256741683'
alias: Check config with update
description: Starts the check config addon when an update becomes available
trigger:
- entity_id: sensor.updater_core
platform: state
to: 'on'
condition: []
action:
- data:
addon: core_check_config
service: hassio.addon_start