iOS Actionable Notification - No Actions

automation
Tags: #<Tag:0x00007f47fd6c39b8>

#1

I am trying to get actions set up for my iOS notification but having no luck so far. Mu configuration and automation yaml looks like below.

configuration.yaml

ios:
  push:
    categories:
      - name: big_garage_open
        identifier: 'BIG_GARAGE_OPEN'
        actions:
            - identifier: 'CLOSE_BIG_GARAGE'
              title: 'Close Big Garage Door'
      - name: small_garage_open
        identifier: 'SMALL_GARAGE_OPEN'
        actions:
            - identifier: 'CLOSE_SMALL_GARAGE'
              title: 'Close Small Garage Door'

automation.yaml

- id: '1531033739661'
  alias: Big Garage Door is Open
  initial_state: true
  hide_entity: true
  trigger:
  - entity_id: binary_sensor.big_garage_door_sensor_sensor
    from: 'off'
    platform: state
    to: 'on'
    for:
      hours: 0
      minutes: 1
      seconds: 0
  action:
    service: notify.TROUBLE_MAKERS_IOS
    data: 
      title: 'Big Garage Door Check'
      message: 'Big Garage Door is open for last 5 minutes'
      data:
        push:
          badge: 0
          category: 'BIG_GARAGE_OPEN'

- id: '1531013739661'
  alias: Big Garage Door Action
  initial_state: true
  hide_entity: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: CLOSE_BIG_GARAGE
  action:
    service: cover.close_cover
    entity_id: cover.left_garage_door


- id: '1531003739661'
  alias: Small Garage Door is Open
  initial_state: true
  hide_entity: true
  trigger:
  - entity_id: binary_sensor.small_garage_door_sensor_sensor
    from: 'off'
    platform: state
    to: 'on'
    for:
      hours: 0
      minutes: 1
      seconds: 0
  action:
    service: notify.TROUBLE_MAKERS_IOS
    data: 
      title: 'Small Garage Door Check'
      message: 'Small Garage Door is open for last 5 minutes'
      data:
        push:
          badge: 0
          category: 'SMALL_GARAGE_OPEN'

- id: '1531013739651'
  alias: Small Garage Door Action
  initial_state: true
  hide_entity: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: CLOSE_SMALL_GARAGE
  action:
    service: cover.close_cover
    entity_id: cover.right_garage_door

Am I missing something? I do get notification just no actions. I am running HASSIO 0.73.1 on iOS 12

Resolved - Thanks to help for @Mark_Meijer

actions: identifier has to be uppercase.

ActionName in the automation has to be uppercase also.


#2

Have you refreshed the push settings in the iOS app? Also if you have just created them it can take a while for it to come through from apple.

Also basic thing but I missed it first time you actually have to view the notification message to see the actions


#3

Please edit your post and format your code by selecting it all and pressing the <> button in the message toolbar or by following the instructions in the blue banner at the top of this page.


#4

@tom_l Updated post with formated code.
@EGO01 Yes, I did that. I am getting notifications just no actions. Also selected view but that did not had any action either.


#5

I’ll give you my config that works for me. If it doesn’t work for you you’re doing something wrong in the app.

Config.yaml:

  ios:
    push:
        categories:
          - name: Test
            identifier: 'test'
            actions:
              - identifier: 'TEST'
                title: 'Testbutton 1'

action to trigger actionable notification:

- service: notify.<your_iOS_device>
  data:
    message: Test message
    data:
      push:
        category: test

Remember that you have to go to settings in the iOS app > notification settings > hit update push-settings


#6

The category has to be lowercase. Otherwise it’s not working.


#7

Changing category to small letter helped, now I am seeing action button but selecting those does not close the garage. I tried calling service manually with that paramenter and that worked.

Also does actions: identifier also have to be small case?

configuration.yaml

ios:
  push:
    categories:
      - name: big_garage_open_notification
        identifier: 'big_garage_open'
        actions:
            - identifier: 'close_big_garage'
              title: 'Close Big Garage Door'
      - name: small_garage_open_notification
        identifier: 'small_garage_open'
        actions:
            - identifier: 'close_small_garage'
              title: 'Close Small Garage Door'

automation.yaml

# Small Garage Door - left door

- id: '1531003739661'
  alias: Small Garage Door Notification
  initial_state: true
  hide_entity: true
  trigger:
  - entity_id: binary_sensor.small_garage_door_sensor_sensor
    from: 'off'
    platform: state
    to: 'on'
    for:
      hours: 0
      minutes: 1
      seconds: 0
  action:
    service: notify.TROUBLE_MAKERS_IOS
    data: 
      title: 'Small Garage Door Check'
      message: 'Small Garage Door is open for last 5 minutes'
      data:
        push:
          badge: 0
          category: 'small_garage_open'

- id: '1531013739651'
  alias: Small Garage Door Action
  initial_state: true
  hide_entity: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: close_small_garage
  action:
    service: cover.close_cover
    entity_id: cover.left_garage_door

#8

No, actions: identifier has to be uppercase.

ActionName in the automation has to be uppercase also.


#9

@Mark_Meijer Thank you very much. That worked :slight_smile:


#10

You’re welcome!


#11

Hi, could anyone point me in the right direction with this one? I’m trying a similar thing, this is what I’ve got in my configuration.yaml file

ios:
  push:
    categories:
      - name: Leaving_work
        identifier: 'LEAVINGWORK'
        actions:
          - identifier: 'PLAY_LEFTWORK_MESSAGE'
            title: 'I am on my way home'

and this is my automations.yaml file.

 - alias: Notify iOS Leaving Work
   initial_state: True
   hide_entity: False
   trigger:
     - platform: state
       entity_id: device_tracker.richard_pretious
       from: 'work'
       to: 'away'
   condition:
     - condition: time
       after: '16:45:00'
       before: '19:00:00'
   action:
     - service: notify.ios_richard_pretious
       data:
         title: "Leaving work message" 
         message: "Do you want to tell Amelia you've left" 
         data:
           push:
             badge: 0 
             category: 'LEAVINGWORK'

 - alias: iOS app notification message - I'm leaving work
   initial_state: True
   hide_entity: False
   trigger:
     - platform: event
       event_type: ios.notification_action_fired
       event_data:
       actionName: PLAY_LEFTWORK_MESSAGE
   action:
     - service: script.sonos_say
       data:
         sonos_entity: media_player.bedroom_2
         volume: 0.5
         message: 'I am on his way home'

I am getting this error;
Configuration invalid
Invalid config for [automation]: expected dict for dictionary value @ data[‘trigger’][0][‘event_data’]. Got None
extra keys not allowed @ data[‘trigger’][0][‘actionName’]. Got None. (See /config/configuration.yaml, line 203). Please check the docs at https://home-assistant.io/components/automation/

line 203 in my configuration.yaml is;

# group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

so I am confused.


#12

have you seen this?


I also have an extensive ios file you can review.

#13

In your automation;
ActionName is an option for event_data, so your solution is two extra spaces before ActionName :slight_smile:


#14

Thanks Mark, sorted!


#15

Hi Mark,
Sorry to be a paid but could you also tell me where I’m going wrong here? I want to send a message with the travel time, I have this in my automation.yaml file;

   action:
     - service: script.sonos_say
       data:
         sonos_entity: media_player.bedroom_2
         volume: 0.5
         message: "Richard has left work, and will arrive Home in about, {{states('sensor.Richard_To_Home')}} minutes"

And these in my configuration.yaml file;

  - platform: google_travel_time
    name: Richard To Home
    api_key: xxxx.xxxx.xxxx.xxxx.xxxx.xxxx
    origin: device_tracker.google_maps_richardpretiousgmailcom
    destination: zone.Home

zone:
  - name: Work
    latitude: 888.888888
    longitude: 222.2222222
    radius: 100
    icon: mdi:office
  - name: Home
    latitude: 999.9999999
    longitude: 111.111111
    radius: 100
    icon: mdi:home-variant

I am getting this error;
Invalid config for [automation]: [zone] is an invalid option for [automation]. Check: automation->trigger->0->zone. (See /config/configuration.yaml, line 211). Please check the docs at https://home-assistant.io/components/automation/


#16

Scrap that last one, I’ve worked it out - I think.


#17

I’ve tried to get this to work off an on over the past few months, and never seem to get the alert on my phone. Any sugestions as to what I’m doing wrong

ios:
  push:
    categories:
      - name: Garage Alert
        identifier: 'garage_alert'
        actions:
          - identifier: 'CANCEL_GARAGE_ALERT'
            title: 'Cancel Alert'
          - identifier: 'CLOSE_GARAGE'
            title: 'Close Garage'

Automations

- alias: Actionable Garage Door Alert
  trigger:
  - platform: state
    entity_id: cover.garage_door_opener
    to: 'open'
    for:
      minutes: 3
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  action:
  - service: notify.ios_pauls_phone
    data:
      message: "Garage Door is Open"
      data:
        push:
          category: "garage_alert" 

- alias: iOS Actionable Notification for Garage Door
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: CLOSE_GARAGE
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  action:
    service: cover.close_cover
    entity_id: cover.garage_door_opener

I opened the garage and never got an alert. I did go into the app and refreshed the sounds and notifications after setting this up.


#18

Do you get the notification when you test the actionable alert notification from within home assistant?


#19

Same thing here. I have actionable notifications for the Alarm clock (Creating an iOS Alarm Clock w/ Snooze and Awake Actionable Notifications). The notifications shows up, but when I click on them the action does not work. It calls a script that, using it through front end, works perfectly.

Here is the code

ios:
  push:
    categories:
      - name: alarm_clock
        identifier: 'alarmclock'
        actions:
          - identifier: 'AWAKE'
            title: 'Awake'
            destructive: yes
          - identifier: 'SNOOZE'
            title: 'Snooze'
            destructive: no

And the automations

- id: a_alarm_clock_awake_action
  alias: alarm clock awake action
  initial_state: true
  hide_entity: true  
  trigger:
    platform: event
    event_type: ios.notification_action_fired    
    event_data:
      actionName: AWAKE
  action: 
    - service: script.s_alarm_clock_awake
      entity_id: script.s_alarm_clock_awake
  
- id: a_alarm_clock_snooze_action
  alias: alarm clock snooze action
  initial_state: true
  hide_entity: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired    
    event_data:
      actionName: SNOOZE
  action:
    - service: script.turn_on
      entity_id: script.s_alarm_clock_snooze

#20

I did end up getting this to work. 100% user error. My notify service had a typo.

I do have a very similar one that does not work though. it’s based on a device tracker. Alert never triggered.

ios:
  push:
    categories:
      - name: Shopping Alert
        identifier: 'shopping_alert'
        actions:
          - identifier: 'CANCEL_SHOPPING_ALERT'
            title: 'No'
          - identifier: 'OPEN_GARAGE_WHEN_I_GET_HOME'
            title: 'Yes'
- alias: Actionable Open Garage Door When Tracy gets Home
  trigger:
  - platform: state
    entity_id:
      - device_tracker.tracy_all
    to: 'Costco'
    for:
      minutes: 5
  - platform: state
    entity_id:
      - device_tracker.tracy_all
    to: 'Sams'
    for:
      minutes: 5
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  action:
  - service: notify.ios_pauls_iphone
    data:
      message: "Looks like you're Shopping.  Do you want the garage to open when you get home?"
      data:
        push:
          category: "shopping_alert" 


- alias: iOS Actionable Notification to open Garage when Tracy Gets Home
  trigger:
  - platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: OPEN_GARAGE_WHEN_I_GET_HOME
  condition:
  - condition: numeric_state
    entity_id: sensor.ha_runtime_in_minutes
    above: 1
  action:
  - service: input_boolean.turn_on
    entity_id: input_boolean.open_garage_for_tracy