Push notification action button do not work

Hi there,

I was just going over the action button push notifications documentation and I can fire the notification but I do not get any button?

My config is separated into different files but this is what it looks like:

iOS:

push:
  categories:
    - name: geolights
      identifier: 'GeoLights'
      actions:
        - identifier: 'Lights_on'
          title: 'Switch Lights on'
          activationMode: 'background'
          authenticationRequired: yes
          destructive: yes
          behavior: 'default'

Automation:

### Send push to ios when coming home
- alias: Push when arriving home
  hide_entity: true
  trigger:
      - platform: state
        entity_id: device_tracker.nils_iphone_se
        to: 'home'
  action:
    - service: notify.ios_nils_iphone_se
      data:
        message: "Arriving home"
        data:
           push:
             badge: 5
             category: "GeoLights"

### React to push reply and turn on lights
- alias: Lights on when arriving home
  hide_entity: true
  trigger:
      - platform: event
        event_type: ios.notification_action_fired
        event_data:
          actionName: Lights_on
  action:
    - service: homeassistant.turn_on
      entity_id: light.livingroom_door

Once I’m changing the state from not home to home I’ll get a notification which says “Arriving home” but no button and also the HA apps shows a badge with the number of notification which I can’t get rid of.

Any ideas ? Did I miss anything?

1 Like

I have not been able to get this working either

Im looking at this now and i myself am having problems. I get the message in a notification but no button action.

Your config looks very similar to mine, the only thing i can see wrong with yours is the category identifiers and action parameter identifiers are not UPPERCASE and the documentation says that uppercase is a requirement.

https://home-assistant.io/ecosystem/ios/notifications/actions/

–

This is the output from the log i have when my automation is executed:

17-01-16 20:57:57 homeassistant.components.automation: Executing Ask if to Enable Work from home
17-01-16 20:57:57 homeassistant.core: Bus:Handling <Event logbook_entry[L]: domain=automation, name=Ask if to Enable Work from home, message=has been triggered, entity_id=automation.ask_if_to_enable_work_from_home>
17-01-16 20:57:57 homeassistant.helpers.script: Script Ask if to Enable Work from home: Running script
17-01-16 20:57:57 homeassistant.helpers.script: Script Ask if to Enable Work from home: Executing step call service
17-01-16 20:57:57 homeassistant.core: Bus:Handling <Event call_service[L]: domain=notify, service_call_id=1978288752-16, service_data=data=push=category=WFH, message=Are you working from home today?, service=ios_daves_iphone>

Also badge: 5 set the app badge to 5 - seems a bit pointless really especially as you cant clear it.

@robbiet480 - is this functionality properly working in the current beta release of the iOS app?

I was able to get push actions to work.

My IOS config looks like this. I think the key here is the name needs to be lowercase and Identifier is UPPERCASE

ios:
  push:
    categories:
      - name: door
        identifier: 'DOOR'
        actions:
          - identifier: 'OPEN_FIRST'
            title: 'Open First'
          - identifier: 'OPEN_SECOND'
            title: 'Open Second'
          - identifier: 'OPEN_THIRD'
            title: 'Open Third'

My Notification looks like this.

- alias: Notify iOS app
  trigger:
    platform: state
    entity_id: device_tracker.ryans_iphone
    state: 'home'
  action:
    service: notify.iosapp_ryans_iphone_app
    data:
      message: "Something happened at home!"
      data:
        push:
          badge: 0 # this will remove the badge/app icon number
          category: 'DOOR'
        action_data:
          entity_id: light.test # I am no sure what this does.

Then My action automations look like this.

- alias: iOS app notification action pressed1
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: OPEN_FIRST
  action:
   service: homeassistant.turn_on
   entity_id: light.basement
   
   
- alias: iOS app notification action pressed2
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: OPEN_SECOND
  action:
   service: homeassistant.turn_on
   entity_id: light.basement
   
   
- alias: iOS app notification action pressed3
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: OPEN_THIRD
  action:
   service: homeassistant.turn_on
   entity_id: light.basement

Dont forget after making all these changes you restart HASS and Update the push settings from the IOS HA app in the settings menu.

2 Likes

Awesome - got this working also. I actually think my problem was that i hadnt updated my push settings from the app. For good measure i removed and reinstalled the app anyway as it was having problems connecting for some reason.

I also changed my name to lowercase and had no space for good measure also. Either way it works now so thanks for your help on this.

Can start having some more fun with automations now.

That did the trick indeed working now

EDIT: Solved! I can’t believe it…
I re-read the documentation, but there doesn’t seem to be anything there about “update push settings” in the app itself after editing the config and restarting hass. I know it’s in this thread, but I missed it again.
I’ll leave this here since this config works:

(in the past…) I’ve been trying for hours and can’t figure out what I’m missing. My LIGHTS category works, but my RESTART one just sends a simple message with no actions. Please let me know what I’ve got wrong.
I thought maybe RESTART was a reserved word, but I’ve tried other things there.

ios:
  push:
    categories:
      - name: lights
        identifier: 'LIGHTS'
        actions:
          - identifier: 'LIGHTS_OFF'
            title: 'All Lights Off'
            activationMode: 'background'
            authenticationRequired: no
            behavior: 'default'
          - identifier: 'LIGHTS_JUST_TV'
            title: 'Just TV Light On'
            activationMode: 'background'
            authenticationRequired: no
            behavior: 'default'
      - name: restart
        identifier: 'RESTART'
        actions:
          - identifier: 'RESTART_PI_HASS'
            title: 'Restart HA on Pi'
            activationMode: 'background'
            authenticationRequired: no
            behavior: 'default'
          - identifier: 'RESTART_PI_SWITCH'
            title: 'Have coffee'
            activationMode: 'background'
            authenticationRequired: no
            behavior: 'default'

automation:
  - alias: 'Left the Lights On'
    trigger:
    - platform: state
      entity_id: group.all_devices
      to: 'not_home'
    action:
      service: notify.ios_lwi6
      data:
        message: "The lights are on and no one's home"
        data:
          push:
            category: 'LIGHTS'
  
  - alias: "Restart Pi HA if Offline"
    trigger:
    - platform: state
      entity_id: binary_sensor.pi_kitchen_hass
      state: 'off'
    action:
      service: notify.ios_lwi6
      data:
        message: "Pi Home Assistant stopped running"
        data:
          push:
            category: 'RESTART'
  
  # ACTIONS from ios notifications
  - alias: iOS action lights off
    hide_entity: True
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: LIGHTS_OFF
    action:
     service: homeassistant.turn_off
     entity_id: group.all_lights
  
  - alias: iOS action tv light on
    hide_entity: True
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: LIGHTS_JUST_TV
    action:
    - service: homeassistant.turn_off
      entity_id: group.all_lights
    - service: homeassistant.turn_on
      entity_id: light.sunflower_2bd9
  
  - alias: iOS action restart Pi hass
    hide_entity: True
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: RESTART_PI_HASS
    action:
      service: shell_command.restart_pi_hass
  
  - alias: iOS action something else
    hide_entity: True
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: RESTART_PI_SWITCH
    action:
      service: homeassistant.turn_on
      entity_id: switch.jug

HEY thanks i was able to get it work
my question is what will be the command to turn off my lights off on this configuration

ios:
  push:
    categories:
      - name: lights
        identifier: 'LIGHT'
        actions:
          - identifier: 'LIGHT_S'
            title: 'turn bedroom off'
          
           
automation:
  - alias: Notify iOS app
    trigger:
      platform: state
      entity_id: group.main_test_lights
      state: 'on'
    action:
      service: notify.ios_testejemlpo_iphone
      data:
        message: "Bedroom lights are on!"
        data:
          push:
            badge: 0 # this will remove the badge/app icon number
            category: 'LIGHT'
          action_data:
            entity_id: light.test # I am no sure what this does.



  - alias: iOS app notification action pressed1
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: TURN_OFF
    action:
     service: homeassistant.turn_on
     entity_id: group.main_test_lights

I know this is an old thread, but just incase someone comes looking here to try and fix or work out iOS notifications, note that version 0.54 introduced a breaking change for actionable iOS notifications

Category identifiers must now all be LOWER case NOT upper as it used to be.

Action identifiers can be either upper or lower case within iOS section of config. However, they must be upper case if specified as a trigger in automations. When HomeAssistant receives the action fired event from the iPhone, the action name is automatically uppercase, regardless of whether upper or lower case was used when the actionable notification has been written under iOS section of config. If the trigger action identifier is not uppercase, the automation will not be triggered. For this reason, I’m keeping my action identifiers in upper case in both iOS and automation sections of the config.

In summary, since 0.54, category identifiers must be lower case and action identifiers are easier to keep as upper case, especially if they already are uppercase within your config. And don’t forget to update push settings in the iOS app via Settings>Notification Settings>Update Push Settings!

4 Likes