That album ids entities which also provide with required attributes. Change default datetime format.
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s

This commit is contained in:
2026-01-30 16:12:33 +03:00
parent 26583a76d2
commit f30ed433fd
2 changed files with 43 additions and 46 deletions

View File

@@ -95,9 +95,8 @@
# #
# Periodic Summary: # Periodic Summary:
# Sends a summary notification of tracked albums at regular intervals. # Sends a summary notification of tracked albums at regular intervals.
# Configure Album Names and Album Share URL Entities (in matching order) to # Album names and share URLs are automatically read from the Album ID Entity's
# include album links in the summary. URL entities can be sensors or input_text # `album_name` and `share_url` attributes (if available).
# helpers containing the share URL for each album.
# #
# Summary Message Template Variables: # Summary Message Template Variables:
# - `{albums}` - Formatted list of albums (using album item template) # - `{albums}` - Formatted list of albums (using album item template)
@@ -140,35 +139,15 @@ blueprint:
text: text:
multiple: true multiple: true
album_ids: album_id_entities:
name: Album IDs to Track name: Album ID Entities
description: > description: >
List of album IDs to monitor for changes. List of sensor or input_text entities containing album IDs to monitor.
Only albums matching these IDs will trigger notifications. Only albums matching these IDs will trigger notifications.
Leave empty to track all albums. Leave empty to track all albums.
Album IDs are stable and won't change if albums get renamed. Album IDs are stable and won't change if albums get renamed.
default: [] Album names and share URLs are automatically read from the entity's
selector: `album_name` and `share_url` attributes for periodic summary notifications.
text:
multiple: true
album_names:
name: Album Display Names
description: >
List of album display names (in the same order as Album IDs).
Used for periodic summary notifications to show human-readable album names.
If not specified, album names from events will be used.
default: []
selector:
text:
multiple: true
album_url_entities:
name: Album Share URL Entities
description: >
List of sensor or input_text entities containing share URLs for each album
(in the same order as Album Names). Used for periodic summary notifications.
Each entity's state should contain the album's share URL.
default: [] default: []
selector: selector:
entity: entity:
@@ -330,7 +309,9 @@ blueprint:
description: > description: >
Format for displaying asset creation dates. Format for displaying asset creation dates.
Uses Python strftime format codes (e.g., %Y-%m-%d %H:%M). Uses Python strftime format codes (e.g., %Y-%m-%d %H:%M).
default: "%d %b %Y, %H:%M" Note: Month names (%b, %B) use system locale (typically English).
Use numeric format (%m) for locale-independent dates.
default: "%d.%m.%Y, %H:%M"
selector: selector:
text: text:
@@ -530,9 +511,19 @@ variables:
# Input Variables # Input Variables
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
hub_names: !input hub_names hub_names: !input hub_names
album_ids: !input album_ids album_id_entities: !input album_id_entities
album_names: !input album_names
album_url_entities: !input album_url_entities # Read album IDs from entity states
album_ids: >
{% set ns = namespace(ids = []) %}
{% for entity_id in album_id_entities %}
{% set value = states(entity_id) | default('') | trim %}
{% if value | length > 0 and value not in ['unknown', 'unavailable'] %}
{% set ns.ids = ns.ids + [value] %}
{% endif %}
{% endfor %}
{{ ns.ids }}
notify_targets: !input notify_targets notify_targets: !input notify_targets
include_people: !input include_people include_people: !input include_people
include_asset_details: !input include_asset_details include_asset_details: !input include_asset_details
@@ -647,7 +638,8 @@ variables:
{% for asset in assets_to_show %} {% for asset in assets_to_show %}
{% set asset_template = message_asset_video_template if asset.asset_type == 'VIDEO' else message_asset_image_template %} {% set asset_template = message_asset_video_template if asset.asset_type == 'VIDEO' else message_asset_image_template %}
{% set raw_date = asset.asset_created | default('') %} {% set raw_date = asset.asset_created | default('') %}
{% set formatted_date = raw_date | as_datetime | strftime(date_format) if raw_date | length > 0 else '' %} {% set dt = raw_date | as_datetime(none) if raw_date | length > 0 else none %}
{% set formatted_date = dt.strftime(date_format) if dt else '' %}
{% set item = asset_template {% set item = asset_template
| replace('{filename}', asset.asset_filename | default('Unknown')) | replace('{filename}', asset.asset_filename | default('Unknown'))
| replace('{description}', asset.asset_description | default('')) | replace('{description}', asset.asset_description | default(''))
@@ -723,19 +715,23 @@ variables:
{% endif %} {% endif %}
# Format the albums list for periodic summary # Format the albums list for periodic summary
# Reads URLs from entity states (sensor or input_text) # Reads album name and share URL 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_ids | length) %} {% for i in range(album_id_entities | length) %}
{% set id = album_ids[i] %} {% set entity_id = album_id_entities[i] %}
{% set name = album_names[i] if i < (album_names | length) else id %} {% set id = states(entity_id) | default('') %}
{% set url_entity = album_url_entities[i] | default('') if i < (album_url_entities | length) else '' %} {% if id | length > 0 and id not in ['unknown', 'unavailable'] %}
{% set url = states(url_entity) | default('') if url_entity | length > 0 else '' %} {% set name_attr = state_attr(entity_id, 'album_name') %}
{% set item = periodic_album_template {% set name = name_attr if name_attr not in [none, '', 'unknown', 'unavailable'] else id %}
| replace('{album_name}', name) {% set url_attr = state_attr(entity_id, 'share_url') %}
| replace('{album_id}', id) {% set url = url_attr if url_attr not in [none, 'unknown', 'unavailable'] else '' %}
| replace('{album_url}', url) %} {% set item = periodic_album_template
{% set ns.items = ns.items ~ item %} | replace('{album_name}', name)
| replace('{album_id}', id)
| replace('{album_url}', url) %}
{% set ns.items = ns.items ~ item %}
{% endif %}
{% endfor %} {% endfor %}
{{ ns.items }} {{ ns.items }}
@@ -1047,7 +1043,8 @@ action:
caption: > caption: >
{% set tpl = message_asset_video_template if asset_type == 'VIDEO' else message_asset_image_template %} {% set tpl = message_asset_video_template if asset_type == 'VIDEO' else message_asset_image_template %}
{% set raw_date = current_asset.asset_created | default('') %} {% set raw_date = current_asset.asset_created | default('') %}
{% set formatted_date = raw_date | as_datetime | strftime(date_format) if raw_date | length > 0 else '' %} {% set dt = raw_date | as_datetime(none) if raw_date | length > 0 else none %}
{% set formatted_date = dt.strftime(date_format) if dt else '' %}
{{ tpl | replace('{filename}', current_asset.asset_filename | default('')) {{ tpl | replace('{filename}', current_asset.asset_filename | default(''))
| replace('{description}', current_asset.asset_description | default('')) | replace('{description}', current_asset.asset_description | default(''))
| replace('{type}', current_asset.asset_type | default('')) | replace('{type}', current_asset.asset_type | default(''))

View File

@@ -1,3 +1,3 @@
{ {
"version": "1.3.0" "version": "1.6.2"
} }