]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Improved notification with variables
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Fri, 23 Oct 2020 09:31:46 +0000 (11:31 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Fri, 23 Oct 2020 09:31:46 +0000 (11:31 +0200)
scripts/notify.yaml

index 3550443192060aee1d8e2629c3c9c4a99759a151..0391b2fc7060b4f7812a2ca8467f7ecf47d47522 100644 (file)
 # - 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: