This blueprint will send you an update when an addon update is available. An example of such update can be found below:
Features
Sends the notification when the update is available.
Clicking on the notification brings you straight to the information page of the addon, allowing for starting the update immediately.
Prerequisites
The blueprint uses data from an addon sensor to determine the whether an update is available. This addon sensor can easily be implemented using a Rest sensor. A template can be found HERE. Make sure that the addon sensor includes at least the attributes ‘version’, ‘version latest’, ‘slug’ and ‘name’.
Note: for this sensor to work, you’ll have to generate a ‘Long-lived access token’, see this link for more information.
Blueprint
blueprint:
name: Addon update notifications
description: Sends an update to a selected notifier when an update of an addon is available.
domain: automation
input:
addon_sensor:
name: Addon sensor
description: "This sensor contains the version information of the addon and should include the attributes 'version', 'version latest', 'slug' and 'name'."
selector:
entity:
domain: sensor
notify_device:
name: Notify device
description: "The device where the notification should be sent to."
selector:
device:
integration: mobile_app
variables:
sensor_input: !input addon_sensor
version: "{{ state_attr( sensor_input, 'version' ) }}"
version_latest: "{{ state_attr( sensor_input, 'version_latest' ) }}"
slug: "{{ state_attr( sensor_input, 'slug' ) }}"
addon_name: "{{ state_attr( sensor_input, 'name' ) }}"
trigger:
platform: event
event_type: state_changed
event_data:
entity_id: !input addon_sensor
condition:
condition: template
value_template: "{{ version != version_latest }}"
action:
domain: mobile_app
type: notify
device_id: !input notify_device
message: "({{ version }} > {{ version_latest }})"
title: "{{ addon_name }} update available"
data:
url: "/hassio/addon/{{slug}}/info"
Logger: homeassistant.helpers.template
Source: helpers/template.py:1377
First occurred: July 5, 2021, 7:03:03 PM (917 occurrences)
Last logged: 10:19:09 AM
Template variable error: 'value_json' is undefined when rendering '{{ value_json.data.state }}'
One thing I discovered during my testing with Postman is that the long-lived access token must be proceeded by the word Bearer which I did not know prior. All working now.
I added this to the configuration.yaml
I set up the long-lived token.
I have VSCode addon installed.
I get the following error in the log.
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:268
Integration: Sensor (documentation, issues)
First occurred: 6:49:00 AM (1 occurrences)
Last logged: 6:49:00 AM
Platform rest not ready yet: [Errno -2] Name does not resolve; Retrying in background in 30 seconds
The error is just nondescript enough that I can’t find anything about it.
I didn’t read the error properly. It says the name does not resolve; which could mean that the homeassistant.local does not redirect to an IP address. Try switching it with the actual IP address of your home assistant instance.
I feel like I’m missing something…
While I do not believe these existed when this blueprint first came out, at this point each add-on is a Device in Home Assistant and if you turn them on, there are 6 sensors that you can use including update available sensor for this. This can be plugged directly into an automation. It is no longer necessary to generate a sensor. The logic here is valid and either an automation or a new blueprint could be made using some of this logic and the new sensor.
I’m just passing this on for folks that seem to be struggling to get this going.
I was hoping for this to be a one stop shop. I seems to tick all the boxes of notifying which adon needs updated and the version.
I did see that binary sensors are now available that will generate an event if an update is available. This fails me in several ways. First, to make this work well I would need an individual automation for each addon. I don’t like that, I prefer to have a single automation that covers all addons. Two, I haven’t figured out how to grab info from the event to tell me what needs updated. As soon as a captured event occures I should be able to do this. Finally, this tequnike don’t seem to cover all cases. Just today I got a Home Asistant Core update. This itme does not have these binary sensors.