I updated it here:
Hi,
I have been using this for some time to detected when an update is available. As of 2021.7 it has changed and the sensor.latest_available_version does not contain the point release therefore comparison not possible.
Does anybody know a better way to trigger an alert for an update notification?
sensor.latest_available_version = 2021.7
sensor.installed_version = 2021.7.1
update_available:
value_template: '{{ states.sensor.installed_version.state != states.sensor.latest_available_version.state }}'
The supervisor integration has binary sensors for that.
No, that integration only contains update sensors for Home Assistant OS and addons, not the core version.
Ups, my mistake, again
Try this instead:
Thanks, worked a treat!
I’ve tried this (basically a copy of the code that @tom_l linked to above) and it didn’t trigger for me.
Can anyone see anything wrong that I’ve screwed up?
Putting the template into the developer tools tab correctly gave True when the update was available to be done. The sensors read correctly as 2021.7.1 and 2021.7.2 for current and latest (with appropriate attributes too).
alias: HASS Core Update
description: Notify if Core update is available
trigger:
- platform: template
value_template: >-
{{ states('sensor.latest_core_version') !=
states('sensor.current_core_version') }}
condition: []
action:
- service: notify.mobile_app_darrens_iphone_11
data:
message: >-
Core update from {{ states('sensor.current_core_version') }} to {{
states('sensor.latest_core-version') }} available
- service: mqtt.publish
data:
topic: scrollpi/messages
payload: s/Core update to {{ states('sensor.latest_core_version') }} available
- service: notify.persistent_notification
data:
message: >-
Core update from {{ states('sensor.current_core_version') }} to {{
states('sensor.latest_core_version') }} available
mode: single
The trigger needs to go from false to true. If it is already true after restarting it wont trigger. You’ll get it next time.
You could add a home assistant start event trigger as well, and a template condition, but that means you will get an alert every time you restart and there is an update available.
Just update and wait for the next one.
@tom_l - I don’t think there was any restart involved. This was for the update yesterday from core 7.1 to 7.2, and nothing fired. I understand what you mean though, so it may be that I didn’t notice or something.
I’ve now updated, so I’ll keep an eye on it for next time as you say and look to do something on restarts. I have an automation already that runs on restarts, so can look to just add it to that perhaps if I can localise the conditions (or a parallel specific automation if not).
You should have restarted after adding the sensors. Also reloading automations (if that is what you did instead of restarting) will have the same issue.
I meant that there was no restart coinciding with the new core update arriving (there was of course one after it installed). The sensors have been in place and functional for a while now, so all should have (to my mind) been fully available to trigger for yesterday’s update from 7.1 to 7.2.
Anyway I’ll add the conditional check on HA start-up anyway, and keep an eye on it for next time there’s a core update to see if it notifies or not.
Sorry I thought you only implemented this 17 hours ago (time of your post) where as the .2 release was before that (2 days ago).
No probs - my fault for not being clear.
The implementation is fairly new (sometime last week), but was a little surprised it didn’t fire off when 7.2 dropped.
I’ll add your suggestion about the check on start-up anyway, and will keep an eye on it when 7.3 (or 8.0) drops.
@tom_l - To close this one off for my earlier issue/question, just got the ping for the 7.3 update correctly and successfully. So looks like your assessment for the 7.1 → 7.2 update notification failure was on the money.
It’s even ahead of the game, as the update isn’t actually available in the supervisor yet
Reload the supervisor on the system page then when it has restarted go to the supervisor dashboard and refresh the page.
No need - it’s here now and currently under install.
Hi, this card looks really nice. Would you maybe share your config?
Sure, I use a number of binary_sensors for the on/off warnings based on the underlying sensors, here’s the config - the card has changed a little bit since the original post but still basically the same:
entities:
- type: custom:multiple-entity-row
entity: binary_sensor.remote_ui
state_color: true
- entity: sensor.myip
type: custom:multiple-entity-row
name: Availability
show_state: false
icon: mdi:restart
entities:
- entity: sensor.last_boot
name: Last Reboot
format: relative
- entity: sensor.ha_uptime
name: Uptime
format: total
- type: custom:multiple-entity-row
entity: sensor.database_size
icon: mdi:database-outline
state_color: true
- type: divider
- entity: binary_sensor.update_homeassistant
type: custom:multiple-entity-row
show_state: false
state_color: true
name: Home Assistant Core
tap_action:
action: navigate
navigation_path: /hassio/dashboard/
entities:
- entity: sensor.current_version
name: Current
- entity: binary_sensor.updater
attribute: newest_version
name: Available
- entity: binary_sensor.update_os
type: custom:multiple-entity-row
show_state: false
state_color: true
name: Operating System
tap_action:
action: navigate
navigation_path: /hassio/dashboard/
entities:
- entity: sensor.os
attribute: current_version
name: Current
- entity: sensor.os
attribute: newest_version
name: Available
- entity: binary_sensor.update_supervisor
type: custom:multiple-entity-row
show_state: false
state_color: true
name: Supervisor
tap_action:
action: navigate
navigation_path: /hassio/system/
entities:
- entity: sensor.supervisor
attribute: current_version
name: Current
- entity: sensor.supervisor
attribute: newest_version
name: Available
- entity: binary_sensor.update_addons
type: custom:multiple-entity-row
show_state: false
state_color: true
name: Add Ons
tap_action:
action: navigate
navigation_path: /hassio/dashboard/
entities:
- entity: sensor.supervisor
name: Available
- entity: binary_sensor.update_hacs
type: custom:multiple-entity-row
show_state: false
state_color: true
name: HACS
tap_action:
action: navigate
navigation_path: /hacs/entry/
entities:
- entity: sensor.hacs
name: Available
- type: divider
- entity: sensor.myip
type: custom:multiple-entity-row
name: IP
show_state: false
secondary_info: last-changed
icon: mdi:ip-network-outline
entities:
- entity: sensor.local_ip
name: Local
- entity: sensor.myip
name: External
state_color: true
title: Home Assistant
type: entities
Great, thank you! multiple-entity-row
was the magical word
Btw, how do you get the Update notifications for the OS?