Last active
August 3, 2026 13:13
-
-
Save auanasgheps/a09c3574a4f356e64c409b775d2e2760 to your computer and use it in GitHub Desktop.
Home Asisstant Update notifications - Blueprint https://community.home-assistant.io/t/update-notifications-for-home-assistant/1014021/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Update notifications (v2.2.1) | |
| description: >- | |
| **Version: 2.2.1** | |
| Get notified about pending updates with one-tap install and skip actions. | |
| More information is available at the [Community Post](https://community.home-assistant.io/t/update-notifications-for-home-assistant/1014021) | |
| homeassistant: | |
| min_version: 2026.5.0 | |
| domain: automation | |
| input: | |
| mobile_app_device: | |
| name: Device to notify | |
| description: Select your mobile device running the Home Assistant app. | |
| selector: | |
| device: | |
| integration: mobile_app | |
| schedule_section: | |
| name: Schedule | |
| icon: mdi:clock-outline | |
| input: | |
| reminder_hours: | |
| name: Reminder interval | |
| description: >- | |
| Re-send notifications for pending updates every N hours. | |
| Set to **Disabled** only when you want to use Lazy mode — without this mode, no notifications will be sent at all. | |
| **Note**: If you have configured a notification time window (Notify after / Notify before), | |
| reminders that fall outside the window are skipped without rescheduling. | |
| A shorter interval reduces the chance of missing a reminder. | |
| With a 24-hour interval, you will not receive a reminder if you make adjustments to the time window. | |
| default: "6" | |
| selector: | |
| select: | |
| options: | |
| - label: "Disabled (Lazy mode)" | |
| value: "0" | |
| - label: "1" | |
| value: "1" | |
| - label: "3" | |
| value: "3" | |
| - label: "6" | |
| value: "6" | |
| - label: "12" | |
| value: "12" | |
| - label: "24" | |
| value: "24" | |
| multiple: false | |
| custom_value: false | |
| lazy_mode: | |
| name: Lazy mode | |
| description: >- | |
| When enabled, ignores the Reminder interval and instead sends one reminder | |
| per week on the selected weekday and time. | |
| The Notify after / Notify before time window still applies. | |
| default: false | |
| selector: | |
| boolean: {} | |
| reminder_weekday: | |
| name: Lazy mode reminder weekday | |
| description: "(Lazy mode only) Day of the week on which the weekly reminder is sent." | |
| default: Saturday | |
| selector: | |
| select: | |
| options: | |
| - Monday | |
| - Tuesday | |
| - Wednesday | |
| - Thursday | |
| - Friday | |
| - Saturday | |
| - Sunday | |
| multiple: false | |
| custom_value: false | |
| reminder_time: | |
| name: Lazy mode reminder time | |
| description: "(Lazy mode only) Time at which the weekly reminder is sent." | |
| default: "11:00:00" | |
| selector: | |
| time: {} | |
| only_after: | |
| name: Notify after | |
| description: Don't send mobile notifications before this time. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| only_before: | |
| name: Notify before | |
| description: Don't send mobile notifications after this time. | |
| default: "00:00:00" | |
| selector: | |
| time: {} | |
| notifications_section: | |
| name: Notifications | |
| icon: mdi:bell-outline | |
| input: | |
| send_to_ha: | |
| name: Show in HA dashboard | |
| description: Also create a persistent notification in the Home Assistant Notifications panel. | |
| default: false | |
| selector: | |
| boolean: {} | |
| notification_channel: | |
| name: Notification channel | |
| description: Groups notifications together. Maps to a channel on Android and a group on iOS. | |
| default: Updates | |
| selector: | |
| text: {} | |
| status_bar_icon: | |
| name: Status bar icon | |
| description: "(Android only) Shown in the status bar when a notification is active." | |
| default: mdi:package-up | |
| selector: | |
| icon: | |
| placeholder: mdi:package-up | |
| behaviour_section: | |
| name: Behaviour | |
| icon: mdi:cog-outline | |
| input: | |
| take_backup: | |
| name: Take backup | |
| description: Take a backup before installing. Applies to Home Assistant Core and Apps (Add-ons) only. | |
| default: true | |
| selector: | |
| boolean: {} | |
| exclude_entities: | |
| name: Exclude entities | |
| description: >- | |
| Select updates you want to ignore. | |
| Useful for things that update frequently, like ESPHome. | |
| default: [] | |
| selector: | |
| entity: | |
| domain: update | |
| multiple: true | |
| exclude_auto_update: | |
| name: Exclude auto-updating Apps | |
| description: Skip notifications for Apps (Add-ons) that have automatic updates enabled. These update themselves without user action. | |
| default: true | |
| selector: | |
| boolean: {} | |
| update_entities: | |
| name: Real-time monitoring for dashboard installs | |
| description: >- | |
| This list is only used for notifications of dashboard-initiated installs. You don't need to enter entities in this list for regular notifications. | |
| When an update starts or completes from the HA dashboard, notifications update in real-time for entities in this list. | |
| **Home Assistant Core** is pre-selected as a sensible default. | |
| default: | |
| - update.home_assistant_core_update | |
| selector: | |
| entity: | |
| domain: update | |
| multiple: true | |
| changelog_urls: | |
| name: Custom Changelog URLs | |
| description: >- | |
| Apps (Add-ons) do not provide a link to their changelog. | |
| The notification will point to the "Info" section of the App, which will also show the changelog. | |
| Use this field if you'd like to add the changelog manually. | |
| Enter one item per line, using the entity ID, a colon, and the link. | |
| **EXAMPLE**: | |
| ``` | |
| update.zigbee2mqtt_update: https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/releases | |
| ``` | |
| default: {} | |
| selector: | |
| object: {} | |
| mode: parallel | |
| max: 100 | |
| trigger_variables: | |
| _reminder_hours: !input reminder_hours | |
| reminder_hours: "{{ _reminder_hours | default(0) | int(0) }}" | |
| lazy_mode: !input lazy_mode | |
| update_entities: !input update_entities | |
| exclude_entities: !input exclude_entities | |
| exclude_auto_update: !input exclude_auto_update | |
| trigger: | |
| - id: started | |
| platform: state | |
| entity_id: !input update_entities | |
| attribute: in_progress | |
| from: false | |
| to: true | |
| - id: done | |
| platform: state | |
| entity_id: !input update_entities | |
| from: "on" | |
| to: "off" | |
| - id: install | |
| platform: event | |
| event_type: mobile_app_notification_action | |
| - id: ha_start | |
| platform: homeassistant | |
| event: start | |
| - id: reminder | |
| platform: template | |
| value_template: >- | |
| {{ (states.update | selectattr('state', 'eq', 'on') | rejectattr('entity_id', 'in', exclude_entities) | rejectattr('attributes.auto_update', 'eq', true) | |
| if exclude_auto_update else | |
| states.update | selectattr('state', 'eq', 'on') | rejectattr('entity_id', 'in', exclude_entities)) | list | count > 0 | |
| and not lazy_mode and reminder_hours > 0 and now().hour % reminder_hours == 0 | |
| and now().minute == 0 }} | |
| - id: weekly_reminder | |
| platform: time | |
| at: !input reminder_time | |
| variables: | |
| mobile_app_device: !input mobile_app_device | |
| send_to_ha: !input send_to_ha | |
| exclude_entities: !input exclude_entities | |
| exclude_auto_update: !input exclude_auto_update | |
| _changelog_urls: !input changelog_urls | |
| changelog_urls: "{{ _changelog_urls if _changelog_urls is mapping else {} }}" | |
| take_backup: !input take_backup | |
| notification_channel: !input notification_channel | |
| status_bar_icon: !input status_bar_icon | |
| lazy_mode: !input lazy_mode | |
| reminder_weekday: !input reminder_weekday | |
| action: | |
| - condition: template | |
| value_template: >- | |
| {{ trigger.id != 'install' or | |
| (trigger.event.data.action | default('')).startswith('install-update--') or | |
| (trigger.event.data.action | default('')).startswith('skip-update--') or | |
| (trigger.event.data.action | default('')).startswith('changelog--') }} | |
| - alias: Clear notifications for updates that have already completed | |
| choose: | |
| - conditions: "{{ trigger.id not in ['install', 'reminder', 'weekly_reminder'] }}" | |
| sequence: | |
| - repeat: | |
| for_each: "{{ states.update | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}" | |
| sequence: | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': repeat.item[7:], 'action_data': {'tag': repeat.item[7:]}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': repeat.item[7:]} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': repeat.item[7:] ~ '-cl', 'action_data': {'tag': repeat.item[7:] ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': repeat.item[7:] ~ '-cl'} }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.dismiss | |
| data: | |
| notification_id: "{{ repeat.item[7:] }}" | |
| - choose: | |
| - alias: Install update action | |
| conditions: "{{ trigger.id == 'install' and (trigger.event.data.action | default('')).startswith('install-update--') }}" | |
| sequence: | |
| - variables: | |
| tag_id: "{{ trigger.event.data.action | replace('install-update--', '', 1) }}" | |
| full_entity_id: "update.{{ tag_id }}" | |
| title: "{{ state_attr(full_entity_id, 'friendly_name') | string }}" | |
| conf_url: "{{ device_attr(full_entity_id, 'configuration_url') }}" | |
| ids: "{{ device_attr(full_entity_id, 'identifiers') | default([['','']], true) | first }}" | |
| url: "{{ conf_url | regex_replace('^homeassistant://', '') if conf_url is string else ('/hassio/system' if ids[0] == 'hassio' and ids[1] in ['supervisor', 'OS'] else '/config') }}" | |
| # 1. If update already done (stale notification), clear it and stop | |
| - choose: | |
| - conditions: "{{ is_state(full_entity_id, 'off') }}" | |
| sequence: | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id, 'action_data': {'tag': tag_id}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id ~ '-cl', 'action_data': {'tag': tag_id ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id ~ '-cl'} }}" | |
| - stop: "Update already completed — stale notification cleared" | |
| # 2. Guard: stop if already in progress (race condition with second tap) | |
| - condition: template | |
| value_template: "{{ not state_attr(full_entity_id, 'in_progress') }}" | |
| # 2. Immediately force the "Updating..." message on mobile and HA (Optimistic UI) | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| title: "{{ title }}" | |
| message: "Updating..." | |
| data: "{{ {'tag': tag_id, 'channel': notification_channel, 'group': notification_channel, 'notification_icon': status_bar_icon, 'clickAction': url, 'sticky': true} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id, 'url': url, 'group': notification_channel} }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.create | |
| data: | |
| notification_id: "{{ tag_id }}" | |
| title: "{{ title }}" | |
| message: "Updating..." | |
| # 3. Start the update process | |
| - action: update.install | |
| data: | |
| entity_id: "{{ full_entity_id }}" | |
| backup: "{% set ids = device_attr(full_entity_id, 'identifiers') | default([['','']], true) | first %}{{ take_backup and ids[0] == 'hassio' and ids[1] not in ['supervisor', 'OS'] }}" | |
| # 4. Pause execution waiting for this specific update to finish | |
| - wait_template: "{{ is_state(full_entity_id, 'off') }}" | |
| timeout: | |
| minutes: 45 | |
| continue_on_timeout: true | |
| # 5. Permanently clear the notifications (including any -cl tag from changelog re-notification) | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id, 'action_data': {'tag': tag_id}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id ~ '-cl', 'action_data': {'tag': tag_id ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id ~ '-cl'} }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.dismiss | |
| data: | |
| notification_id: "{{ tag_id }}" | |
| - alias: Skip update action | |
| conditions: "{{ trigger.id == 'install' and (trigger.event.data.action | default('')).startswith('skip-update--') }}" | |
| sequence: | |
| - variables: | |
| tag_id: "{{ trigger.event.data.action | replace('skip-update--', '', 1) }}" | |
| full_entity_id: "update.{{ tag_id }}" | |
| - choose: | |
| - conditions: "{{ is_state(full_entity_id, 'off') }}" | |
| sequence: | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id, 'action_data': {'tag': tag_id}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id ~ '-cl', 'action_data': {'tag': tag_id ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id ~ '-cl'} }}" | |
| - stop: "Update already completed — stale notification cleared" | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id, 'action_data': {'tag': tag_id}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id ~ '-cl', 'action_data': {'tag': tag_id ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id ~ '-cl'} }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.dismiss | |
| data: | |
| notification_id: "{{ tag_id }}" | |
| - action: update.skip | |
| data: | |
| entity_id: "{{ full_entity_id }}" | |
| - alias: Update completed | |
| conditions: "{{ trigger.id == 'done' }}" | |
| sequence: | |
| - condition: template | |
| value_template: "{{ trigger.entity_id not in exclude_entities and (not exclude_auto_update or not state_attr(trigger.entity_id, 'auto_update')) }}" | |
| - variables: | |
| tag_id: "{{ trigger.entity_id[7:] }}" | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id, 'action_data': {'tag': tag_id}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id ~ '-cl', 'action_data': {'tag': tag_id ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id ~ '-cl'} }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.dismiss | |
| data: | |
| notification_id: "{{ tag_id }}" | |
| - alias: On startup, dismiss stale notifications for updates that completed while off | |
| conditions: "{{ trigger.id == 'ha_start' }}" | |
| sequence: | |
| - repeat: | |
| for_each: "{{ states.update | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}" | |
| sequence: | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': repeat.item[7:], 'action_data': {'tag': repeat.item[7:]}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': repeat.item[7:]} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': repeat.item[7:] ~ '-cl', 'action_data': {'tag': repeat.item[7:] ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': repeat.item[7:] ~ '-cl'} }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.dismiss | |
| data: | |
| notification_id: "{{ repeat.item[7:] }}" | |
| - alias: Changelog tapped | |
| conditions: "{{ trigger.id == 'install' and (trigger.event.data.action | default('')).startswith('changelog--') }}" | |
| sequence: | |
| - variables: | |
| tag_id: "{{ trigger.event.data.action | replace('changelog--', '', 1) }}" | |
| cl_tag_id: "{{ tag_id ~ '-cl' }}" | |
| entity_id: "update.{{ tag_id }}" | |
| ids: "{{ device_attr(entity_id, 'identifiers') | default([['','']], true) | first }}" | |
| version: "{{ state_attr(entity_id, 'latest_version') | string }}" | |
| installed: "{{ state_attr(entity_id, 'installed_version') | string }}" | |
| changelog_raw: "{{ state_attr(entity_id, 'release_url') | default(changelog_urls[entity_id] | default(''), true) }}" | |
| changelog_url: "{{ changelog_raw | regex_replace('(/CHANGELOG.md)$', '\\\\1#' ~ version | regex_replace('[^-\\\\w]', '')) if changelog_raw else ('/config/app/' ~ ids[1] ~ '/info' if ids[0] == 'hassio' and ids[1] not in ['supervisor', 'OS', 'core'] else '') }}" | |
| conf_url: "{{ device_attr(entity_id, 'configuration_url') }}" | |
| url: "{{ conf_url | regex_replace('^homeassistant://', '') if conf_url is string else ('/hassio/system' if ids[0] == 'hassio' and ids[1] in ['supervisor', 'OS'] else '/config') }}" | |
| title: "{{ state_attr(entity_id, 'friendly_name') | string }}" | |
| message: "Newest version is {{ version }}<br>Installed version is {{ installed }}" | |
| pic: "{{ state_attr(entity_id, 'entity_picture') }}" | |
| changelog_action: "{{ ([{'action': 'URI', 'title': 'Changelog', 'uri': changelog_url}] if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else [{'action': 'changelog--' ~ tag_id, 'title': 'Changelog', 'url': changelog_url}]) if changelog_url.startswith('http') or changelog_url.startswith('/') else [] }}" | |
| skip_action_list: "{{ [] if ids[0] == 'hassio' and ids[1] == 'supervisor' else [{'action': 'skip-update--' ~ tag_id, 'title': 'Skip'}] }}" | |
| actions_list: "{{ changelog_action + [{'action': 'install-update--' ~ tag_id, 'title': 'Update'}] + skip_action_list }}" | |
| base_data: | |
| tag: "{{ cl_tag_id }}" | |
| _source: update-notification | |
| channel: "{{ notification_channel }}" | |
| group: "{{ notification_channel }}" | |
| notification_icon: "{{ status_bar_icon }}" | |
| clickAction: "{{ url }}" | |
| url: "{{ url }}" | |
| sticky: true | |
| actions: "{{ actions_list }}" | |
| pic_data: "{{ dict(base_data, icon_url=pic) if pic is string and (pic.startswith('http') or pic.startswith('/')) else base_data }}" | |
| final_data: "{{ dict(pic_data, image=pic) if device_attr(mobile_app_device, 'manufacturer') == 'Apple' and pic is string and pic.startswith('http') else pic_data }}" | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id, 'action_data': {'tag': tag_id}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id} }}" | |
| - choose: | |
| - conditions: "{{ device_attr(mobile_app_device, 'manufacturer') == 'Apple' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': cl_tag_id} }}" | |
| - choose: | |
| - conditions: "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| title: "{{ title }}" | |
| message: "{{ message if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else message | replace('<br>', '\n') }}" | |
| data: "{{ final_data }}" | |
| - alias: Reminders | |
| conditions: >- | |
| {% set weekday_map = { | |
| 'Monday': 1, 'Tuesday': 2, 'Wednesday': 3, 'Thursday': 4, | |
| 'Friday': 5, 'Saturday': 6, 'Sunday': 7 | |
| } %} | |
| {% if trigger.id == 'reminder' %} | |
| {{ not lazy_mode }} | |
| {% elif trigger.id == 'weekly_reminder' %} | |
| {{ lazy_mode and now().isoweekday() == weekday_map[reminder_weekday] }} | |
| {% else %} | |
| {{ false }} | |
| {% endif %} | |
| sequence: | |
| - variables: | |
| entities: "{{ (states.update | selectattr('state', 'eq', 'on') | rejectattr('attributes.in_progress', 'eq', true) | rejectattr('entity_id', 'in', exclude_entities) | rejectattr('attributes.auto_update', 'eq', true) if exclude_auto_update else states.update | selectattr('state', 'eq', 'on') | rejectattr('attributes.in_progress', 'eq', true) | rejectattr('entity_id', 'in', exclude_entities)) | map(attribute='entity_id') | list }}" | |
| - repeat: | |
| count: "{{ entities | count }}" | |
| sequence: | |
| - variables: | |
| entity_id: "{{ entities[repeat.index - 1] }}" | |
| ids: "{{ device_attr(entity_id, 'identifiers') | default([['','']], true) | first }}" | |
| tag_id: "{{ entity_id[7:] }}" | |
| version: "{{ state_attr(entity_id, 'latest_version') | string }}" | |
| installed: "{{ state_attr(entity_id, 'installed_version') | string }}" | |
| changelog_raw: "{{ state_attr(entity_id, 'release_url') | default(changelog_urls[entity_id] | default(''), true) }}" | |
| changelog_url: "{{ changelog_raw | regex_replace('(/CHANGELOG.md)$', '\\\\1#' ~ version | regex_replace('[^-\\\\w]', '')) if changelog_raw else ('/config/app/' ~ ids[1] ~ '/info' if ids[0] == 'hassio' and ids[1] not in ['supervisor', 'OS', 'core'] else '') }}" | |
| conf_url: "{{ device_attr(entity_id, 'configuration_url') }}" | |
| url: "{{ conf_url | regex_replace('^homeassistant://', '') if conf_url is string else ('/hassio/system' if ids[0] == 'hassio' and ids[1] in ['supervisor', 'OS'] else '/config') }}" | |
| title: "{{ state_attr(entity_id, 'friendly_name') | string }}" | |
| message: "Newest version is {{ version }}<br>Installed version is {{ installed }}" | |
| pic: "{{ state_attr(entity_id, 'entity_picture') }}" | |
| changelog_action: "{{ ([{'action': 'URI', 'title': 'Changelog', 'uri': changelog_url}] if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else [{'action': 'changelog--' ~ tag_id, 'title': 'Changelog', 'url': changelog_url}]) if changelog_url.startswith('http') or changelog_url.startswith('/') else [] }}" | |
| skip_action_list: "{{ [] if ids[0] == 'hassio' and ids[1] == 'supervisor' else [{'action': 'skip-update--' ~ tag_id, 'title': 'Skip'}] }}" | |
| actions_list: "{{ changelog_action + [{'action': 'install-update--' ~ tag_id, 'title': 'Update'}] + skip_action_list }}" | |
| base_data: | |
| tag: "{{ tag_id }}" | |
| _source: update-notification | |
| channel: "{{ notification_channel }}" | |
| group: "{{ notification_channel }}" | |
| notification_icon: "{{ status_bar_icon }}" | |
| clickAction: "{{ url }}" | |
| url: "{{ url }}" | |
| sticky: true | |
| actions: "{{ actions_list }}" | |
| pic_data: "{{ dict(base_data, icon_url=pic) if pic is string and (pic.startswith('http') or pic.startswith('/')) else base_data }}" | |
| fcm_data: "{{ dict(pic_data, ttl=0, priority='high') if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else pic_data }}" | |
| final_data: "{{ dict(fcm_data, image=pic) if device_attr(mobile_app_device, 'manufacturer') == 'Apple' and pic is string and pic.startswith('http') else fcm_data }}" | |
| - choose: | |
| - conditions: | |
| - "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| - condition: time | |
| after: !input only_after | |
| before: !input only_before | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| message: clear_notification | |
| data: "{{ {'tag': tag_id ~ '-cl', 'action_data': {'tag': tag_id ~ '-cl'}} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id ~ '-cl'} }}" | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| title: "{{ title }}" | |
| message: "{{ message if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else message | replace('<br>', '\n') }}" | |
| data: "{{ final_data }}" | |
| - choose: | |
| - conditions: "{{ send_to_ha }}" | |
| sequence: | |
| - action: persistent_notification.create | |
| data: | |
| notification_id: "{{ tag_id }}" | |
| title: "{{ title }}" | |
| message: "{{ message | replace('<br>', '\n') }}\n\n### More info\n- [Open]({{ url }}){{ '\n- [Changelog](' ~ changelog_url ~ ')' if changelog_url != '' else '' }}" | |
| - alias: Update started | |
| conditions: "{{ trigger.id == 'started' }}" | |
| sequence: | |
| - condition: template | |
| value_template: "{{ trigger.entity_id not in exclude_entities and (not exclude_auto_update or not state_attr(trigger.entity_id, 'auto_update')) }}" | |
| - variables: | |
| entity_id: "{{ trigger.entity_id }}" | |
| ids: "{{ device_attr(entity_id, 'identifiers') | default([['','']], true) | first }}" | |
| tag_id: "{{ entity_id[7:] }}" | |
| title: "{{ state_attr(entity_id, 'friendly_name') | string }}" | |
| conf_url: "{{ device_attr(entity_id, 'configuration_url') }}" | |
| url: "{{ conf_url | regex_replace('^homeassistant://', '') if conf_url is string else ('/hassio/system' if ids[0] == 'hassio' and ids[1] in ['supervisor', 'OS'] else '/config') }}" | |
| final_data: "{{ {'tag': tag_id, 'channel': notification_channel, 'group': notification_channel, 'notification_icon': status_bar_icon, 'clickAction': url, 'sticky': true} if device_attr(mobile_app_device, 'manufacturer') != 'Apple' else {'tag': tag_id, 'url': url, 'group': notification_channel} }}" | |
| - choose: | |
| - conditions: | |
| - "{{ mobile_app_device is string and mobile_app_device != '' }}" | |
| - condition: time | |
| after: !input only_after | |
| before: !input only_before | |
| sequence: | |
| - domain: mobile_app | |
| type: notify | |
| device_id: !input mobile_app_device | |
| title: "{{ title }}" | |
| message: "Updating..." | |
| data: "{{ final_data }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment