Arm alarm from ios notification

hey all,

I use the manual alarm config and have tried to add ios actions to arm and disarm the alarm, however when I select one of the options from the notification it doesn’t work and I get invalid code in the logs. is there a way to pass the code in? or am I getting it wrong?

#
# Alarm if certain conditions are met
#
  - alias: iOS Ask Alarm
    trigger:
      platform: state
      entity_id: device_tracker.sam
      from:  "home"
      to: "not_home"
    action:
      service: notify.ios_sam
      data:
        message: "Coming or Going?, Alarm?"
        data:
          push:
            category: "alarm"
  #
  # Catch the response from the alarm notification
  #
  - alias: Activate Alarm
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: ACTIVATE_ALARM
    action:
      - service: alarm_control_panel.alarm_arm_away
        entity_id: alarm_control_panel.home_alarm
  - alias: De-Activate Alarm
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: DE-ACTIVATE_ALARM
    action:
      - service: alarm_control_panel.alarm_disarm
        entity_id: alarm_control_panel.home_alarm
  - alias: 'Send notification when alarm triggered'
    trigger:
      - platform: state
        entity_id: alarm_control_panel.home_alarm
        to: 'triggered'
    action:
      service: notify.ios_sam
      data:
        message: "ALARM Triggered!"
        data:
          push:
            category: "alarm"

this is the error I get:

Invalid code given for disarmed

Anyone achieved arming or disarming the manual alarm using iOS notification actions?

Sorted: needed
Data:
Code: xxxx

1 Like

Hey,

Can you share your working Arm / Disarm with code for iOS?

Hi yoinks, here’s an automation that’s triggered from an iOS action. Either way the action block is reusable how ever you want to trigger it.

- alias: Activate Alarm
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: ACTIVATE_ALARM
    action:
      - service: alarm_control_panel.alarm_arm_away
        entity_id: alarm_control_panel.home_alarm
        data:
          code: !secret alarmcode

Thanks Sam,

Just what I was looking for.

Hey Sam,

Can you take a quick look here what I am doing wrong?
I do receieve the notifications with the message, but I just don’t get the action button(s)?

My Configuration:

# ios Push Notifications Enabled
ios:
  push:
    categories:
      - name: Info
        identifier: 'info'
        actions:
      - name: Disarm
        identifier: 'disarm'
        actions:
          - identifier: 'NOTIFICATION_DISARM'
            title: 'Frakoble'
      - name: Arm
        identifier: 'arm'
        actions:
          - identifier: 'NOTIFICATION_ARM'
            title: 'Tilkoble'

My Automation:

### Disarm Alarm/Arlo & Notification ###
- alias: '[Alarm/Arlo] Disarm & Notification'
  trigger:
    - platform: state
      entity_id: alarm_control_panel.house
      to: 'disarmed'
  action:
  - service: alarm_control_panel.alarm_disarm
    entity_id: alarm_control_panel.arlo
### Set Gateway Color Light OFF ###
  - service: light.turn_off
    entity_id:
    - light.gateway_light_xxxxxxxx
### Send a actionable notification ###
  - service: notify.ios_iphone
    data:
      message: 'Alarm/Arlo frakoblet: {{now().strftime("%H:%M %Y-%m-%d")}}'
      data:
        push:
          category: "arm"
  - service: notify.ios_ipadmini
    data:
      message: 'Alarm/Arlo frakoblet: {{now().strftime("%H:%M %Y-%m-%d")}}'
      data:
        push:
          category: "arm"
          
### Arm Alarm when action is chosen from iOS ###
- alias: '[Alarm/Arlo] Arm from iOS'
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: NOTIFICATION_ARM
  action:
  - service: alarm_control_panel.alarm_arm_away
    entity_id: alarm_control_panel.house
    data:
      code: !secret alarmcode

What have I missed?

Doesn’t look like you missed anything. Are you using an iPhone? I found using the iPhone 10 I had to use the press hard gesture to see the actions.

Hey Sam,

I got it working, but I must have made a typo or something, because suddenly it started working. So once again thanks for your help :blush: