]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Minor fixes on notify
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 6 Mar 2025 15:35:42 +0000 (16:35 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 6 Mar 2025 15:35:42 +0000 (16:35 +0100)
scripts/notify.yaml

index f8a79bef9400799813103a7160cc446dce7114fd..66bd61a661564d0c82abe0f0e87b43e29e534a4f 100644 (file)
@@ -6,6 +6,7 @@
 # - destination
 # - notification_id
 # - enable_persistent
+# - enable_browser
 # - enable_telegram
 #
 # Operations:
@@ -46,6 +47,12 @@ notify_text:
         {% set enable_persistent = false %}
       {% endif %}
       {{ enable_persistent }}
+    enable_browser: >-
+      {# Check Null Input #}
+      {% if enable_browser | length == 0 %}
+        {% set enable_browser = false %}
+      {% endif %}
+      {{ enable_browser }}
     enable_telegram: >-
       {# Check Null Input #}
       {% if enable_telegram | length == 0 %}
@@ -88,6 +95,12 @@ notify_text:
       default: false
       selector:
         boolean:
+    enable_browser:
+      description: "Abilitare o meno la notifica sul browser"
+      example: "false"
+      default: false
+      selector:
+        boolean:
     enable_telegram:
       description: "Abilitare o meno la notifica su telegram"
       example: "false"
@@ -112,6 +125,29 @@ notify_text:
         title: "{{ title }}"
         message: "{{ message }}"
 
+    - choose:
+        - conditions:
+            - condition: template
+              value_template: "{{ enable_persistent }}"
+          sequence:
+          - action: persistent_notification.create
+            data_template:
+              title: "{{ title }}"
+              message: "{{ message }}"
+              notification_id: "{{ notification_id }}"
+      default: []
+
+    - choose:
+        - conditions:
+            - condition: template
+              value_template: "{{ enable_browser }}"
+          sequence:
+            - action: notify.html5
+              data_template:
+                title: "{{ title }}"
+                message: "{{ message }}"
+      default: []
+
     - choose:
         - conditions:
             - condition: template
@@ -123,20 +159,6 @@ notify_text:
                 message: "{{ message | regex_replace(find='_', replace='-', ignorecase=False) }}"
       default: []
 
-    - action: notify.html5
-      data_template:
-        title: "{{ title }}"
-        message: "{{ message }}"
-
-    - condition: template
-      value_template: "{{ enable_persistent }}"
-
-    - action: persistent_notification.create
-      data_template:
-        title: "{{ title }}"
-        message: "{{ message }}"
-        notification_id: "{{ notification_id }}"
-
 ######################################################################
 # Script: Volume Manager
 # Input:
@@ -312,6 +334,7 @@ notify_voice:
 # - destination
 # - notification_id
 # - enable_persistent
+# - enable_browser
 # - enable_telegram
 #
 # Operations:
@@ -373,6 +396,12 @@ notify_all:
         {% set enable_persistent = false %}
       {% endif %}
       {{ enable_persistent }}
+    enable_browser: >-
+      {# Check Null Input #}
+      {% if enable_browser | length == 0 %}
+        {% set enable_browser = false %}
+      {% endif %}
+      {{ enable_browser }}
     enable_telegram: >-
       {# Check Null Input #}
       {% if enable_telegram | length == 0 %}
@@ -441,6 +470,12 @@ notify_all:
       default: false
       selector:
         boolean:
+    enable_browser:
+      description: "Abilitare o meno la notifica sul browser"
+      example: "false"
+      default: false
+      selector:
+        boolean:
     enable_telegram:
       description: "Abilitare o meno la notifica su telegram"
       example: "false"
@@ -456,6 +491,7 @@ notify_all:
         destination: "{{ destination }}"
         notification_id: "{{ notification_id }}"
         enable_persistent: "{{ enable_persistent }}"
+        enable_browser: "{{ enable_browser }}"
         enable_telegram: "{{ enable_telegram }}"
 
     - action: script.notify_voice