I would like to share with you my idea for Android notifications for pending updates in ours instances.
This idea include notifications for HA Core, Supervisor, Addons and Custom Components in HACS.
Notifications for HA Core, Supervisor and Addons have update trigger option directly from notification. For Custom Components we could only redirect to HACS tab in companion app.
HA Core and Supervisor have also changelog button which redirects you to release note in github.
This idea includes either custom icons for every notification. Icons are limited to my own Addons and Custom Components and can be extended with creating new PNG’s and adding variables to automations.
Project is not free from bugs (can only read one CC even if there are more of them in one HACS refresh cycle).
To get information about which addon is ready to update we need to create sensor.supervisor:
- 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
Notification for Home Assistant:
- id: '4611182612158'
alias: Powiadomienie - Home Assistant - Aktualizacja
trigger:
- platform: state
entity_id: update.home_assistant_core_update
from: "off"
to: "on"
condition:
- condition: template
value_template: "{{ state_attr('update.home_assistant_core_update', 'installed_version') != state_attr('update.home_assistant_core_update', 'latest_version') }}"
- condition: not
conditions:
- condition: state
entity_id: update.home_assistant_core_update
attribute: installed_version
state: unavailable
action:
- service: notify.mobile_app_redmi_note_9_pro
data:
title: Home Assistant - Aktualizacja
message: z wersji {{ state_attr('update.home_assistant_core_update', 'installed_version') }} do {{ state_attr('update.home_assistant_core_update', 'latest_version') }}
data:
image: /local/images/ha/homeassistantcore.png
actions:
- action: update_core
title: Aktualizuj
- action: URI
title: Changelog
uri: https://github.com/home-assistant/core/releases
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: update_core
- choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger.event.data.action == ''update_core'' }}'
sequence:
- service: update.install
data: {}
target:
entity_id: update.home_assistant_core_update
Notification for Supervisor:
- id: '2461150736717'
alias: Powiadomienie - Home Assistant Supervisor - Aktualizacja
trigger:
- platform: state
entity_id: update.home_assistant_supervisor_update
from: "off"
to: "on"
condition:
- condition: template
value_template: "{{ state_attr('update.home_assistant_supervisor_update', 'installed_version') != state_attr('update.home_assistant_supervisor_update', 'latest_version') }}"
- condition: not
conditions:
- condition: state
entity_id: update.home_assistant_supervisor_update
attribute: installed_version
state: unavailable
action:
- service: notify.mobile_app_redmi_note_9_pro
data:
title: Supervisor - Aktualizacja
message: z wersji {{ state_attr('update.home_assistant_supervisor_update', 'installed_version') }} do {{ state_attr('update.home_assistant_supervisor_update', 'latest_version') }}
data:
image: /local/images/ha/homeassistantsupervisor.png
actions:
- action: update_supervisor
title: Aktualizuj
- action: URI
title: Changelog
uri: https://github.com/home-assistant/supervisor/releases/latest
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: update_core
- choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger.event.data.action == ''update_supervisor'' }}'
sequence:
- service: update.install
data: {}
target:
entity_id: update.home_assistant_supervisor_update
Notification for Addon:
- id: '5365718340349'
alias: Powiadomienie - Home Assistant Dodatki - Aktualizacja
trigger:
- platform: state
entity_id: sensor.supervisor
condition:
- condition: template
value_template: "{{ state_attr('sensor.supervisor', 'addons')[0].version != state_attr('sensor.supervisor', 'addons')[0].version_latest }}"
action:
- service: notify.mobile_app_redmi_note_9_pro
data:
title: "{{ state_attr('sensor.supervisor', 'addons')[0].name }} - Aktualizacja Dodatków"
message: "z wersji {{ state_attr('sensor.supervisor', 'addons')[0].version }} do {{ state_attr('sensor.supervisor', 'addons')[0].version_latest }}"
data:
image: >-
{% if state_attr('sensor.supervisor', 'addons')[0].name == 'Dahuavto2mqtt' %}
/local/images/addons/dahuavto2mqtt.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Duck Dns' %}
/local/images/addons/duckdns.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Esphome' %}
/local/images/addons/esphome.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Frigate Nvr (Full Access)' %}
/local/images/addons/frigatenvr.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Home Assistant Google Drive Backup' %}
/local/images/addons/googledrivebackup.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Influxdb' %}
/local/images/addons/influxdb.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Mosquitto Broker' %}
/local/images/addons/mosquitto.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Nginx Home Assistant Ssl proxy' %}
/local/images/addons/nginx.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Node-Red' %}
/local/images/addons/nodered.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Samba Share' %}
/local/images/addons/sambashare.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Sqlite Web' %}
/local/images/addons/sqliteweb.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Ssh & Web Terminal' %}
/local/images/addons/sshwebterminal.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Studio Code Server' %}
/local/images/addons/studiocodeserver.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Tasmoadmin' %}
/local/images/addons/tasmoadmin.png
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Wmbusmeters (W-Mbus To Mqtt)' %}
/local/images/addons/wmbusmeters.png
{% else %}
/local/images/addons/addons.png
{% endif %}
actions:
- action: update_addon
title: Aktualizuj
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: update_addon
- choose:
- conditions:
- condition: template
value_template: '{{ wait.trigger.event.data.action == ''update_addon'' }}'
sequence:
- service: update.install
data: {}
target:
entity_id: >-
{% if state_attr('sensor.supervisor', 'addons')[0].name == 'Dahuavto2mqtt' %}
update.dahuavto2mqtt_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Duck Dns' %}
update.duck_dns_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Esphome' %}
update.esphome_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Frigate Nvr (Full Access)' %}
update.frigate_nvr_full_access_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Home Assistant Google Drive Backup' %}
update.home_assistant_google_drive_backup_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Influxdb' %}
update.influxdb_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Mosquitto Broker' %}
update.mosquitto_broker_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Nginx Home Assistant Ssl proxy' %}
update.nginx_home_assistant_ssl_proxy_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Node-Red' %}
update.node_red_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Samba Share' %}
update.samba_share_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Sqlite Web' %}
update.sqlite_web_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Ssh & Web Terminal' %}
update.ssh_web_terminal_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Studio Code Server' %}
update.studio_code_server_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Tasmoadmin' %}
update.tasmoadmin_update
{% elif state_attr('sensor.supervisor', 'addons')[0].name == 'Wmbusmeters (W-Mbus To Mqtt)' %}
update.wmbusmeters_w_mbus_to_mqtt_update
{% else %}
Nieznany
{% endif %}
mode: parallel
Notification for Custom Components and Cards in HACS:
- id: '5461410088570'
alias: Powiadomienie - Home Assistant HACS - Aktualizacja
trigger:
- platform: state
entity_id: sensor.hacs
condition:
condition: not
conditions:
- condition: state
entity_id: sensor.hacs
state: '0'
- condition: state
entity_id: sensor.hacs
state: 'unavailable'
action:
- service: notify.mobile_app_redmi_note_9_pro
data:
title: "{{ state_attr('sensor.hacs', 'repositories')[0].display_name}} - Aktualizacja HACS"
message: "z wersji {{ state_attr('sensor.hacs', 'repositories')[0].installed_version }} do {{ state_attr('sensor.hacs', 'repositories')[0].available_version }}"
data:
image: >-
{% if state_attr('sensor.hacs', 'repositories')[0].display_name == 'Adaptive_Lighting' %}
/local/images/hacs/adaptive.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Passive Ble Monitor Integration' %}
/local/images/hacs/ble.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Burze.dzis.net sensor' %}
/local/images/hacs/burzedzisnet.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Frigate' %}
/local/images/hacs/frigaten.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Local Tuya' %}
/local/images/hacs/localtuya.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Multiscrape' %}
/local/images/hacs/multiscrape.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Scheduler component' %}
/local/images/hacs/sheduler.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'vacuum-styj02ym' %}
/local/images/hacs/styj02ym.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Webrtc Camera' %}
/local/images/hacs/webrtc.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Xiaomi Cloud Map Extractor' %}
/local/images/hacs/xiaomicloudmapextractor.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Spotcast' %}
/local/images/hacs/spotcast.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Xiaomi Miot Auto' %}
/local/images/hacs/xiaomimiot.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'yi-hack Home Assistant integration' %}
/local/images/hacs/yihack.png
{% elif state_attr('sensor.hacs', 'repositories')[0].display_name == 'Hacs' %}
/local/images/hacs/hacs.png
{% else %}
/local/images/hacs/cards.png
{% endif %}
actions:
- action: URI
title: Przejdź do aktualizacji
uri: /hacs/entry
PNG’s on my drive:
https://drive.google.com/drive/folders/1NF-Jeo4lNVFieR3WngEsJXSUtkvo7taO?usp=sharing
PS: I’m working on automation which avoid supervisor sensor for addons and trigger from whole domain update but it’s still in tests. Working either on HACS notification including all updates even if there’s more then one update in one refresh cycle.