From 0b503aab4100be77360b367dc532e0ba2ed9847b Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sun, 5 Mar 2023 15:09:09 -0500 Subject: [PATCH] Text notify can now send actionable notifications, close #78 --- packages/notify.yaml | 9 +++++++++ packages/presence.yaml | 27 ++++++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/packages/notify.yaml b/packages/notify.yaml index 8ef2794..8ea2a9c 100644 --- a/packages/notify.yaml +++ b/packages/notify.yaml @@ -724,6 +724,12 @@ script: required: false selector: text: + actions: + name: Actions + description: Dictionary describing actions for an actionable notification + required: false + selector: + object: sequence: - choose: - conditions: @@ -749,6 +755,7 @@ script: message: "{{ message }}" data: tag: '{{ tag if tag is defined else "{}" }}' + actions: '{{ actions if actions is defined else "{}" }}' entity_id: '{{ entity if entity is defined else "{}" }}' push: sound: @@ -777,6 +784,7 @@ script: message: '{{ message }}' data: tag: '{{ tag if tag is defined else "{}" }}' + actions: '{{ actions if actions is defined else "{}" }}' entity_id: '{{ entity if entity is defined else "{}" }}' push: sound: @@ -833,6 +841,7 @@ script: message: '{{ message }}' data: tag: '{{ tag if tag is defined else "{}" }}' + actions: '{{ actions if actions is defined else "{}" }}' entity_id: '{{ entity if entity is defined else "{}" }}' push: sound: diff --git a/packages/presence.yaml b/packages/presence.yaml index d8f421e..63b17f6 100644 --- a/packages/presence.yaml +++ b/packages/presence.yaml @@ -468,21 +468,22 @@ script: - condition: state entity_id: group.adults state: not_home - - service: > - {% if states('person.christina_stork') in ['Bob Evans','BobEvans'] %} - notify.ios_nerds - {% else %} - notify.all_ios - {% endif %} + - service: script.text_notify data: + who: > + {% if states('person.christina_stork') in ['Bob Evans','BobEvans'] %} + nerds + {% else %} + all + {% endif %} + type: alert title: "Everyone Left" - message: "Away mode arming in 1 minute" - data: - tag: skip-away - actions: - - action: "SKIP_AWAY" - title: Skip Away Mode - icon: mdi:debug-step-over + message: "Away Mode arming in 1 minute" + tag: skip-away + actions: + - action: "SKIP_AWAY" + title: Skip Away Mode + icon: mdi:debug-step-over - wait_template: "{{ is_state('input_boolean.away_mode_skipped','on') or is_state('group.adults','home') }}" continue_on_timeout: true timeout: