Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 13132323ea |
@@ -8,50 +8,7 @@ This blueprint monitors multiple binary sensors and triggers push notifications
|
||||
- Debounce timer to prevent false alarms from brief sensor triggers
|
||||
- Optional melody and volume selection for alarm devices
|
||||
- Automatic alarm turn-off when all sensors clear
|
||||
- Notifications are only sent on sensor ON (not on clear)
|
||||
- Built-in debug mode that creates persistent notifications at each stage
|
||||
|
||||
## Debug Mode
|
||||
|
||||
Enable the **Debug** → **Enable Debug Logging** toggle to create persistent
|
||||
notifications at each execution stage. Use this when notifications are not
|
||||
reaching the target device:
|
||||
|
||||
1. **[1/4] Trigger Received** — shows trigger ID, entity, state transition,
|
||||
which sensors are currently on, the resolved notify target, and whether
|
||||
it is considered "usable" by the condition check.
|
||||
2. **[2/4] Sending Notification** — shows the target entity, sensor index,
|
||||
and the exact message that will be sent.
|
||||
3. **[3/4] Notification Sent** — shown after the `notify.send_message` call.
|
||||
Contains a troubleshooting checklist if the notification never arrives.
|
||||
4. **[4/4] Alarm Control Done** — shows which alarm switch action was taken.
|
||||
|
||||
Additionally, stage info is written to the HA system log under the
|
||||
`blueprint.alarm_notification` logger.
|
||||
|
||||
### Common causes of "no notification delivered"
|
||||
|
||||
- The notify integration is offline or the target device has notifications
|
||||
disabled.
|
||||
- `notify_target` is not actually a notify **entity**. Test from Developer
|
||||
Tools → Actions → `notify.send_message` with the same target and
|
||||
message; if that fails there, it will fail in the blueprint too.
|
||||
- The sensor state change was shorter than the debounce duration and the
|
||||
`sensor_on` trigger never fired. Temporarily set debounce to `0` to rule
|
||||
this out.
|
||||
- The notify integration rejects the message (e.g., Telegram bot with an
|
||||
invalid `chat_id` in its configuration). Check the HA log for the
|
||||
failing service call.
|
||||
|
||||
### Implementation note: notify via `notify.send_message`
|
||||
|
||||
The blueprint uses `action: notify.send_message` with
|
||||
`target.entity_id: "{{ notify_target }}"`. This is the canonical modern HA
|
||||
pattern and requires `notify_target` to be a notify **entity** (visible in
|
||||
Developer Tools → States). Integrations that only register a `notify.<name>`
|
||||
service but no entity are not supported by this blueprint directly — create
|
||||
a notify entity for them or adapt the blueprint.
|
||||
|
||||
## Author
|
||||
|
||||
Alexei Dolgolyov (<dolgolyov.alexei@gmail.com>)
|
||||
Alexei Dolgolyov (dolgolyov.alexei@gmail.com)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Multi-Sensor Alarm & Notification Blueprint
|
||||
# Monitors sensors and triggers notifications and alarm actions when activated.
|
||||
# Monitors sensors and triggers notifications and alarms when activated.
|
||||
# See README.md for detailed documentation.
|
||||
|
||||
blueprint:
|
||||
@@ -119,23 +119,6 @@ blueprint:
|
||||
selector:
|
||||
text:
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Debug Configuration
|
||||
# -------------------------------------------------------------------------
|
||||
debug_group:
|
||||
name: "Debug"
|
||||
collapsed: true
|
||||
input:
|
||||
debug_enabled:
|
||||
name: Enable Debug Logging
|
||||
description: >
|
||||
When enabled, creates persistent notifications at each stage of execution:
|
||||
trigger received, notification attempt, notification result, alarm control.
|
||||
Use to troubleshoot why notifications aren't reaching the target.
|
||||
default: false
|
||||
selector:
|
||||
boolean:
|
||||
|
||||
# Restart mode ensures rapid sensor changes are handled cleanly
|
||||
mode: restart
|
||||
|
||||
@@ -170,31 +153,23 @@ variables:
|
||||
melody_id: !input melody_id
|
||||
volume_select: !input volume_select
|
||||
volume_id: !input volume_id
|
||||
is_debug: !input debug_enabled
|
||||
|
||||
# Computed state values
|
||||
enabled_sensors: "{{ binary_sensors | select('is_state', 'on') | list }}"
|
||||
is_any_sensor_on: "{{ (binary_sensors | select('is_state', 'on') | list | length) > 0 }}"
|
||||
|
||||
# Whether a usable notify target is configured
|
||||
has_notify_target: "{{ notify_target is not none and (notify_target | string | trim) not in ['', '[]', 'None'] }}"
|
||||
|
||||
# Whether alarm control is configured
|
||||
has_alarm_switch: "{{ alarm_switch is not none and (alarm_switch | string | trim) not in ['', '[]', 'None'] }}"
|
||||
is_any_sensor_on: "{{ enabled_sensors | length > 0 }}"
|
||||
|
||||
# Small delay between setting melody/volume to ensure device processes each command
|
||||
delay_between_commands_ms: 100
|
||||
|
||||
# Version stamp so debug output can confirm which blueprint revision is live.
|
||||
# Bump this whenever debug/flow logic changes.
|
||||
blueprint_version: "2.6.4 (notify.send_message + entity_id)"
|
||||
# Debug flag - set to true to enable persistent notifications for troubleshooting
|
||||
is_debug: false
|
||||
|
||||
# =============================================================================
|
||||
# Actions
|
||||
# =============================================================================
|
||||
action:
|
||||
# ---------------------------------------------------------------------------
|
||||
# Debug Stage 1: Trigger Received
|
||||
# Debug Logging (optional)
|
||||
# ---------------------------------------------------------------------------
|
||||
- choose:
|
||||
- conditions:
|
||||
@@ -203,222 +178,45 @@ action:
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_trigger"
|
||||
title: "Alarm Debug [1/4]: Trigger Received"
|
||||
title: "Alarm Notification Debug"
|
||||
message: >
|
||||
Blueprint version: {{ blueprint_version }}
|
||||
|
||||
|
||||
Trigger ID: {{ trigger.id }}
|
||||
|
||||
Trigger: {{ trigger.id }}
|
||||
Entity: {{ trigger.entity_id }}
|
||||
|
||||
From: {{ trigger.from_state.state if trigger.from_state is not none else 'n/a' }}
|
||||
→ To: {{ trigger.to_state.state if trigger.to_state is not none else 'n/a' }}
|
||||
|
||||
|
||||
All monitored sensors: {{ binary_sensors }}
|
||||
|
||||
Currently active (on): {{ enabled_sensors }}
|
||||
|
||||
Any sensor on: {{ is_any_sensor_on }}
|
||||
|
||||
|
||||
Notify target: {{ notify_target }}
|
||||
|
||||
Has notify target: {{ has_notify_target }}
|
||||
|
||||
Alarm switch: {{ alarm_switch }}
|
||||
|
||||
Has alarm switch: {{ has_alarm_switch }}
|
||||
- service: system_log.write
|
||||
data:
|
||||
level: info
|
||||
logger: blueprint.alarm_notification
|
||||
message: >-
|
||||
Trigger '{{ trigger.id }}' from {{ trigger.entity_id }};
|
||||
active={{ enabled_sensors }};
|
||||
notify_target={{ notify_target }};
|
||||
has_notify_target={{ has_notify_target }}
|
||||
Sensors: {{ binary_sensors }}
|
||||
Active: {{ enabled_sensors }}
|
||||
Any On: {{ is_any_sensor_on }}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Debug Stage 1.5: What the notification-branch conditions evaluate to
|
||||
# Send Notification (when sensor turns ON)
|
||||
# ---------------------------------------------------------------------------
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_pre_notify"
|
||||
title: "Alarm Debug [1.5/4]: Evaluating notify conditions"
|
||||
message: >
|
||||
trigger.id = {{ trigger.id }}
|
||||
|
||||
trigger.id == 'sensor_on': {{ trigger.id == 'sensor_on' }}
|
||||
|
||||
has_notify_target: {{ has_notify_target }}
|
||||
|
||||
Combined (should be True to enter notify branch):
|
||||
{{ trigger.id == 'sensor_on' and has_notify_target }}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Send Notification (only on sensor_on, when target configured)
|
||||
# ---------------------------------------------------------------------------
|
||||
- choose:
|
||||
- conditions:
|
||||
# Single template condition avoids any quirks with condition: trigger
|
||||
# inside a choose block.
|
||||
- condition: template
|
||||
value_template: "{{ trigger.id == 'sensor_on' and has_notify_target }}"
|
||||
# Only notify if a sensor is on and notification target is configured
|
||||
value_template: "{{ is_any_sensor_on and notify_target is not none }}"
|
||||
sequence:
|
||||
- variables:
|
||||
# The sensor that fired this trigger
|
||||
# Get the sensor that triggered this automation
|
||||
sensor: "{{ trigger.entity_id }}"
|
||||
# Namespace-loop avoids Jinja sandbox restrictions on list.index()
|
||||
sensor_index: >-
|
||||
{%- set ns = namespace(idx=-1) -%}
|
||||
{%- for s in binary_sensors -%}
|
||||
{%- if s == sensor -%}{%- set ns.idx = loop.index0 -%}{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{{ ns.idx }}
|
||||
# Resolve message (strip whitespace to keep notifications clean)
|
||||
message: >-
|
||||
{%- set messages = notify_texts | list -%}
|
||||
{%- set idx = sensor_index | int(-1) -%}
|
||||
{%- if idx >= 0 and idx < messages | length -%}
|
||||
{{ messages[idx] }}
|
||||
{%- else -%}
|
||||
Alarm: {{ state_attr(sensor, 'friendly_name') or sensor }} triggered
|
||||
{%- endif -%}
|
||||
# Find index of this sensor in the list
|
||||
sensor_index: >
|
||||
{% set idx = binary_sensors | list %}
|
||||
{{ idx.index(sensor) if sensor in idx else -1 }}
|
||||
# Get custom message or use default
|
||||
message: >
|
||||
{% set messages = notify_texts | list %}
|
||||
{% if sensor_index >= 0 and sensor_index < messages | length %}
|
||||
{{ messages[sensor_index] }}
|
||||
{% else %}
|
||||
Alarm: {{ state_attr(sensor, 'friendly_name') | default(sensor) }} triggered
|
||||
{% endif %}
|
||||
|
||||
# Debug Stage 2: Variables computed, about to send
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_notify_attempt"
|
||||
title: "Alarm Debug [2/4]: Sending Notification"
|
||||
message: >
|
||||
Target: {{ notify_target }}
|
||||
|
||||
Sensor: {{ sensor }}
|
||||
|
||||
Sensor index (raw): "{{ sensor_index }}"
|
||||
|
||||
Messages defined: {{ notify_texts | length }}
|
||||
|
||||
Resolved message: "{{ message }}"
|
||||
|
||||
# Debug Stage 2.25: About to invoke service
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_pre_service"
|
||||
title: "Alarm Debug [2.25/4]: Before notify.send_message"
|
||||
message: >
|
||||
Blueprint version: {{ blueprint_version }}
|
||||
|
||||
About to call: action notify.send_message
|
||||
|
||||
with target.entity_id: {{ notify_target }}
|
||||
|
||||
and data.message: "{{ message }}"
|
||||
|
||||
# Send via notify.send_message targeting the notify entity.
|
||||
# This matches the canonical HA pattern used by working automations.
|
||||
# continue_on_error ensures the alarm-control stage still runs
|
||||
# if the notify integration is misconfigured.
|
||||
- action: notify.send_message
|
||||
metadata: {}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_target }}"
|
||||
data:
|
||||
message: "{{ message }}"
|
||||
continue_on_error: true
|
||||
|
||||
# Debug Stage 2.75: Service call returned (success or caught error)
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_post_service"
|
||||
title: "Alarm Debug [2.75/4]: After notify.send_message"
|
||||
message: >
|
||||
notify.send_message to {{ notify_target }} returned
|
||||
(either success or continue_on_error caught it).
|
||||
|
||||
If this notification is missing but [2.25/4] is
|
||||
present, the call raised an error that
|
||||
continue_on_error did NOT catch. Check the HA log
|
||||
and verify {{ notify_target }} is a notify entity
|
||||
(Developer Tools → States should list it).
|
||||
|
||||
# Debug Stage 3: Notification result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_notify_result"
|
||||
title: "Alarm Debug [3/4]: Notification Sent"
|
||||
message: >
|
||||
notify.send_message dispatched to {{ notify_target }}
|
||||
with message: "{{ message }}".
|
||||
|
||||
If nothing arrived on the device, check:
|
||||
|
||||
1) HA log for errors from the notify integration
|
||||
|
||||
2) That the underlying integration (Telegram bot,
|
||||
mobile app, etc.) is online
|
||||
|
||||
3) Test from Developer Tools → Actions:
|
||||
notify.send_message with target {{ notify_target }}
|
||||
|
||||
- service: system_log.write
|
||||
data:
|
||||
level: info
|
||||
logger: blueprint.alarm_notification
|
||||
message: >-
|
||||
Notification attempted to {{ notify_target }};
|
||||
sensor={{ sensor }}; message='{{ message }}'
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Debug Stage 3.5: Unconditional checkpoint so we can tell whether the
|
||||
# notification branch silently aborted the script above. If this appears
|
||||
# but [2/4] or [3/4] don't, the variables block or notify.send_message
|
||||
# errored silently.
|
||||
# ---------------------------------------------------------------------------
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_after_notify"
|
||||
title: "Alarm Debug [3.5/4]: After notify branch"
|
||||
message: >
|
||||
Execution reached this point. trigger.id = {{ trigger.id }}.
|
||||
|
||||
If [2/4] and [3/4] did NOT appear above, the notify branch
|
||||
either did not enter (check [1.5/4]), or errored silently
|
||||
in the variables / notify.send_message step.
|
||||
Check Home Assistant log for Jinja or service errors.
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Alarm Device Control
|
||||
@@ -426,20 +224,20 @@ action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ has_alarm_switch }}"
|
||||
# Only control alarm if alarm switch is configured
|
||||
value_template: "{{ alarm_switch | length > 0 }}"
|
||||
sequence:
|
||||
# Set melody (if configured)
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ melody_select is not none and (melody_select | string | trim) not in ['', '[]', 'None'] and (melody_id | string | length) > 0 }}"
|
||||
value_template: "{{ melody_select | length > 0 and melody_id | length > 0 }}"
|
||||
sequence:
|
||||
- service: select.select_option
|
||||
target:
|
||||
entity_id: "{{ melody_select }}"
|
||||
data:
|
||||
option: "{{ melody_id }}"
|
||||
continue_on_error: true
|
||||
- delay:
|
||||
milliseconds: "{{ delay_between_commands_ms }}"
|
||||
|
||||
@@ -447,14 +245,13 @@ action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ volume_select is not none and (volume_select | string | trim) not in ['', '[]', 'None'] and (volume_id | string | length) > 0 }}"
|
||||
value_template: "{{ volume_select | length > 0 and volume_id | length > 0 }}"
|
||||
sequence:
|
||||
- service: select.select_option
|
||||
target:
|
||||
entity_id: "{{ volume_select }}"
|
||||
data:
|
||||
option: "{{ volume_id }}"
|
||||
continue_on_error: true
|
||||
- delay:
|
||||
milliseconds: "{{ delay_between_commands_ms }}"
|
||||
|
||||
@@ -468,30 +265,9 @@ action:
|
||||
- service: switch.turn_on
|
||||
target:
|
||||
entity_id: "{{ alarm_switch }}"
|
||||
continue_on_error: true
|
||||
|
||||
# All sensors clear -> turn alarm OFF
|
||||
default:
|
||||
- service: switch.turn_off
|
||||
target:
|
||||
entity_id: "{{ alarm_switch }}"
|
||||
continue_on_error: true
|
||||
|
||||
# Debug Stage 4: Alarm control done
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ is_debug }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "alarm_debug_alarm_control"
|
||||
title: "Alarm Debug [4/4]: Alarm Control Done"
|
||||
message: >
|
||||
Alarm switch: {{ alarm_switch }}
|
||||
|
||||
Action: {{ 'turn_on' if is_any_sensor_on else 'turn_off' }}
|
||||
|
||||
Melody: {{ melody_id }} → {{ melody_select }}
|
||||
|
||||
Volume: {{ volume_id }} → {{ volume_select }}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Dreame Vacuum Notifications
|
||||
|
||||
Sends customizable notifications for Dreame vacuum events. Requires the [Dreame Vacuum](https://github.com/Tasshack/dreame-vacuum) integration and Home Assistant 2024.7+ (`notify.send_message` action).
|
||||
Sends customizable notifications for Dreame vacuum events. Requires the [Dreame Vacuum](https://github.com/Tasshack/dreame-vacuum) integration.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -9,8 +9,7 @@ Sends customizable notifications for Dreame vacuum events. Requires the [Dreame
|
||||
- Device warning and error notifications
|
||||
- Informational alerts (e.g., action blocked by Do Not Disturb)
|
||||
- Individual toggle for each event type
|
||||
- Per-code filter lists for silencing routine warnings, errors, or info messages
|
||||
- Customizable message templates
|
||||
- Customizable message templates with variable substitution
|
||||
- Multiple notification targets
|
||||
|
||||
## How It Works
|
||||
@@ -25,12 +24,7 @@ The blueprint listens to events fired by the Dreame Vacuum integration:
|
||||
| `dreame_vacuum_error` | Device fault |
|
||||
| `dreame_vacuum_information` | Action blocked by user settings |
|
||||
|
||||
Events are filtered by the configured vacuum:
|
||||
|
||||
1. If the event payload includes `device_id`, it must match the device of the configured vacuum entity. This is the most reliable match.
|
||||
2. Otherwise the entity_id in the event must equal the configured one, or equal it followed by a purely numeric suffix (e.g., `vacuum.dreame_x10_2`). The integration uses `generate_entity_id()`, so a numeric suffix can appear when the base entity_id is taken.
|
||||
|
||||
This avoids false positives when two vacuums share an entity_id prefix (e.g., `vacuum.dreame_x10` vs. `vacuum.dreame_x10_pro`).
|
||||
Events are filtered by the configured vacuum entity, so only the selected vacuum triggers notifications.
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -39,13 +33,8 @@ This avoids false positives when two vacuums share an entity_id prefix (e.g., `v
|
||||
| **Vacuum Entity** | The Dreame vacuum entity to monitor |
|
||||
| **Notification Targets** | One or more `notify` entities |
|
||||
| **Event Toggles** | Enable/disable each event type independently |
|
||||
| **Filtering** | Lists of warning/error/information codes to silence |
|
||||
| **Message Templates** | Customizable message for each event type |
|
||||
|
||||
### Filtering
|
||||
|
||||
Each filter input is a list of codes (as strings) that should not produce a notification. The blueprint compares the event's `code` field (cast to string) against the list. Use this to suppress noisy routine events while keeping critical ones.
|
||||
|
||||
## Message Template Variables
|
||||
|
||||
### Cleaning Started
|
||||
@@ -95,16 +84,10 @@ Each filter input is a list of codes (as strings) that should not produce a noti
|
||||
| --- | --- |
|
||||
| `{vacuum_name}` | Friendly name of the vacuum |
|
||||
| `{information}` | Information message (e.g., Dust Collection, Cleaning Paused) |
|
||||
| `{code}` | Information code |
|
||||
|
||||
## Notes
|
||||
|
||||
- The default messages contain emojis. Most modern notify integrations (Mobile App, Telegram, Discord) render them correctly; legacy SMS-based integrations may not.
|
||||
- `notify.send_message` requires Home Assistant 2024.7 or newer.
|
||||
|
||||
## Debug Mode
|
||||
|
||||
Enable **Debug Notifications** in the Debug section to send a persistent notification for every trigger. Each debug notification includes the blueprint version, dispatched event kind, and the enable decision — useful for confirming filters are doing what you expect. The notification is keyed per vacuum so debug entries from multiple vacuums do not overwrite each other.
|
||||
Enable **Debug Notifications** in the Debug section to send persistent notifications with raw event data for troubleshooting.
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
+116
-135
@@ -96,41 +96,6 @@ blueprint:
|
||||
selector:
|
||||
boolean:
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Filtering
|
||||
# -------------------------------------------------------------------------
|
||||
filters_group:
|
||||
name: "Filtering"
|
||||
collapsed: true
|
||||
input:
|
||||
warning_codes_ignore:
|
||||
name: Warning Codes to Ignore
|
||||
description: >
|
||||
List of warning codes to silence (one entry per code, as text).
|
||||
Useful for suppressing routine warnings while keeping critical ones.
|
||||
default: []
|
||||
selector:
|
||||
text:
|
||||
multiple: true
|
||||
|
||||
error_codes_ignore:
|
||||
name: Error Codes to Ignore
|
||||
description: >
|
||||
List of error codes to silence (one entry per code, as text).
|
||||
default: []
|
||||
selector:
|
||||
text:
|
||||
multiple: true
|
||||
|
||||
information_codes_ignore:
|
||||
name: Information Codes to Ignore
|
||||
description: >
|
||||
List of information codes to silence (one entry per code, as text).
|
||||
default: []
|
||||
selector:
|
||||
text:
|
||||
multiple: true
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Message Templates
|
||||
# -------------------------------------------------------------------------
|
||||
@@ -193,7 +158,7 @@ blueprint:
|
||||
name: "Information Message"
|
||||
description: >
|
||||
Message sent for informational alerts.
|
||||
Variables: `{vacuum_name}`, `{information}`, `{code}`
|
||||
Variables: `{vacuum_name}`, `{information}`
|
||||
default: "ℹ️ {vacuum_name}: {information}."
|
||||
selector:
|
||||
text:
|
||||
@@ -210,7 +175,7 @@ blueprint:
|
||||
name: Enable Debug Notifications
|
||||
description: >
|
||||
Send persistent notifications for debugging automation behavior.
|
||||
Shows raw event data, dispatched event kind, and the enable decision.
|
||||
Shows raw event data and filtering decisions.
|
||||
default: false
|
||||
selector:
|
||||
boolean:
|
||||
@@ -252,10 +217,6 @@ trigger:
|
||||
# VARIABLES
|
||||
# =============================================================================
|
||||
variables:
|
||||
# Bumped whenever event-handling logic changes; surfaced in debug output
|
||||
# so users can confirm which revision is running.
|
||||
blueprint_version: "1.1.1"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Input References
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -271,11 +232,6 @@ variables:
|
||||
enable_error: !input enable_error
|
||||
enable_information: !input enable_information
|
||||
|
||||
# Filter lists (lists of strings)
|
||||
warning_codes_ignore: !input warning_codes_ignore
|
||||
error_codes_ignore: !input error_codes_ignore
|
||||
information_codes_ignore: !input information_codes_ignore
|
||||
|
||||
# Message templates
|
||||
message_cleaning_started_template: !input message_cleaning_started
|
||||
message_cleaning_completed_template: !input message_cleaning_completed
|
||||
@@ -288,13 +244,11 @@ variables:
|
||||
# Vacuum Info
|
||||
# ---------------------------------------------------------------------------
|
||||
vacuum_name: "{{ state_attr(vacuum_entity, 'friendly_name') | default(vacuum_entity) }}"
|
||||
vacuum_device: "{{ device_id(vacuum_entity) | default('', true) }}"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Event Data (flat structure — fields are directly on trigger.event.data)
|
||||
# ---------------------------------------------------------------------------
|
||||
event_entity_id: "{{ trigger.event.data.entity_id | default('') }}"
|
||||
event_device_id: "{{ trigger.event.data.device_id | default('') }}"
|
||||
|
||||
# Task status fields
|
||||
task_cleaning_mode: "{{ trigger.event.data.cleaning_mode | default('unknown') }}"
|
||||
@@ -316,88 +270,19 @@ variables:
|
||||
|
||||
# Information fields
|
||||
information_description: "{{ (trigger.event.data.information | default('unknown')) | replace('_', ' ') | title }}"
|
||||
information_code: "{{ trigger.event.data.code | default('') }}"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Event Dispatch
|
||||
# ---------------------------------------------------------------------------
|
||||
# Map the raw trigger to a single logical event kind. Keeping this in one
|
||||
# place avoids the duplicated condition logic that the old multi-branch
|
||||
# `choose` had.
|
||||
event_kind: >
|
||||
{%- if trigger.id == 'task_status' and not task_completed -%}cleaning_started
|
||||
{%- elif trigger.id == 'task_status' and task_completed -%}cleaning_completed
|
||||
{%- elif trigger.id == 'consumable' -%}consumable
|
||||
{%- elif trigger.id == 'warning' -%}warning
|
||||
{%- elif trigger.id == 'error' -%}error
|
||||
{%- elif trigger.id == 'information' -%}information
|
||||
{%- else -%}none
|
||||
{%- endif -%}
|
||||
|
||||
# Whether this event should produce a notification, given user toggles
|
||||
# and any per-code filter lists. Coerce with `| bool(false)` at the
|
||||
# consumer because folded scalars can render as the string "True"/"False".
|
||||
event_enabled: >
|
||||
{%- if event_kind == 'cleaning_started' -%}{{ enable_cleaning_started }}
|
||||
{%- elif event_kind == 'cleaning_completed' -%}{{ enable_cleaning_completed }}
|
||||
{%- elif event_kind == 'consumable' -%}{{ enable_consumable }}
|
||||
{%- elif event_kind == 'warning' -%}{{ enable_warning and (warning_code | string) not in warning_codes_ignore }}
|
||||
{%- elif event_kind == 'error' -%}{{ enable_error and (error_code | string) not in error_codes_ignore }}
|
||||
{%- elif event_kind == 'information' -%}{{ enable_information and (information_code | string) not in information_codes_ignore }}
|
||||
{%- else -%}False
|
||||
{%- endif -%}
|
||||
|
||||
# Pick the per-event message template.
|
||||
message_template: >
|
||||
{%- if event_kind == 'cleaning_started' -%}{{ message_cleaning_started_template }}
|
||||
{%- elif event_kind == 'cleaning_completed' -%}{{ message_cleaning_completed_template }}
|
||||
{%- elif event_kind == 'consumable' -%}{{ message_consumable_template }}
|
||||
{%- elif event_kind == 'warning' -%}{{ message_warning_template }}
|
||||
{%- elif event_kind == 'error' -%}{{ message_error_template }}
|
||||
{%- elif event_kind == 'information' -%}{{ message_information_template }}
|
||||
{%- else -%}{%- endif -%}
|
||||
|
||||
# Render the message. Placeholders that don't apply to this event are
|
||||
# absent from the chosen template, so `replace()` is a no-op for them.
|
||||
message: >
|
||||
{%- set code_for_event = warning_code if event_kind == 'warning'
|
||||
else (error_code if event_kind == 'error'
|
||||
else (information_code if event_kind == 'information' else '')) -%}
|
||||
{{ message_template
|
||||
| replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{cleaning_mode}', task_cleaning_mode)
|
||||
| replace('{status}', task_status_value)
|
||||
| replace('{cleaned_area}', task_cleaned_area | string)
|
||||
| replace('{cleaning_time}', task_cleaning_time | string)
|
||||
| replace('{consumable}', consumable_name)
|
||||
| replace('{warning}', warning_description)
|
||||
| replace('{error}', error_description)
|
||||
| replace('{information}', information_description)
|
||||
| replace('{code}', code_for_event | string) }}
|
||||
|
||||
# =============================================================================
|
||||
# CONDITIONS
|
||||
# =============================================================================
|
||||
condition:
|
||||
# Only process events from the configured vacuum.
|
||||
# Prefer device_id matching when the event payload carries it (most
|
||||
# reliable across firmware revisions and avoids prefix collisions when
|
||||
# multiple Dreame vacuums share an entity_id stem).
|
||||
# Fall back to entity_id matching: the integration uses generate_entity_id(),
|
||||
# which may append a numeric suffix (e.g., `_2`) when the base entity_id
|
||||
# is taken — so we accept the configured entity_id with an optional
|
||||
# purely numeric suffix and reject non-numeric suffixes (e.g., `_pro`).
|
||||
# Only process events from the configured vacuum entity.
|
||||
# The Dreame Vacuum integration uses generate_entity_id() for the entity_id
|
||||
# in event data, which may append a numeric suffix (e.g., _2) since the
|
||||
# actual vacuum entity already occupies the base entity_id.
|
||||
- condition: template
|
||||
value_template: >
|
||||
{%- if event_device_id != '' and vacuum_device != '' -%}
|
||||
{{ event_device_id == vacuum_device }}
|
||||
{%- elif event_entity_id == vacuum_entity -%}
|
||||
true
|
||||
{%- elif event_entity_id.startswith(vacuum_entity ~ '_') -%}
|
||||
{{ event_entity_id[(vacuum_entity | length) + 1:].isdigit() }}
|
||||
{%- else -%}
|
||||
false
|
||||
{%- endif -%}
|
||||
{{ event_entity_id == vacuum_entity
|
||||
or event_entity_id.startswith(vacuum_entity ~ '_') }}
|
||||
|
||||
# =============================================================================
|
||||
# ACTIONS
|
||||
@@ -412,31 +297,127 @@ action:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- action: persistent_notification.create
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
notification_id: "dreame_vacuum_debug_{{ vacuum_entity }}"
|
||||
title: "Dreame Vacuum Debug — {{ vacuum_name }}"
|
||||
title: "Dreame Vacuum Debug"
|
||||
message: >
|
||||
**Blueprint version:** {{ blueprint_version }}
|
||||
**Trigger:** {{ trigger.id }}
|
||||
**Event kind:** {{ event_kind }}
|
||||
**Enabled:** {{ event_enabled }}
|
||||
**Entity:** {{ event_entity_id }}
|
||||
**Device:** {{ event_device_id }}
|
||||
**Vacuum:** {{ vacuum_name }}
|
||||
**Event Data:** {{ trigger.event.data }}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Send Notification
|
||||
# Send Notification Based on Event Type
|
||||
# ---------------------------------------------------------------------------
|
||||
# Single dispatch — message and the enable decision are computed in the
|
||||
# variables block above. We just gate on the resolved flags here.
|
||||
- choose:
|
||||
|
||||
# CASE 1: Cleaning Started
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ event_kind != 'none' and (event_enabled | bool(false)) }}"
|
||||
value_template: >
|
||||
{{ trigger.id == 'task_status'
|
||||
and not task_completed
|
||||
and enable_cleaning_started }}
|
||||
sequence:
|
||||
- action: notify.send_message
|
||||
- variables:
|
||||
message: >
|
||||
{% set tpl = message_cleaning_started_template %}
|
||||
{{ tpl | replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{cleaning_mode}', task_cleaning_mode)
|
||||
| replace('{status}', task_status_value) }}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_targets }}"
|
||||
data:
|
||||
message: "{{ message }}"
|
||||
|
||||
# CASE 2: Cleaning Completed
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.id == 'task_status'
|
||||
and task_completed
|
||||
and enable_cleaning_completed }}
|
||||
sequence:
|
||||
- variables:
|
||||
message: >
|
||||
{% set tpl = message_cleaning_completed_template %}
|
||||
{{ tpl | replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{cleaning_mode}', task_cleaning_mode)
|
||||
| replace('{status}', task_status_value)
|
||||
| replace('{cleaned_area}', task_cleaned_area | string)
|
||||
| replace('{cleaning_time}', task_cleaning_time | string) }}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_targets }}"
|
||||
data:
|
||||
message: "{{ message }}"
|
||||
|
||||
# CASE 3: Consumable Depleted
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.id == 'consumable' and enable_consumable }}
|
||||
sequence:
|
||||
- variables:
|
||||
message: >
|
||||
{% set tpl = message_consumable_template %}
|
||||
{{ tpl | replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{consumable}', consumable_name) }}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_targets }}"
|
||||
data:
|
||||
message: "{{ message }}"
|
||||
|
||||
# CASE 4: Warning
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.id == 'warning' and enable_warning }}
|
||||
sequence:
|
||||
- variables:
|
||||
message: >
|
||||
{% set tpl = message_warning_template %}
|
||||
{{ tpl | replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{warning}', warning_description)
|
||||
| replace('{code}', warning_code | string) }}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_targets }}"
|
||||
data:
|
||||
message: "{{ message }}"
|
||||
|
||||
# CASE 5: Error
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.id == 'error' and enable_error }}
|
||||
sequence:
|
||||
- variables:
|
||||
message: >
|
||||
{% set tpl = message_error_template %}
|
||||
{{ tpl | replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{error}', error_description)
|
||||
| replace('{code}', error_code | string) }}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_targets }}"
|
||||
data:
|
||||
message: "{{ message }}"
|
||||
|
||||
# CASE 6: Information
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.id == 'information' and enable_information }}
|
||||
sequence:
|
||||
- variables:
|
||||
message: >
|
||||
{% set tpl = message_information_template %}
|
||||
{{ tpl | replace('{vacuum_name}', vacuum_name)
|
||||
| replace('{information}', information_description) }}
|
||||
- service: notify.send_message
|
||||
target:
|
||||
entity_id: "{{ notify_targets }}"
|
||||
data:
|
||||
|
||||
@@ -146,6 +146,7 @@ Select input_text entities containing Telegram chat IDs. Can be user IDs (positi
|
||||
- Large media lists are automatically split into multiple groups (2-10 items per group)
|
||||
- Optional chat action indicator (typing, uploading photo/video) while processing
|
||||
- Optional maximum asset size filter to skip large files
|
||||
- Respects integration quiet hours — notifications are queued and sent when quiet hours end (configurable bypass per blueprint instance)
|
||||
|
||||
### Limitations
|
||||
|
||||
|
||||
@@ -461,6 +461,23 @@ blueprint:
|
||||
- label: "Uploading Document..."
|
||||
value: "upload_document"
|
||||
|
||||
telegram_quiet_hours_start:
|
||||
name: Quiet Hours Start
|
||||
description: >
|
||||
Start time for quiet hours. During quiet hours, Telegram notifications
|
||||
are queued and sent when quiet hours end.
|
||||
default: "23:00"
|
||||
selector:
|
||||
time:
|
||||
|
||||
telegram_quiet_hours_end:
|
||||
name: Quiet Hours End
|
||||
description: >
|
||||
End time for quiet hours. Queued notifications are sent after this time.
|
||||
default: "07:00"
|
||||
selector:
|
||||
time:
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Periodic Summary
|
||||
# -------------------------------------------------------------------------
|
||||
@@ -937,6 +954,8 @@ variables:
|
||||
telegram_disable_url_preview: !input telegram_disable_url_preview
|
||||
telegram_chat_action: !input telegram_chat_action
|
||||
telegram_max_asset_size: !input telegram_max_asset_size
|
||||
telegram_quiet_hours_start: !input telegram_quiet_hours_start
|
||||
telegram_quiet_hours_end: !input telegram_quiet_hours_end
|
||||
|
||||
# Periodic Summary Settings
|
||||
enable_periodic_summary: !input enable_periodic_summary
|
||||
@@ -1437,6 +1456,25 @@ action:
|
||||
assets: "{{ [{'url': periodic_summary_image_url, 'type': 'photo'}] if periodic_summary_image_url | length > 0 else [] }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Periodic Summary - Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ periodic_summary_formatted[:200] }}...
|
||||
- Has Image: {{ 'Yes' if periodic_summary_image_url | length > 0 else 'No' }}
|
||||
- Response: {{ telegram_periodic_response }}
|
||||
|
||||
# Delay between periodic summary and scheduled assets if both trigger at the same hour
|
||||
- if:
|
||||
@@ -1681,6 +1719,24 @@ action:
|
||||
caption: "{{ scheduled_message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Scheduled Per-Album - Text Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ scheduled_message[:200] }}...
|
||||
- Response: {{ telegram_scheduled_text_response }}
|
||||
|
||||
# Extract message ID for reply
|
||||
- variables:
|
||||
@@ -1710,6 +1766,25 @@ action:
|
||||
max_asset_data_size: "{{ telegram_max_asset_size | int * 1048576 }}"
|
||||
wait_for_response: false
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log media send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Scheduled Per-Album - Media Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Assets: {{ scheduled_media_urls | length }}
|
||||
- Reply To: {{ scheduled_reply_to_id }}
|
||||
- Response: {{ telegram_scheduled_media_response }}
|
||||
|
||||
# Combined Mode: Fetch from all albums and combine into one notification
|
||||
# Distributes the limit evenly across albums (e.g., limit=10 with 2 albums = 5 each)
|
||||
@@ -1941,6 +2016,24 @@ action:
|
||||
caption: "{{ combined_message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Scheduled Combined - Text Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ combined_message[:200] }}...
|
||||
- Response: {{ telegram_combined_text_response }}
|
||||
|
||||
- variables:
|
||||
combined_reply_to_id: "{{ telegram_combined_text_response[album_id_entities[0]].message_id | default(0) | int }}"
|
||||
@@ -1968,6 +2061,25 @@ action:
|
||||
max_asset_data_size: "{{ telegram_max_asset_size | int * 1048576 }}"
|
||||
wait_for_response: false
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log media send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Scheduled Combined - Media Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Assets: {{ combined_media_urls | length }}
|
||||
- Reply To: {{ combined_reply_to_id }}
|
||||
- Response: {{ telegram_combined_media_response }}
|
||||
|
||||
# Delay before memory mode if another scheduled notification was sent at the same hour
|
||||
- if:
|
||||
@@ -2207,6 +2319,24 @@ action:
|
||||
caption: "{{ memory_message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Memory Per-Album - Text Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ memory_message[:200] }}...
|
||||
- Response: {{ telegram_memory_text_response }}
|
||||
|
||||
# Extract message ID for reply
|
||||
- variables:
|
||||
@@ -2236,6 +2366,25 @@ action:
|
||||
max_asset_data_size: "{{ telegram_max_asset_size | int * 1048576 }}"
|
||||
wait_for_response: false
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log media send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Memory Per-Album - Media Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Assets: {{ memory_media_urls | length }}
|
||||
- Reply To: {{ memory_reply_to_id }}
|
||||
- Response: {{ telegram_memory_media_response }}
|
||||
|
||||
# Combined Mode: Fetch from all albums and combine into one notification
|
||||
- conditions:
|
||||
@@ -2457,6 +2606,24 @@ action:
|
||||
caption: "{{ memory_comb_message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Memory Combined - Text Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ memory_comb_message[:200] }}...
|
||||
- Response: {{ telegram_memory_comb_text_response }}
|
||||
|
||||
- variables:
|
||||
memory_comb_reply_to_id: "{{ telegram_memory_comb_text_response[album_id_entities[0]].message_id | default(0) | int }}"
|
||||
@@ -2484,6 +2651,25 @@ action:
|
||||
max_asset_data_size: "{{ telegram_max_asset_size | int * 1048576 }}"
|
||||
wait_for_response: false
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log media send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Memory Combined - Media Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Assets: {{ memory_comb_media_urls | length }}
|
||||
- Reply To: {{ memory_comb_reply_to_id }}
|
||||
- Response: {{ telegram_memory_comb_media_response }}
|
||||
|
||||
# Stop here if this was a scheduled trigger - don't continue to event-based actions
|
||||
- choose:
|
||||
@@ -2686,6 +2872,24 @@ action:
|
||||
caption: "{{ message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Album Renamed - Text Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ message[:200] }}...
|
||||
- Response: {{ telegram_renamed_response }}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# CASE 5: Album Deleted
|
||||
@@ -2723,6 +2927,24 @@ action:
|
||||
caption: "{{ message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Album Deleted - Text Send:**
|
||||
|
||||
- Chat ID: {{ repeat.item }}
|
||||
- Caption: {{ message[:200] }}...
|
||||
- Response: {{ telegram_deleted_response }}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Send Media to Telegram (if enabled)
|
||||
@@ -2849,6 +3071,24 @@ action:
|
||||
caption: "{{ telegram_message }}"
|
||||
disable_web_page_preview: "{{ telegram_disable_url_preview }}"
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log text send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Assets Added - Text Send:**
|
||||
|
||||
- Chat ID: {{ current_chat_id }}
|
||||
- Caption: {{ telegram_message[:200] }}...
|
||||
- Response: {{ telegram_text_response }}
|
||||
|
||||
# Extract message ID for replies
|
||||
- variables:
|
||||
@@ -2891,3 +3131,23 @@ action:
|
||||
max_asset_data_size: "{{ telegram_max_asset_size | int * 1048576 }}"
|
||||
wait_for_response: false
|
||||
chat_action: "{{ telegram_chat_action }}"
|
||||
quiet_hours_start: "{{ telegram_quiet_hours_start }}"
|
||||
quiet_hours_end: "{{ telegram_quiet_hours_end }}"
|
||||
|
||||
# Debug: Log media send result
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: "{{ enable_debug_notifications }}"
|
||||
sequence:
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Immich Album Watcher - Telegram Send Debug"
|
||||
message: >
|
||||
**Assets Added - Media Send:**
|
||||
|
||||
- Chat ID: {{ current_chat_id }}
|
||||
- Assets: {{ media_urls | length }}
|
||||
- Reply To: {{ reply_to_message_id }}
|
||||
- Max Group Size: {{ max_media_per_group }}
|
||||
- Response: {{ telegram_media_response }}
|
||||
|
||||
@@ -242,5 +242,5 @@ action:
|
||||
sequence:
|
||||
- service: telegram_bot.send_message
|
||||
data:
|
||||
chat_id: "{{ chat_id }}"
|
||||
target: "{{ chat_id }}"
|
||||
message: "{{ reply_message }}"
|
||||
|
||||
@@ -286,7 +286,7 @@ action:
|
||||
sequence:
|
||||
- service: telegram_bot.send_message
|
||||
data:
|
||||
chat_id: "{{ chat_id }}"
|
||||
target: "{{ chat_id }}"
|
||||
message: "{{ answers[button_index] }}"
|
||||
# Reply to original message unless we're deleting it
|
||||
reply_to_message_id: >
|
||||
@@ -397,7 +397,7 @@ action:
|
||||
# Send the message with keyboard
|
||||
- service: telegram_bot.send_message
|
||||
data:
|
||||
chat_id: "{{ result_chat_ids }}"
|
||||
target: "{{ result_chat_ids }}"
|
||||
message: "{{ message_text }}"
|
||||
inline_keyboard: "{{ inline_keyboard }}"
|
||||
config_entry_id: >
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "2.9.1"
|
||||
"version": "2.5.2"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user