Add album created and updated date placeholders
Added {album_created} and {album_updated} placeholders to album-related
templates, using the existing date_format for formatting:
- periodic_album_template: reads from entity attributes
- scheduled_assets_message: reads from entity attributes (per_album/random mode)
- message_assets_added: looks up entity by event_album_id
- message_assets_removed: looks up entity by event_album_id
- message_asset_image/video: added placeholders
For combined mode, album dates are empty (no single album).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -147,7 +147,7 @@ blueprint:
|
|||||||
name: "Assets Added Message"
|
name: "Assets Added Message"
|
||||||
description: >
|
description: >
|
||||||
Message sent when assets are added to an album.
|
Message sent when assets are added to an album.
|
||||||
Variables: `{album_name}`, `{album_url}`, `{added_count}`, `{people}`, `{assets}`, `{video_warning}`, `{common_date}`, `{common_location}`
|
Variables: `{album_name}`, `{album_url}`, `{album_created}`, `{album_updated}`, `{added_count}`, `{people}`, `{assets}`, `{video_warning}`, `{common_date}`, `{common_location}`
|
||||||
default: "📷 {added_count} new photo(s) added to album \"{album_name}\"{common_date}{common_location}.{people}{assets}{video_warning}"
|
default: "📷 {added_count} new photo(s) added to album \"{album_name}\"{common_date}{common_location}.{people}{assets}{video_warning}"
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
@@ -157,7 +157,7 @@ blueprint:
|
|||||||
name: "Assets Removed Message"
|
name: "Assets Removed Message"
|
||||||
description: >
|
description: >
|
||||||
Message sent when assets are removed from an album.
|
Message sent when assets are removed from an album.
|
||||||
Variables: `{album_name}`, `{album_url}`, `{removed_count}`
|
Variables: `{album_name}`, `{album_url}`, `{album_created}`, `{album_updated}`, `{removed_count}`
|
||||||
default: "🗑️ {removed_count} photo(s) removed from album \"{album_name}\"."
|
default: "🗑️ {removed_count} photo(s) removed from album \"{album_name}\"."
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
@@ -198,7 +198,7 @@ blueprint:
|
|||||||
name: "Image Asset Template"
|
name: "Image Asset Template"
|
||||||
description: >
|
description: >
|
||||||
Template for IMAGE assets in the list. Also used for Telegram media captions.
|
Template for IMAGE assets in the list. Also used for Telegram media captions.
|
||||||
Variables: `{filename}`, `{description}`, `{type}`, `{created}`, `{created_if_unique}`, `{owner}`, `{url}`, `{download_url}`, `{photo_url}`, `{playback_url}`, `{people}`, `{album_name}`, `{is_favorite}`, `{rating}`, `{location}`, `{location_if_unique}`, `{city}`, `{state}`, `{country}`
|
Variables: `{filename}`, `{description}`, `{type}`, `{created}`, `{created_if_unique}`, `{owner}`, `{url}`, `{download_url}`, `{photo_url}`, `{playback_url}`, `{people}`, `{album_name}`, `{album_created}`, `{album_updated}`, `{is_favorite}`, `{rating}`, `{location}`, `{location_if_unique}`, `{city}`, `{state}`, `{country}`
|
||||||
default: "\n • 🖼️ {filename}"
|
default: "\n • 🖼️ {filename}"
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
@@ -208,7 +208,7 @@ blueprint:
|
|||||||
name: "Video Asset Template"
|
name: "Video Asset Template"
|
||||||
description: >
|
description: >
|
||||||
Template for VIDEO assets in the list. Also used for Telegram media captions.
|
Template for VIDEO assets in the list. Also used for Telegram media captions.
|
||||||
Variables: `{filename}`, `{description}`, `{type}`, `{created}`, `{created_if_unique}`, `{owner}`, `{url}`, `{download_url}`, `{photo_url}`, `{playback_url}`, `{people}`, `{album_name}`, `{is_favorite}`, `{rating}`, `{location}`, `{location_if_unique}`, `{city}`, `{state}`, `{country}`
|
Variables: `{filename}`, `{description}`, `{type}`, `{created}`, `{created_if_unique}`, `{owner}`, `{url}`, `{download_url}`, `{photo_url}`, `{playback_url}`, `{people}`, `{album_name}`, `{album_created}`, `{album_updated}`, `{is_favorite}`, `{rating}`, `{location}`, `{location_if_unique}`, `{city}`, `{state}`, `{country}`
|
||||||
default: "\n • 🎬 {filename}"
|
default: "\n • 🎬 {filename}"
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
@@ -469,7 +469,7 @@ blueprint:
|
|||||||
name: Album Item Template
|
name: Album Item Template
|
||||||
description: >
|
description: >
|
||||||
Template for each album in the summary list.
|
Template for each album in the summary list.
|
||||||
Variables: `{album_name}`, `{album_id}`, `{album_url}`
|
Variables: `{album_name}`, `{album_id}`, `{album_url}`, `{album_created}`, `{album_updated}`
|
||||||
default: "\n • {album_name}: {album_url}"
|
default: "\n • {album_name}: {album_url}"
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
@@ -629,9 +629,10 @@ blueprint:
|
|||||||
name: Message Template
|
name: Message Template
|
||||||
description: >
|
description: >
|
||||||
Message template for scheduled asset notifications.
|
Message template for scheduled asset notifications.
|
||||||
Variables: `{album_name}`, `{album_url}`, `{asset_count}`, `{assets}`, `{common_date}`, `{common_location}`.
|
Variables: `{album_name}`, `{album_url}`, `{album_created}`, `{album_updated}`, `{asset_count}`, `{assets}`, `{common_date}`, `{common_location}`.
|
||||||
`{common_date}` shows the date when all assets share the same date.
|
`{common_date}` shows the date when all assets share the same date.
|
||||||
`{common_location}` shows the location when all assets share the same location.
|
`{common_location}` shows the location when all assets share the same location.
|
||||||
|
`{album_created}` and `{album_updated}` are empty in combined mode.
|
||||||
default: "📸 Here are some photos from album \"{album_name}\":{assets}"
|
default: "📸 Here are some photos from album \"{album_name}\":{assets}"
|
||||||
selector:
|
selector:
|
||||||
text:
|
text:
|
||||||
@@ -842,6 +843,33 @@ variables:
|
|||||||
event_old_name: "{{ trigger.event.data.old_name | default('') if trigger.event is defined else '' }}"
|
event_old_name: "{{ trigger.event.data.old_name | default('') if trigger.event is defined else '' }}"
|
||||||
event_new_name: "{{ trigger.event.data.new_name | default('') if trigger.event is defined else '' }}"
|
event_new_name: "{{ trigger.event.data.new_name | default('') if trigger.event is defined else '' }}"
|
||||||
|
|
||||||
|
# Album dates (look up from entity using event_album_id)
|
||||||
|
# Find the entity that has this album ID and get its created_at/updated_at attributes
|
||||||
|
event_album_entity: >
|
||||||
|
{% if trigger.event is defined %}
|
||||||
|
{% for entity_id in album_id_entities %}
|
||||||
|
{% if states(entity_id) == event_album_id %}
|
||||||
|
{{ entity_id }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
event_album_created: >
|
||||||
|
{% if event_album_entity | length > 0 %}
|
||||||
|
{% set created_attr = state_attr(event_album_entity | trim, 'created_at') | default('', true) %}
|
||||||
|
{% set created_dt = created_attr | as_datetime(none) if created_attr is string and created_attr | length > 0 else none %}
|
||||||
|
{{ created_dt.strftime(date_format) if created_dt else '' }}
|
||||||
|
{% else %}
|
||||||
|
{{ '' }}
|
||||||
|
{% endif %}
|
||||||
|
event_album_updated: >
|
||||||
|
{% if event_album_entity | length > 0 %}
|
||||||
|
{% set updated_attr = state_attr(event_album_entity | trim, 'updated_at') | default('', true) %}
|
||||||
|
{% set updated_dt = updated_attr | as_datetime(none) if updated_attr is string and updated_attr | length > 0 else none %}
|
||||||
|
{{ updated_dt.strftime(date_format) if updated_dt else '' }}
|
||||||
|
{% else %}
|
||||||
|
{{ '' }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Computed Values
|
# Computed Values
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -959,6 +987,8 @@ variables:
|
|||||||
| replace('{playback_url}', asset.playback_url | default(''))
|
| replace('{playback_url}', asset.playback_url | default(''))
|
||||||
| replace('{people}', (asset.people | default([])) | join(', '))
|
| replace('{people}', (asset.people | default([])) | join(', '))
|
||||||
| replace('{album_name}', event_album_name)
|
| replace('{album_name}', event_album_name)
|
||||||
|
| replace('{album_created}', event_album_created)
|
||||||
|
| replace('{album_updated}', event_album_updated)
|
||||||
| replace('{is_favorite}', is_favorite)
|
| replace('{is_favorite}', is_favorite)
|
||||||
| replace('{rating}', rating)
|
| replace('{rating}', rating)
|
||||||
| replace('{location}', formatted_location)
|
| replace('{location}', formatted_location)
|
||||||
@@ -1048,7 +1078,7 @@ variables:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Format the albums list for periodic summary
|
# Format the albums list for periodic summary
|
||||||
# Reads album name and share URL from album ID entity's attributes
|
# Reads album name, share URL, and dates from album ID entity's attributes
|
||||||
periodic_albums_list: >
|
periodic_albums_list: >
|
||||||
{% set ns = namespace(items = '') %}
|
{% set ns = namespace(items = '') %}
|
||||||
{% for i in range(album_id_entities | length) %}
|
{% for i in range(album_id_entities | length) %}
|
||||||
@@ -1059,10 +1089,18 @@ variables:
|
|||||||
{% set name = name_attr if name_attr not in [none, '', 'unknown', 'unavailable'] else id %}
|
{% set name = name_attr if name_attr not in [none, '', 'unknown', 'unavailable'] else id %}
|
||||||
{% set url_attr = state_attr(entity_id, 'share_url') %}
|
{% set url_attr = state_attr(entity_id, 'share_url') %}
|
||||||
{% set url = url_attr if url_attr not in [none, 'unknown', 'unavailable'] else '' %}
|
{% set url = url_attr if url_attr not in [none, 'unknown', 'unavailable'] else '' %}
|
||||||
|
{% set created_attr = state_attr(entity_id, 'created_at') | default('', true) %}
|
||||||
|
{% set created_dt = created_attr | as_datetime(none) if created_attr is string and created_attr | length > 0 else none %}
|
||||||
|
{% set album_created = created_dt.strftime(date_format) if created_dt else '' %}
|
||||||
|
{% set updated_attr = state_attr(entity_id, 'updated_at') | default('', true) %}
|
||||||
|
{% set updated_dt = updated_attr | as_datetime(none) if updated_attr is string and updated_attr | length > 0 else none %}
|
||||||
|
{% set album_updated = updated_dt.strftime(date_format) if updated_dt else '' %}
|
||||||
{% set item = periodic_album_template
|
{% set item = periodic_album_template
|
||||||
| replace('{album_name}', name)
|
| replace('{album_name}', name)
|
||||||
| replace('{album_id}', id)
|
| replace('{album_id}', id)
|
||||||
| replace('{album_url}', url) %}
|
| replace('{album_url}', url)
|
||||||
|
| replace('{album_created}', album_created)
|
||||||
|
| replace('{album_updated}', album_updated) %}
|
||||||
{% set ns.items = ns.items ~ item %}
|
{% set ns.items = ns.items ~ item %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -1187,6 +1225,14 @@ action:
|
|||||||
current_album_url: >
|
current_album_url: >
|
||||||
{% set url_attr = state_attr(current_album_entity, 'share_url') %}
|
{% set url_attr = state_attr(current_album_entity, 'share_url') %}
|
||||||
{{ url_attr if url_attr not in [none, 'unknown', 'unavailable'] else '' }}
|
{{ url_attr if url_attr not in [none, 'unknown', 'unavailable'] else '' }}
|
||||||
|
current_album_created: >
|
||||||
|
{% set created_attr = state_attr(current_album_entity, 'created_at') | default('', true) %}
|
||||||
|
{% set created_dt = created_attr | as_datetime(none) if created_attr is string and created_attr | length > 0 else none %}
|
||||||
|
{{ created_dt.strftime(date_format) if created_dt else '' }}
|
||||||
|
current_album_updated: >
|
||||||
|
{% set updated_attr = state_attr(current_album_entity, 'updated_at') | default('', true) %}
|
||||||
|
{% set updated_dt = updated_attr | as_datetime(none) if updated_attr is string and updated_attr | length > 0 else none %}
|
||||||
|
{{ updated_dt.strftime(date_format) if updated_dt else '' }}
|
||||||
|
|
||||||
# Build service data dynamically (omit optional params when not set)
|
# Build service data dynamically (omit optional params when not set)
|
||||||
- variables:
|
- variables:
|
||||||
@@ -1307,6 +1353,8 @@ action:
|
|||||||
| replace('{playback_url}', asset.playback_url | default(''))
|
| replace('{playback_url}', asset.playback_url | default(''))
|
||||||
| replace('{people}', (asset.people | default([])) | join(', '))
|
| replace('{people}', (asset.people | default([])) | join(', '))
|
||||||
| replace('{album_name}', current_album_name)
|
| replace('{album_name}', current_album_name)
|
||||||
|
| replace('{album_created}', current_album_created)
|
||||||
|
| replace('{album_updated}', current_album_updated)
|
||||||
| replace('{is_favorite}', is_favorite)
|
| replace('{is_favorite}', is_favorite)
|
||||||
| replace('{rating}', rating)
|
| replace('{rating}', rating)
|
||||||
| replace('{location}', formatted_location)
|
| replace('{location}', formatted_location)
|
||||||
@@ -1323,6 +1371,8 @@ action:
|
|||||||
{{ scheduled_assets_message_template
|
{{ scheduled_assets_message_template
|
||||||
| replace('{album_name}', current_album_name)
|
| replace('{album_name}', current_album_name)
|
||||||
| replace('{album_url}', current_album_url)
|
| replace('{album_url}', current_album_url)
|
||||||
|
| replace('{album_created}', current_album_created)
|
||||||
|
| replace('{album_updated}', current_album_updated)
|
||||||
| replace('{asset_count}', fetched_asset_count | string)
|
| replace('{asset_count}', fetched_asset_count | string)
|
||||||
| replace('{common_date}', sched_common_date)
|
| replace('{common_date}', sched_common_date)
|
||||||
| replace('{common_location}', sched_common_location)
|
| replace('{common_location}', sched_common_location)
|
||||||
@@ -1555,6 +1605,8 @@ action:
|
|||||||
| replace('{playback_url}', asset.playback_url | default(''))
|
| replace('{playback_url}', asset.playback_url | default(''))
|
||||||
| replace('{people}', (asset.people | default([])) | join(', '))
|
| replace('{people}', (asset.people | default([])) | join(', '))
|
||||||
| replace('{album_name}', combined_album_names)
|
| replace('{album_name}', combined_album_names)
|
||||||
|
| replace('{album_created}', '')
|
||||||
|
| replace('{album_updated}', '')
|
||||||
| replace('{is_favorite}', is_favorite)
|
| replace('{is_favorite}', is_favorite)
|
||||||
| replace('{rating}', rating)
|
| replace('{rating}', rating)
|
||||||
| replace('{location}', formatted_location)
|
| replace('{location}', formatted_location)
|
||||||
@@ -1571,6 +1623,8 @@ action:
|
|||||||
{{ scheduled_assets_message_template
|
{{ scheduled_assets_message_template
|
||||||
| replace('{album_name}', combined_album_names)
|
| replace('{album_name}', combined_album_names)
|
||||||
| replace('{album_url}', '')
|
| replace('{album_url}', '')
|
||||||
|
| replace('{album_created}', '')
|
||||||
|
| replace('{album_updated}', '')
|
||||||
| replace('{asset_count}', combined_asset_count | string)
|
| replace('{asset_count}', combined_asset_count | string)
|
||||||
| replace('{common_date}', comb_common_date)
|
| replace('{common_date}', comb_common_date)
|
||||||
| replace('{common_location}', comb_common_location)
|
| replace('{common_location}', comb_common_location)
|
||||||
@@ -1720,6 +1774,8 @@ action:
|
|||||||
{%- set msg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
|
{%- set msg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
|
||||||
{{ tpl | replace('{album_name}', event_album_name)
|
{{ tpl | replace('{album_name}', event_album_name)
|
||||||
| replace('{album_url}', event_album_url)
|
| replace('{album_url}', event_album_url)
|
||||||
|
| replace('{album_created}', event_album_created)
|
||||||
|
| replace('{album_updated}', event_album_updated)
|
||||||
| replace('{added_count}', filtered_added_count | string)
|
| replace('{added_count}', filtered_added_count | string)
|
||||||
| replace('{people}', people_list)
|
| replace('{people}', people_list)
|
||||||
| replace('{assets}', assets_list)
|
| replace('{assets}', assets_list)
|
||||||
@@ -1745,6 +1801,8 @@ action:
|
|||||||
{% set tpl = message_assets_removed_template %}
|
{% set tpl = message_assets_removed_template %}
|
||||||
{{ tpl | replace('{album_name}', event_album_name)
|
{{ tpl | replace('{album_name}', event_album_name)
|
||||||
| replace('{album_url}', event_album_url)
|
| replace('{album_url}', event_album_url)
|
||||||
|
| replace('{album_created}', event_album_created)
|
||||||
|
| replace('{album_updated}', event_album_updated)
|
||||||
| replace('{removed_count}', event_removed_count | string) }}
|
| replace('{removed_count}', event_removed_count | string) }}
|
||||||
|
|
||||||
- service: notify.send_message
|
- service: notify.send_message
|
||||||
@@ -1774,6 +1832,8 @@ action:
|
|||||||
{%- set chg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
|
{%- set chg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
|
||||||
{{ tpl | replace('{album_name}', event_album_name)
|
{{ tpl | replace('{album_name}', event_album_name)
|
||||||
| replace('{album_url}', event_album_url)
|
| replace('{album_url}', event_album_url)
|
||||||
|
| replace('{album_created}', event_album_created)
|
||||||
|
| replace('{album_updated}', event_album_updated)
|
||||||
| replace('{added_count}', filtered_added_count | string)
|
| replace('{added_count}', filtered_added_count | string)
|
||||||
| replace('{people}', people_list)
|
| replace('{people}', people_list)
|
||||||
| replace('{assets}', assets_list)
|
| replace('{assets}', assets_list)
|
||||||
@@ -1798,6 +1858,8 @@ action:
|
|||||||
{% set tpl = message_assets_removed_template %}
|
{% set tpl = message_assets_removed_template %}
|
||||||
{{ tpl | replace('{album_name}', event_album_name)
|
{{ tpl | replace('{album_name}', event_album_name)
|
||||||
| replace('{album_url}', event_album_url)
|
| replace('{album_url}', event_album_url)
|
||||||
|
| replace('{album_created}', event_album_created)
|
||||||
|
| replace('{album_updated}', event_album_updated)
|
||||||
| replace('{removed_count}', event_removed_count | string) }}
|
| replace('{removed_count}', event_removed_count | string) }}
|
||||||
|
|
||||||
- service: notify.send_message
|
- service: notify.send_message
|
||||||
@@ -1954,6 +2016,8 @@ action:
|
|||||||
{%- set tg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
|
{%- set tg_video_warning = telegram_video_warning_template if (send_telegram_media and has_videos_in_assets and telegram_video_warning_template | length > 0) else '' -%}
|
||||||
{{ tpl | replace('{album_name}', event_album_name)
|
{{ tpl | replace('{album_name}', event_album_name)
|
||||||
| replace('{album_url}', event_album_url)
|
| replace('{album_url}', event_album_url)
|
||||||
|
| replace('{album_created}', event_album_created)
|
||||||
|
| replace('{album_updated}', event_album_updated)
|
||||||
| replace('{added_count}', filtered_added_count | string)
|
| replace('{added_count}', filtered_added_count | string)
|
||||||
| replace('{people}', people_list)
|
| replace('{people}', people_list)
|
||||||
| replace('{assets}', assets_list)
|
| replace('{assets}', assets_list)
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "1.22.10"
|
"version": "1.23.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user