From 7f0513a129639c31ed4f5e123ab5c409ebecc108 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Mon, 29 Aug 2022 03:30:24 -0400 Subject: [PATCH] Actionable notification to optionally arm security on "Give Me Darkness" --- packages/alexa.yaml | 37 +++++++++++++++++++++++++++++++++++++ scripts.yaml | 6 +++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/packages/alexa.yaml b/packages/alexa.yaml index f9d5e5a..08980a6 100644 --- a/packages/alexa.yaml +++ b/packages/alexa.yaml @@ -81,6 +81,43 @@ automation: action: - service: script.kallen_desktop_wake + - id: d1edfcf7-2712-49f4-b8f1-17f5b184b5ce + alias: Arm security on Give Me Darkness + trigger: + - platform: event + event_type: alexa_actionable_notification + event_data: + event_id: actionable_notification_night_security_arm + event_response_type: ResponseYes + id: security-yes + - platform: event + event_type: alexa_actionable_notification + event_data: + event_id: actionable_notification_night_security_arm + event_response_type: ResponseNo + id: security-no + action: + - if: + - condition: trigger + id: security-yes + then: + - service: script.security_arm_home + - delay: + seconds: 1 + - service: script.speech_engine + data: + who: "{{ states('sensor.last_alexa') }}" + message: "Security is armed, guard dogs deployed, and lasers set from stun to kill!" + - if: + - condition: trigger + id: security-no + then: + - service: script.speech_engine + data: + who: "{{ states('sensor.last_alexa') }}" + message: "Security squadron is standing down, but always at your service!" + + script: activate_alexa_actionable_notification: diff --git a/scripts.yaml b/scripts.yaml index dc18f0b..123ac73 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -56,7 +56,11 @@ give_me_darkness: {% else %} true {% endif %} - - service: script.security_arm_home + - service: script.activate_alexa_actionable_notification + data_template: + text: 'Would you like me to arm the security system?' + event_id: 'actionable_notification_night_security_arm' + alexa_device: "{{ states('sensor.last_alexa') }}" mode: single icon: mdi:weather-night start_youtube: