I really like the way that the available HACS updates pending notification works. It will show you what integrations are available to update, the current installed version and the latest version available to install. It will pop up if something is released in HACS, or upon starting HA
The code for this can be found at ; https://hacs.xyz/docs/basic/automation/#updates-pending
However, I wanted something similar to do the same function for Supervisor Addons. I did look at Update notifications! Core, HACS, Supervisor and Addons (now a blueprint!) and it was very good but the notifications just show you
Updates available for X HA addons
Therefore, I have merged the two automations to show the same information for the Addons as the HACS integrations
To achieve this I used the sensor created by @CentralCommand at Update notifications! Core, HACS, Supervisor and Addons (now a blueprint!)
# Sensor to track available updates for supervisor & addons
sensor:
- platform: command_line
name: Supervisor
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
But instead tweaked the HACS notification automation slightly to display this information
alias: Notify - Supervisor - HA
trigger:
- platform: state
entity_id: sensor.supervisor
- platform: homeassistant
event: start
condition:
- condition: template
value_template: '{{ states(''sensor.supervisor'') != ''unknown''}}'
- condition: template
value_template: '{{ (states(''sensor.supervisor'') | float) != 0}}'
action:
- service: persistent_notification.create
data_template:
title: Updates pending in Supervisor
notification_id: supervisor-update
message: |-
{% for repo in state_attr('sensor.supervisor', 'addons') %}
**{{ repo.name }}** _{{ repo["version"] }}_ -> _{{ repo["version_latest"] }}_
{% endfor %}
mode: single
I hope others may find this useful too.