No custom elements used
The standard update sensor doesn’t seem to work every time, at least for me, so I made one as I like it.
You can only use the persistent notification, or the card, or add anything you want to it.
I’m experimenting with this setup for a few updates; I had pushbullet notifications for it…and at some point I even had Google Assistant read out the update version if one is available (and if I was home), but this seems to be the most practical configuration for me so far, so maybe someone finds something useful here.
My update notification configuration consists of a Lovelace entity that can be placed anywhere you want and it will be hidden unless there is an update available.
Once an update is available, a persistent notification will be displayed and it will remain there over restarts until Home Assistant is updated.
The notification will also have a link where you can find the release notes and display the current version.
sensor:
- platform: rest # Home Assistant LATEST Version
resource: https://pypi.python.org/pypi/homeassistant/json
name: Update
value_template: '{{ value_json.info.version }}'
#scan_interval: 21600 # Optional scanning interval
- platform: version # Home Assistant CURRENT Version
name: Version
- platform: template # Home Assistant UPDATE AVAILABLE
sensors:
update_available:
friendly_name: "Updater"
value_template: >-
{% if (states.sensor.update.state) > (states.sensor.version.state) %}
{{states.sensor.update.state}}
{% else %}
LATEST
{% endif %}
Place this anywhere you want it to show up in Lovelace:
ui-lovelace.yaml
- type: conditional # Update Notification
conditions:
- entity: sensor.update_available
state_not: "LATEST"
card:
type: entities
entities:
- sensor.update_available
theme: updater
automation:
- id: homeassistant_update # Update Notification
alias: 'UPDATE AVAILABLE'
initial_state: on
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.update_available
condition:
condition: and
conditions:
- condition: template
value_template: >
{{ not is_state('sensor.update_available', 'LATEST') }}
- condition: template
value_template: >
{{ not is_state('sensor.update_available', 'unavailable') }}
action:
- service: persistent_notification.create
data:
title: Version {{states.sensor.update.state}} available!
message: >
Release notes for verison **{{states.sensor.update.state}}** are available [**HERE**](https://www.home-assistant.io/latest-release-notes/)
Current version is {{states.sensor.version.state}}
customize:
sensor.update:
icon: mdi:cloud-upload
hidden: true
sensor.version:
icon: mdi:cloud-upload-outline
hidden: true
sensor.update_available:
friendly_name: "NEW VERSION AVAILABLE"
icon: mdi:hand-okay
hidden: true
theme:
updater:
paper-card-background-color: "var(--accent-color)"