Any updates on this?
Currently i cant save it, no matter i i choose the mobile two times or one once.
The error is:
Automatisierung ist nicht verfügbar
Message malformed: extra keys not allowed @ data['neueste']
Any updates on this?
Currently i cant save it, no matter i i choose the mobile two times or one once.
The error is:
Automatisierung ist nicht verfügbar
Message malformed: extra keys not allowed @ data['neueste']
I followed the suggestion here and removed the 2nd entry for mobile device to work around the issue.
Thanks a lot, that finally works around the issue, without specify two devices.
Hope that get’s fixed in the official blueprint sometime.
pOpY
Thanks for this amazing blueprint! I’ve just installed it but i can’t configure it because my device list is empty?
While both my iphone and ipad are available in the total device list?
Hopefully someone can help me out.
Update: i’ve removed both my mobile devices from the mobile app integration and reinstalled the home assistant app on both devices, this fixed the problem.
Is this blueprint still a viable option or is there something else more up to date?
This Blueprint hasn’t been updated since 2022
Still works for me!
I just installed and it works. There is an initial issue where I had to put the same mobile device under ‘Mobile app device’ and ‘Mobile app device 2’
A modified version (just one mobile device) still works here. I can provide it, when needed.
Anyway to adopt this for the repairs count as a notification?
Here it is:
blueprint:
name: Update notifications
description: Send notifications for new updates and install or skip on action
homeassistant:
min_version: 2022.4.0
domain: automation
input:
update_entities:
name: Update entities
description:
List of update entities to watch for updates on and be notified
as soon as one is available.
selector:
entity:
domain:
- update
multiple: true
mobile_app_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
send_to_ha:
name: Send to HA
description: Send to HA as a persistent notification
default: false
selector:
boolean: {}
reminder_hours:
name: Reminder hours
description:
"If provided, will send reminders for pending updates every x hours.
NOTE: This will remind you about any pending updates every x hours, not just
the ones listed in `update_entities`. So even if you dont list every update
entity there you can still get notified pretty soon after an update."
default: "3"
selector:
select:
options:
- None
- "1"
- "2"
- "3"
- "6"
- "12"
- "24"
multiple: false
custom_value: false
take_backup:
name: Take backup
description: Do a partial backup before updating if able
default: true
selector:
boolean: {}
run_config_check:
name: Run config check
description:
"If true, this automation will start the `check configuration`
addon when a core update is available. The notification will initially say
config check is running and then update when it completes. Clicking the notification
will open that addon's logs so you can check the status. WARNING: You must
list your update entity for core in `update_entities` to use this feature."
default: false
selector:
boolean: {}
changelog_urls:
name: Changelog urls
description:
"Some update entities (ex. the ones for addons) don't have a link
to the changelog because they can't. If this bothers you then you can provide
a dictionary here. Each key should be an update entity ID and the value the
url to its changelog. This will only be used if `release_url` is `null` on
the update entity. EX. `update.adguard_home_update: https://github.com/hassio-addons/addon-adguard-home/releases/latest`
or `update.mariadb_update: https://github.com/home-assistant/addons/blob/73b8524adb7bea195a6d45790a32ebe0081d2ea4/mariadb/CHANGELOG.md`"
default: none
selector:
object: {}
only_after:
name: Only after
description: Only send notifications to mobile devices after this time
default: 00:00:00
selector:
time: {}
only_before:
name: Only before
description: Only send notifications to mobile devices before this time
default: 00:00:00
selector:
time: {}
notification_channel:
name: Channel/Group
description:
Sets the [channel](https://companion.home-assistant.io/docs/notifications/notifications-basic#notification-channels)
(android) and [group](https://companion.home-assistant.io/docs/notifications/notifications-basic#grouping)
(ios) for update notifications
default: Updates
selector:
text: {}
status_bar_icon:
name: Status bar icon
description:
"(Android only) Sets the [status bar icon](https://companion.home-assistant.io/docs/notifications/notifications-basic/#notification-icon).
NOTE: Different then the icon inside the notification, that is always set
to the entity picture of the update entity (if it has one)."
default: mdi:package-up
selector:
icon:
placeholder: mdi:package-up
source_url: https://gist.github.com/mdegat01/13d91bc293e8b98cba2c9ee932527dea
mode: parallel
max: 100
trigger_variables:
_reminder_hours: !input reminder_hours
reminder_hours: "{{ _reminder_hours | default(0) | int(0) }}"
run_config_check: !input run_config_check
update_entities: !input update_entities
trigger:
- id: new
platform: state
entity_id: !input update_entities
to: "on"
- 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
event_data:
action: install-update
- id: install_ios
platform: event
event_type: mobile_app_notification_action
event_data:
actionName: install-update
- id: skip
platform: event
event_type: mobile_app_notification_action
event_data:
action: skip-update
- id: skip_ios
platform: event
event_type: mobile_app_notification_action
event_data:
actionName: skip-update
- id: core_check
platform: template
value_template:
"{% set ns = namespace(core=none) %} {% for u in integration_entities('hassio')
| select('in', update_entities)\n if (device_attr(u, 'identifiers') | first)[1]
== 'core' %}\n {% set ns.core = u %}\n{% endfor %} {% if run_config_check and
ns.core is string and expand(ns.core) | first | attr('state') == 'on' %}\n {%
for e in expand(integration_entities('hassio')) | selectattr('attributes.device_class',
'eq', 'running')\n if (device_attr(e.entity_id, 'identifiers') | first)[1]
== 'core_check_config' %}\n {{ e.state == 'off' and e.last_changed > expand(ns.core)
| first | attr('last_changed') }}\n {% endfor %}\n{% else %}\n {{ false }}\n{%
endif %}"
- id: ha_start
platform: homeassistant
event: start
- platform: template
value_template:
"{{ states.update | selectattr('state', 'eq', 'on') | list | count
> 0\n and reminder_hours > 0 and now().hour % reminder_hours == 0\n and now().minute
== 0 and now().second == 0 }}"
- id: sticky_ios
platform: event
event_type: mobile_app_notification_action
event_data:
action: URI
variables:
mobile_app_device: !input mobile_app_device
send_to_ha: !input send_to_ha
_changelog_urls: !input changelog_urls
changelog_urls: "{{ _changelog_urls if _changelog_urls is mapping else {} }}"
take_backup: !input take_backup
core_update_entity:
"{% for u in integration_entities('hassio') | select('search',
'^update[.]')\n if (device_attr(u, 'identifiers') | first)[1] == 'core'
%}\n {{ u }}\n{% endfor %}"
os_update_entity:
"{% for u in integration_entities('hassio') | select('search',
'^update[.]')\n if (device_attr(u, 'identifiers') | first)[1] == 'OS' %}\n
\ {{ u }}\n{% endfor %}"
skip_action:
action: skip-update
title: Skip
destructive: true
authenticationRequired: true
update_action:
action: install-update
title: Update
destructive: true
authenticationRequired: true
action:
choose:
- alias: Install update action
conditions: "{{ trigger.id in ['install', 'install_ios'] }}"
sequence:
- variables:
entity_id:
"update.{{ trigger.event.data.tag\n if trigger.event.data.tag
is string and trigger.event.data.tag != ''\n else trigger.event.data.action_data.tag
}}"
- service: update.install
data:
entity_id: "{{ entity_id }}"
backup:
"{% set ids = device_attr(entity_id, 'identifiers') | first %} {{
take_backup and ids[0] == 'hassio' and ids[1] not in ['supervisor',
'OS'] }}"
- alias: Skip update action
conditions: "{{ trigger.id in ['skip', 'skip_ios'] }}"
sequence:
service: update.skip
data:
entity_id:
"update.{{ trigger.event.data.tag\n if trigger.event.data.tag
is string and trigger.event.data.tag != ''\n else trigger.event.data.action_data.tag
}}"
- alias: Update completed
conditions: "{{ trigger.id == 'done' }}"
sequence:
- &id004
variables:
entity_id: "{{ trigger.entity_id }}"
- &id001
variables:
message: clear_notification
data:
tag: "{{ entity_id[7:] }}"
- &id002
choose: []
default:
- variables:
data: "{{ dict(data, action_data={'tag': data.tag}) }}"
- choose:
alias: Send to first mobile device if specified
conditions: "{{ not not mobile_app_device }}"
sequence:
device_id: !input mobile_app_device
domain: mobile_app
type: notify
title: "{{ title | default('') }}"
message:
"{{ message if device_attr(mobile_app_device, 'manufacturer')
!= 'Apple'\n else message | replace('<br>', '\\n') }}"
data:
"{{ data if\n device_attr(mobile_app_device, 'manufacturer')
!= 'Apple' or data.icon_url is not string\n else dict(data, image=data.icon_url)
}}"
- &id003
alias: Dismiss from HA if replicating there
choose:
conditions: "{{ send_to_ha }}"
sequence:
service: persistent_notification.dismiss
data:
notification_id: "{{ entity_id[7:] }}"
- alias: On startup, dismiss core and os notifications as they occurred while off
conditions: "{{ trigger.id == 'ha_start' }}"
sequence:
- alias: Dismiss core update notification if off
choose:
conditions:
"{{ core_update_entity != '' and expand(core_update_entity)
| first | attr('state') == 'off' }}"
sequence:
- variables:
entity_id: "{{ core_update_entity }}"
- *id001
- *id002
- *id003
- alias: Dismiss os update notification if off
choose:
conditions:
"{{ os_update_entity != '' and expand(os_update_entity) | first
| attr('state') == 'off' }}"
sequence:
- variables:
entity_id: "{{ os_update_entity }}"
- *id001
- *id002
- *id003
- alias: New update available
conditions: "{{ trigger.id == 'new' }}"
sequence:
- *id004
- &id005
variables:
ids: "{{ device_attr(entity_id, 'identifiers') | first }}"
changelog_action:
action: URI
title: Changelog
uri:
"{% set version = state_attr(entity_id, 'latest_version') %} {{ state_attr(entity_id,
'release_url')\n | default(changelog_urls[entity_id] | default(''),
true)\n | regex_replace('(/CHANGELOG.md)$', '\\\\1#' ~ version | regex_replace('[^-\\\\w]'))\n
\ | default(None, true) }}"
include_core_check:
"{{ run_config_check and ids[0] == 'hassio' and ids[1]
== 'core' }}"
core_check_complete:
"{% set ns = namespace(core=none) %} {% for u in integration_entities('hassio')
| select('in', update_entities)\n if (device_attr(u, 'identifiers')
| first)[1] == 'core' %}\n {% set ns.core = u %}\n{% endfor %} {% if
run_config_check and ns.core is string and expand(ns.core) | first | attr('state')
== 'on' %}\n {% for e in expand(integration_entities('hassio')) | selectattr('attributes.device_class',
'eq', 'running')\n if (device_attr(e.entity_id, 'identifiers') |
first)[1] == 'core_check_config' %}\n {{ e.state == 'off' and e.last_changed
> expand(ns.core) | first | attr('last_changed') }}\n {% endfor %}\n{%
else %}\n {{ false }}\n{% endif %}"
title: "{{ state_attr(entity_id, 'friendly_name') }}"
message:
"{% set summary = state_attr(entity_id, 'release_summary') %} Newest
version is {{ state_attr(entity_id, 'latest_version') }}<br> Installed version
is {{ state_attr(entity_id, 'installed_version') }} {% if include_core_check
%}\n <br>Config check has {{ 'completed, check addon logs for status.'\n
\ if core_check_complete else 'started, should be done soon.' }}\n{% endif
%} {{ '<br>' ~ summary if summary is string }}"
url:
"{% set url = device_attr(entity_id, 'configuration_url') %} {% set ids
= device_attr(entity_id, 'identifiers') | first %} {% if url is string %}\n
\ {{ url | regex_replace('^homeassistant://') }}\n{% elif ids[0] == 'hassio'
and ids[1] in ['supervisor', 'OS'] %}\n /hassio/system\n{% elif run_config_check
and ids[0] == 'hassio' and ids[1] == 'core' %}\n /hassio/addon/core_check_config/logs\n{%
else %}\n /config\n{% endif %}"
data:
tag: "{{ entity_id[7:] }}"
channel: !input notification_channel
group: !input notification_channel
notification_icon: !input status_bar_icon
icon_url:
"{{ state_attr(entity_id, 'entity_picture') | default('',
true) }}"
url: "{{ url }}"
clickAction: "{{ url }}"
sticky: "true"
actions:
"{{ ([changelog_action] if changelog_action.uri is string else
[]) + [update_action] +\n ([] if ids[0] == 'hassio' and ids[1] == 'supervisor'
else [skip_action]) }}"
- &id007
choose:
alias: Only send to mobile devices if within provided time range
conditions:
condition: time
after: !input only_after
before: !input only_before
sequence: *id002
- &id006
alias: Send to HA if replicating there
choose:
conditions: "{{ send_to_ha }}"
sequence:
service: persistent_notification.create
data:
notification_id: "{{ entity_id[7:] }}"
title: "{{ title }}"
message:
"{{ '%s\\n\\n### More info\\n- [Open](%s)' % (message | replace('<br>',
'\\n'), data.url) ~\n ('\\n- [Changelog](%s)' % changelog_action.uri
if changelog_action.uri is string else '') }}"
- alias: Stop if this isn't core or we're not running a config check
condition: "{{ include_core_check }}"
- alias: Start config check addon
service: hassio.addon_start
data:
addon: core_check_config
- alias: Emulate sticky on IOS by recreating the notification
conditions:
- "{{ trigger.id == 'sticky_ios' }}"
- "{{ trigger.event.data.action_data is mapping and trigger.event.data.action_data.tag
is string }}"
- "{{ is_state('update.' ~ trigger.event.data.action_data.tag, 'on') }}"
sequence:
- variables:
entity_id:
"update.{{ trigger.event.data.tag\n if trigger.event.data.tag
is string and trigger.event.data.tag != ''\n else trigger.event.data.action_data.tag
}}"
- *id005
- *id002
- *id006
- alias: Core check addon completed
conditions: "{{ trigger.id == 'core_check' }}"
sequence:
- variables:
entity_id: "{{ core_update_entity }}"
- *id005
- *id007
- *id006
- alias: Update started
conditions: "{{ trigger.id == 'started' }}"
sequence:
- *id004
- *id005
- variables:
message: Updating...
data:
"{{ dict(data, actions=[changelog_action] if changelog_action.uri is
string else []) }}"
- *id007
- *id006
- alias: Send reminders if enabled
conditions: "{{ reminder_hours > 0 }}"
sequence:
- alias: Get all pending, unstarted updates
variables:
updates:
"{{ states.update\n | selectattr('state', 'eq', 'on')\n | rejectattr('attributes.in_progress',
'true')\n | map(attribute='entity_id') | list }}"
- alias: Loop over updates and send reminder
repeat:
count: "{{ updates | count }}"
sequence:
- variables:
entity_id: "{{ updates[repeat.index - 1] }}"
- *id005
- *id007
- *id006
Thank you!
You’re welcome.
My apologies if this is to far off topic and should be posted elsewhere. Just let me know,
I have been having issues with a loooong installed blueprint (Update notifications) including recent log errors, so after researching blueprints learned (I beleve) that a blueprint is a STATIC import from GIST w/o any version info (yes I looked at some automation that are looking at ways to automate their updates butt DO NOT want to muddy the water by going down that path for the moment.
Anyways back to the issue(s). Given the static nature prevailing wisdom seems to. be simple reimport the BP, and assuming the inputs don’t vary significantly between when you ORIGINALLY imported (and created the automation(s) that use the BP), your automations should pick up any changes that were published two Github… This is my ASSUMPTION, PLEASE correct me if I am wrong…
Now on why any of this is relevant here… When I still had issues (including the need to double list my phone for notification as is well documented), I thought being a good former Engineer I would double check not just the mod date of blueprint I have locally but also the source. I diff’d my local copy (even updated again today), and compared it to Mike’s posted GIST and the two do not match ?!?
What am I missing in may understanding? Github says @CentralCommand updated GitHub 2 wks ago and I refreshed today. I can post the FULL text of my local copy stored in /blueprints/automation/mdegat01/update_notifications.yaml if that is helpful just didn’t want to spam the group. I can also discuss the logged error but again wan ted to do MY best to troubleshoot by making sure I have the CURRENT blueprint BEFORE asking for help It’s the engineer in me…
Thanks for any help insight.
@taw123 use my modified version here: Update notifications (Core, OS, Addons, HACS, etc) - #131 by pOpY
In this i have removed the second notification target, so the issue don’t pop’s up.
Yes, when you replace the blueprint and not much changed (like in mine), your automations jus works as before.
The modded version works without issues for me on HA Core 2024-06.
Did you manage to get this working? I’m very new to the platform and am struggling with some of these complexities - but would love to have email notifications when updates are available - so, if you could share an anonymised version of your code, that would be awesome.
Is there an updated blueprint? The HACS 2.0 update broke some linking in the notifications…
Hello, would it be possible to add other communication options? Since my HA runs locally and I don’t have it on the internet, the notifications don’t work via the app. With other blueprints, I can add pushover, for example, and get my messages through it.
Mine is also not on the internet directly. I am using wireguard on my router and wgtunnel android App for switching automatically wireguard on/off when I am away/home. So my HA is always reachable and notifications are coming through.