From 911d34d9988a88f2a8b3be6e0c9e15fea6e8aec7 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Fri, 23 Oct 2020 11:31:46 +0200 Subject: [PATCH] Improved notification with variables --- scripts/notify.yaml | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/scripts/notify.yaml b/scripts/notify.yaml index 35504431..0391b2fc 100644 --- a/scripts/notify.yaml +++ b/scripts/notify.yaml @@ -12,9 +12,21 @@ # - persistent_notification.create (if enable_persistent) ###################################################################### -notify_text_internal: +notify_text: alias: Notifiche testuali + variables: + title: >- + {# Check Null Input #} + {% if title | length == 0 %} + {% set title = 'Home Assistant' %} + {% endif %} + {{ title }} + sequence: + - condition: state + entity_id: input_boolean.text_notifications + state: 'on' + - service: notify.mail data_template: title: "{{ title }}" @@ -48,25 +60,6 @@ notify_text_internal: {% endif %} {{ notification_id }} -notify_text: - alias: Notifiche testuali - sequence: - - condition: state - entity_id: input_boolean.text_notifications - state: 'on' - - - service: script.notify_text_internal - data_template: - title: >- - {# Check Null Input #} - {% if title | length == 0 %} - {% set title = 'Home Assistant' %} - {% endif %} - {{ title }} - message: "{{ message }}" - notification_id: "{{ notification_id }}" - enable_persistent: "{{ enable_persistent }}" - ###################################################################### # Script: Volume Manager # Input: -- 2.47.3