]> git.giorgioravera.it Git - homeassistant.git/commitdiff
added notifications to mobile app support
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 6 Mar 2025 15:36:52 +0000 (16:36 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 6 Mar 2025 15:36:52 +0000 (16:36 +0100)
notify/mobileapp.yaml [new file with mode: 0644]
scripts/notify.yaml

diff --git a/notify/mobileapp.yaml b/notify/mobileapp.yaml
new file mode 100644 (file)
index 0000000..8dae74c
--- /dev/null
@@ -0,0 +1,9 @@
+######################################################################
+# Mobile App Notifications
+######################################################################
+
+- name: mobileapp_all
+  platform: group
+  services:
+    - service: mobile_app_giorgio_s25
+    - service: mobile_app_lalaura_s_phone
\ No newline at end of file
index 66bd61a661564d0c82abe0f0e87b43e29e534a4f..ea2ed1aa4d8267f6dc48fc8692a98c25c3fd850e 100644 (file)
@@ -7,6 +7,7 @@
 # - notification_id
 # - enable_persistent
 # - enable_browser
+# - enable_mobileapp
 # - enable_telegram
 #
 # Operations:
@@ -53,6 +54,12 @@ notify_text:
         {% set enable_browser = false %}
       {% endif %}
       {{ enable_browser }}
+    enable_mobileapp: >-
+      {# Check Null Input #}
+      {% if enable_mobileapp | length == 0 %}
+        {% set enable_mobileapp = false %}
+      {% endif %}
+      {{ enable_mobileapp }}
     enable_telegram: >-
       {# Check Null Input #}
       {% if enable_telegram | length == 0 %}
@@ -101,6 +108,12 @@ notify_text:
       default: false
       selector:
         boolean:
+    enable_mobileapp:
+      description: "Abilitare o meno la notifica sull'app mobile"
+      example: "false"
+      default: false
+      selector:
+        boolean:
     enable_telegram:
       description: "Abilitare o meno la notifica su telegram"
       example: "false"
@@ -148,6 +161,24 @@ notify_text:
                 message: "{{ message }}"
       default: []
 
+    - choose:
+        - conditions:
+            - condition: template
+              value_template: "{{ enable_mobileapp }}"
+          sequence:
+            - service: >
+                {% if destination == 'giorgio' %}
+                  notify.mobile_app_giorgio_s25
+                {% elif destination == 'laura' %}
+                  notify.mobile_app_lalaura_s_phone
+                {% else %}
+                  notify.mobileapp_all
+                {% endif %}
+              data_template:
+                title: "{{ title }}"
+                message: "{{ message }}"
+      default: []
+
     - choose:
         - conditions:
             - condition: template
@@ -335,6 +366,7 @@ notify_voice:
 # - notification_id
 # - enable_persistent
 # - enable_browser
+# - enable_mobileapp
 # - enable_telegram
 #
 # Operations:
@@ -402,6 +434,12 @@ notify_all:
         {% set enable_browser = false %}
       {% endif %}
       {{ enable_browser }}
+    enable_mobileapp: >-
+      {# Check Null Input #}
+      {% if enable_mobileapp | length == 0 %}
+        {% set enable_mobileapp = false %}
+      {% endif %}
+      {{ enable_mobileapp }}
     enable_telegram: >-
       {# Check Null Input #}
       {% if enable_telegram | length == 0 %}
@@ -476,6 +514,12 @@ notify_all:
       default: false
       selector:
         boolean:
+    enable_mobileapp:
+      description: "Abilitare o meno la notifica sull'app mobile"
+      example: "false"
+      default: false
+      selector:
+        boolean:
     enable_telegram:
       description: "Abilitare o meno la notifica su telegram"
       example: "false"
@@ -492,6 +536,7 @@ notify_all:
         notification_id: "{{ notification_id }}"
         enable_persistent: "{{ enable_persistent }}"
         enable_browser: "{{ enable_browser }}"
+        enable_mobileapp: "{{ enable_mobileapp }}"
         enable_telegram: "{{ enable_telegram }}"
 
     - action: script.notify_voice