I currently have the following automation which notifies me of a pending firmware upgrade and asks whether I’d like to install any pending updates. I’d like to be able to extract the actual device entity ID, rather than the update domain entity ID, I’d appreciate any help
- alias: "Check for Pending Device Firmware Updates"
id: ha_check_for_pending_firmware_updates
description: "Send a Telegram message if there are pending updates for devices"
initial_state: true
trigger:
- platform: time_pattern
hours: "/1"
condition:
- condition: template
value_template: >
{{ states.update | selectattr('attributes.device_class', 'eq', 'firmware') | selectattr('state', 'eq', 'on') | list | count > 0 }}
action:
- action: notify.ohad_telegram
data:
message: >-
{% set updates = states.update | selectattr('attributes.device_class', 'eq', 'firmware') | selectattr('state', 'eq', 'on') | list %}
{% if updates | count > 0 %}
There are pending firmware updates for the following devices:
{% for update in updates %}
- {{ update.entity_id }} ({{ update.name }}) in area {{ update.attributes.area_id | default('unknown') }}
{% endfor %}
Do you want to update now?
{% else %}
There are no pending firmware updates at this time.
{% endif %}
data:
inline_keyboard:
- "Update Now:/trigger_firmware_update, Snooze Updates (EOW):/snooze_firmware_updates"