script angepasst um delay und suche nach _echo_ raus
This commit is contained in:
parent
4666a62741
commit
de06842daf
@ -74,30 +74,33 @@ fields:
|
|||||||
selector:
|
selector:
|
||||||
boolean: {}
|
boolean: {}
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
sequence:
|
sequence:
|
||||||
- variables:
|
- variables:
|
||||||
persistent_data: >-
|
persistent_data: >-
|
||||||
{% if notify_persistent %} {"notification_id": "{{ title |
|
{% if notify_persistent %}
|
||||||
default("benachrichtigung") | lower | replace(" ", "_") }}"} {% else %}
|
{"notification_id": "{{ title | default("benachrichtigung") | lower | replace(" ", "_") }}"}
|
||||||
{} {% endif %}
|
{% else %} {} {% 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\\.echo_.*_durchsagen')
|
| selectattr('entity_id', 'match', 'notify\\..*_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\\.echo_.*_sprechen')
|
| selectattr('entity_id', 'match', 'notify\\..*_sprechen')
|
||||||
| map(attribute='entity_id')
|
| map(attribute='entity_id')
|
||||||
| list %}
|
| list %}
|
||||||
{% set t = t + alexas_sprechen %}
|
{% set t = t + alexas_sprechen %}
|
||||||
@ -120,11 +123,14 @@ 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 | unique | list }}
|
{{ t | map('lower') | map('trim') | 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' }}"
|
||||||
@ -134,6 +140,8 @@ 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') }}"
|
||||||
@ -160,9 +168,12 @@ 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: "{{ repeat.item.startswith('notify.echo_') }}"
|
value_template: >
|
||||||
|
{{ repeat.item.endswith('_durchsagen') or repeat.item.endswith('_sprechen') }}
|
||||||
sequence:
|
sequence:
|
||||||
- data:
|
- data:
|
||||||
message: "{{ message }}"
|
message: "{{ message }}"
|
||||||
@ -170,6 +181,9 @@ 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') }}"
|
||||||
@ -187,7 +201,7 @@ sequence:
|
|||||||
sound:
|
sound:
|
||||||
name: default
|
name: default
|
||||||
critical: 1
|
critical: 1
|
||||||
volume: 1
|
volume: 1.0
|
||||||
action: "{{ repeat.item }}"
|
action: "{{ repeat.item }}"
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
@ -197,6 +211,8 @@ 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 }}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user