Compare commits

..

No commits in common. "main" and "20250725_ZUHUS-27-Notify-Script-einbauen" have entirely different histories.

3 changed files with 10 additions and 2407 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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