From c8c3fc7d3c342af7c92d6b8705f9e741255fafea Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Thu, 6 Mar 2025 16:36:52 +0100 Subject: [PATCH] added notifications to mobile app support --- notify/mobileapp.yaml | 9 +++++++++ scripts/notify.yaml | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 notify/mobileapp.yaml diff --git a/notify/mobileapp.yaml b/notify/mobileapp.yaml new file mode 100644 index 00000000..8dae74c1 --- /dev/null +++ b/notify/mobileapp.yaml @@ -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 diff --git a/scripts/notify.yaml b/scripts/notify.yaml index 66bd61a6..ea2ed1aa 100644 --- a/scripts/notify.yaml +++ b/scripts/notify.yaml @@ -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 -- 2.47.3