I am trying to implement an actionable iOS notification that is triggered by an automation to arm my alarm when we leave. In this example, my alarm requires a pin to be entered to arm it.
I have the iOS Push notification setup as follows and this works correctly.
ios:
push:
categories:
- name: Arm House Alarm
identifier: 'arm_alarm'
actions:
- identifier: 'CONFIRM_ARMING'
title: 'Activate Alarm'
activationMode: 'background'
authenticationRequired: yes
destructive: yes
behavior: 'textInput'
textInputButtonTitle: 'Enter Code:'
textInputPlaceholder: ''
- identifier: 'IGNORE_ARMING'
title: 'Ignore Alarm Activation'
activationMode: 'background'
authenticationRequired: no
destructive: no
behavior: 'default'
I then have the following request automation configured:
- id: ACTIONABLE_REQ-001
alias: Actionable Request - Request alarm to be enabled as nobody is home.
trigger:
- entity_id: binary_sensor.people_home
platform: state
to: 'off'
for:
minutes: 5
action:
service: notify.ios_user1_iphone
data:
message: "Nobody is home. Would you like to turn on the alarm?"
data:
push:
category: "arm_alarm"
Now this is where I get confused. I am assuming I need a separate automation to listen for the iOS push notification response (that contains the pin code that was entered into the push notification request) to then use to arm the alarm. So, with that concept in mind, I then have this separate automation waiting for a response:
- id: ACTIONABLE_RESP-001
alias: Actionable Response - Receive arm request with pin and activate accordingly
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: arm_alarm
action:
- alias: Turn on Alarm
service: alarm_control_panel.alarm_arm_home
data:
entity_id: alarm_control_panel.nx584
code: '{{ ios.notification_action_fired.action_data }}'
This however does not do what I expect it to do and the alarm does not arm.
Am I going about this the right way? I cannot find any examples of actionable iOS notifications that request a text entry (e.g. a pin code), that can then be used by an action in the automation.
Thanks!