]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added notification_id to notify script
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Sun, 2 Feb 2020 13:37:49 +0000 (14:37 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Sun, 2 Feb 2020 13:37:49 +0000 (14:37 +0100)
automation/update_notifications.yaml
script/notify.yaml

index 0e8154282660183b2354927a9d2f75d3a2bac01f..a3657bdf35fd67fd18ffc6052eb88fcec5bc7b40 100644 (file)
@@ -15,6 +15,7 @@
     data_template:\r
       title: "Home Assistant - Aggiornamento"\r
       message: "E' disponibile un aggiornamento per Home Assistant {{ state_attr('binary_sensor.updater', 'newest_version') }}. {{now().strftime('%Y-%m-%d %I:%M %p')}}"\r
+      notification_id: "update"\r
       enable_persistent: 1\r
 \r
 ######################################################################\r
@@ -34,6 +35,7 @@
     data_template:\r
       title: "Shelly - Aggiornamento"\r
       message: "Sono disponibili aggiornamenti per i dispositivi Shelly"\r
+      notification_id: "update"\r
       enable_persistent: 1\r
 \r
 ######################################################################\r
@@ -53,4 +55,5 @@
     data_template:\r
       title: "HACS - Aggiornamento"\r
       message: "Sono disponibili aggiornamenti per i moduli HACS"\r
+      notification_id: "update"\r
       enable_persistent: 1\r
index 46262267e73616103755235a6d195e301e4f29f1..12a00a7b7e4e38e9196a9f59cd1c6e2643c1ee58 100644 (file)
@@ -3,6 +3,7 @@
 # Inputs:
 # - title
 # - message
+# - notification_id
 # - enable_persistent
 #
 # Operations:
@@ -40,6 +41,12 @@ notify_text_internal:
       data_template:
        title: "{{ title }}"
        message: "{{ message }}"
+       notification_id: >-
+         {# Check Null Input #}
+         {% if notification_id | length == 0 %}
+           {% set notification_id = 'generic' %}
+         {% endif %}
+         {{ notification_id }}
 
 notify_text:
   alias: Notifiche testuali
@@ -57,6 +64,7 @@ notify_text:
           {% endif %}
           {{ title }}
         message: "{{ message }}"
+        notification_id: "{{ notification_id }}"
         enable_persistent: "{{ enable_persistent }}"
 
 ######################################################################
@@ -157,6 +165,7 @@ notify_voice:
 # - volume_level
 # _ language
 # - message
+# - notification_id
 # - enable_persistent
 #
 # Operations:
@@ -171,6 +180,7 @@ notify_all:
       data_template:
         title: "{{ title }}"
         message: "{{ message }}"
+        notification_id: "{{ notification_id }}"
         enable_persistent: "{{ enable_persistent }}"
 
     - service: script.notify_voice