script angepasst um delay und suche nach _echo_ raus

This commit is contained in:
Housemann 2025-07-26 10:49:29 +02:00
parent 4666a62741
commit de06842daf

View File

@ -74,30 +74,33 @@ fields:
selector:
boolean: {}
required: true
sequence:
- variables:
persistent_data: >-
{% if notify_persistent %} {"notification_id": "{{ title |
default("benachrichtigung") | lower | replace(" ", "_") }}"} {% else %}
{} {% endif %}
{% if notify_persistent %}
{"notification_id": "{{ title | default("benachrichtigung") | lower | replace(" ", "_") }}"}
{% else %} {} {% endif %}
- variables:
tv_on: "{{ is_state('media_player.lg_webos_tv_nano769qa', 'on') }}"
- variables:
notify_targets: |-
notify_targets: >-
{% set t = [] %}
{% if notify_persistent %}
{% set t = t + ['notify.persistent_notification'] %}
{% endif %}
{% if notify_alexa_durchsagen %}
{% set alexas_durchsagen = states.notify
| selectattr('entity_id', 'match', 'notify\\.echo_.*_durchsagen')
| selectattr('entity_id', 'match', 'notify\\..*_durchsagen')
| rejectattr('entity_id', 'search', 'multiroom_durchsagen')
| rejectattr('entity_id', 'search', 'uberall_durchsagen')
| map(attribute='entity_id')
| list %}
{% set t = t + alexas_durchsagen %}
{% endif %}
{% if notify_alexa_sprechen %}
{% set alexas_sprechen = states.notify
| selectattr('entity_id', 'match', 'notify\\.echo_.*_sprechen')
| selectattr('entity_id', 'match', 'notify\\..*_sprechen')
| map(attribute='entity_id')
| list %}
{% set t = t + alexas_sprechen %}
@ -120,11 +123,14 @@ sequence:
{% if notify_familie %}
{% set t = t + ['notify.mobile_app_finger_weg_du_spasst', 'notify.mobile_app_meins'] %}
{% endif %}
{{ t | unique | list }}
{{ t | map('lower') | map('trim') | unique | list }}
- repeat:
for_each: "{{ notify_targets }}"
sequence:
- choose:
# PERSISTENT NOTIFICATION
- conditions:
- condition: template
value_template: "{{ repeat.item == 'notify.persistent_notification' }}"
@ -134,6 +140,8 @@ sequence:
title: "{{ title | default('Benachrichtigung') }}"
data: "{{ persistent_data | from_json(default={}) }}"
action: notify.persistent_notification
# PUSHOVER
- conditions:
- condition: template
value_template: "{{ repeat.item.startswith('notify.pushover') }}"
@ -160,9 +168,12 @@ sequence:
message: "{{ message }}"
title: "{{ title | default('Benachrichtigung') }}"
action: "{{ repeat.item }}"
# ALEXA / SONOS (mit Verzögerung)
- conditions:
- condition: template
value_template: "{{ repeat.item.startswith('notify.echo_') }}"
value_template: >
{{ repeat.item.endswith('_durchsagen') or repeat.item.endswith('_sprechen') }}
sequence:
- data:
message: "{{ message }}"
@ -170,6 +181,9 @@ sequence:
target:
entity_id: "{{ repeat.item }}"
action: notify.send_message
- delay: "00:00:02"
# MOBILE APP (iOS/Android)
- conditions:
- condition: template
value_template: "{{ repeat.item.startswith('notify.mobile_app') }}"
@ -187,7 +201,7 @@ sequence:
sound:
name: default
critical: 1
volume: 1
volume: 1.0
action: "{{ repeat.item }}"
- conditions:
- condition: template
@ -197,6 +211,8 @@ sequence:
message: "{{ message }}"
title: "{{ title | default('Benachrichtigung') }}"
action: "{{ repeat.item }}"
# FALLBACK (TV, andere)
- conditions:
- condition: template
value_template: "{{ True }}"
@ -204,4 +220,4 @@ sequence:
- data:
message: "{{ message }}"
title: "{{ title | default('Benachrichtigung') }}"
action: "{{ repeat.item }}"
action: "{{ repeat.item }}"