Remove telegram_notify_targets from Immich Album Watcher

Simplify Telegram recipient configuration to only use input_text
entities for chat IDs. Removes the notify entity friendly name
parsing which was complex and error-prone.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 02:18:36 +03:00
parent ba34d6f677
commit 27ff2ae8f0
3 changed files with 3 additions and 30 deletions

View File

@@ -130,8 +130,7 @@ When enabled, photos/videos are sent as media attachments to Telegram using the
### Supported Recipients
1. **Notify Entities**: Select Telegram notify entities. Chat ID is extracted from the friendly name. Format: `"Name (123456789)"`
2. **Input Text Entities**: Select input_text entities containing chat IDs for groups/channels.
Select input_text entities containing Telegram chat IDs. Can be user IDs (positive) or group IDs (negative).
### Requirements

View File

@@ -364,24 +364,10 @@ blueprint:
selector:
boolean:
telegram_notify_targets:
name: Telegram Notify Targets
description: >
Select Telegram notify entities to send media to.
The chat ID will be extracted from the entity's friendly name.
Expected format: "Name (123456789)" where the number in parentheses is the chat ID.
default: []
selector:
entity:
domain: notify
multiple: true
telegram_chat_id_entities:
name: Telegram Chat ID Entities
description: >
List of input_text entities containing Telegram chat IDs to send media to.
Use this for chat IDs not associated with notify entities,
or as a fallback if friendly name parsing doesn't work.
Can be user IDs (positive) or group IDs (negative).
Chat IDs are read from the entity states.
default: []
@@ -948,7 +934,6 @@ variables:
# Telegram Media Settings
send_telegram_media: !input send_telegram_media
telegram_notify_targets: !input telegram_notify_targets
telegram_chat_id_entities: !input telegram_chat_id_entities
max_media_to_send: !input max_media_to_send
max_media_per_group: !input max_media_per_group
@@ -991,20 +976,9 @@ variables:
memory_mode_min_rating: !input memory_mode_min_rating
memory_mode_message_template: !input memory_mode_message
# Parse chat IDs from notify entity friendly names (format: "Name (123456789)")
# and combine with chat IDs from input_text entities
# Read chat IDs from input_text entity states
telegram_chat_ids: >
{% set ns = namespace(ids = []) %}
{# Extract chat IDs from notify entity friendly names #}
{% for entity_id in telegram_notify_targets %}
{% set friendly_name = state_attr(entity_id, 'friendly_name') | default('') %}
{# Match number in parentheses at the end: "Diana (350705409)" -> "350705409" #}
{% set match = friendly_name | regex_findall('\\((-?\\d+)\\)\\s*$') %}
{% if match | length > 0 %}
{% set ns.ids = ns.ids + [match[0]] %}
{% endif %}
{% endfor %}
{# Read chat IDs from input_text entity states #}
{% for entity_id in telegram_chat_id_entities %}
{% set value = states(entity_id) | default('') | trim %}
{% if value | length > 0 and value not in ['unknown', 'unavailable'] and value not in ns.ids %}