Hi, can someone share working update notification? I have many of them, but no one is working…
- id: update_available_notification
alias: "Update Available Notification"
initial_state: 'on'
trigger:
platform: template
value_template: "{{states('sensor.pypi_hass_version') == states('sensor.current_version') }}"
action:
- service: notify.ios_idedek82work
data:
message: "HomeAssistant {{ states('sensor.pypi_hass_version') }} is now available"
title: "Update HASS"
- service: notify.notify
data:
message: "HomeAssistant {{ states('sensor.pypi_hass_version') }} is now available"
title: "Update HASS"
- id: update_available_notification_2
alias: 'Update Available Notification 2'
trigger:
platform: state
entity_id: updater.updater
action:
service: notify.notify
data:
message: 'Update for Home Assistant is available.'
- id: update_available_notification_3
alias: 'Update Available Notification 3'
trigger:
platform: state
entity_id: updater.updater
action:
service: notify.ios_idedek82work
data:
message: 'Update for Home Assistant is available.'
- id: update_available_notification_4
alias: "Update available notification 4"
trigger:
platform: state
entity_id: updater.updater
condition: []
action:
service: notify.ios_idedek82work
data:
message: "Update for Home Assistant is available."
If you learn how to format your code properly, i will show you one.
I´m sorry, already edited. Hope it´s right now…
1 Like
Yeah, looks much better!
Here is the sensor and automation i use.
sensor:
- platform: command_line
command: python3 -c "import requests; print(requests.get('https://pypi.org/simple/homeassistant').text.split('homeassistant-')[-1].split('.tar')[0])"
name: Latest HA Version
scan_interval: 3600
automation:
- alias: Update notification
initial_state: True
trigger:
- platform: state
entity_id: sensor.latest_ha_version
action:
- service: notify.iphone
data_template:
title: "New Home Assistant Release"
message: "Home Assistant {{ states.sensor.latest_ha_version.state }} is now available."
- service: persistent_notification.create
data_template:
title: "New Home Assistant Release"
message: "Home Assistant {{ states.sensor.latest_ha_version.state }} is now available."
This will also send notification on beta updates.
Your entity_id: updater.updater
automations will probably work, but the updater in HA runs only once per day.
BTW, you can simply test it if you go to Dev Tools/states, klick the sensor.latest_ha_version
, change the state to any other value and klick ‘SET STATE’.
2 Likes
Can I use your topic to try to solve my problem?
I have the following automation that should send me a message and create a persisent notification. However, it only works sometimes. I mean, it already worked but in the last update didnt work. Reading the topic someone mentioned something about beta update, is this the problem?
- alias: Update Available Notifications
initial_state: 'on'
trigger:
platform: state
entity_id: updater.updater
action:
- service: persistent_notification.create
data_template:
title: "Atualização do Sistema"
message: "Uma atualização do Home Assistant está disponível (Versão {{ states('updater.updater') }})."
data:
data:
url: "/hassio/dashboard"
- service: notify.html5
data_template:
title: "Atualização do Sistema"
message: "Uma atualização do Home Assistant está disponível (Versão {{ states('updater.updater') }})."
data:
data:
url: "/hassio/dashboard"