Actionable notifications on 2.0 beta

Hi,

I’m trying to get actionable notifications to work on the new 2.0 beta (build 53), but don’t succeed. Does anyone know what’s wrong with the config + automation?

config:

  ios:
      push:
        categories:
           - name: Alarm
             identifier: 'alarm'
             actions:
                - identifier: 'SOUND_ALARM'
                  title: 'Sound Alarm'
                  activationMode: 'background'
                  authenticationRequired: true
                  destructive: true
                  behavior: 'default'

automation:

    action:
       - service: notify.mobile_app_iphone
         data:
           message: "There is someone in the house"
           data:
              push:
                 category: "alarm"

Thanks
Cadish

Stupid mistake… Needed to Import push configuration from server on my app…

Solved!

1 Like

Mine will not Work at all. I am on 58 and 0.92.2.
Wenn I use config with “mobile_app” no notification is imported wenn chossing this option in the notifications menu.
Wenn I use “ios” instead it IS imported but wenn I press the action button nothing happens (not even the “authentification” appears.

This is my config and automations. Can someone see what is wrong?

ios:
  push:
    categories:
      - name: Alarm
        identifier: 'alarm'
        actions:
          - identifier: 'TOGGLE_TEST'
            title: 'Toggle kitchen'
            activationMode: 'background'
            authenticationRequired: true
            destructive: true
            behavior: 'default'

  - alias: Notify iOS test
    trigger:
      - platform: state
        entity_id: media_player.kitchen
        from: 'paused'
        to: 'playing'
    action:
      service: notify.mobile_app_jespers_iphone
      data:
        message: "iOS test"
        data:
          push:
            category: "alarm"

  - alias: iOS notification action pressed
    hide_entity: true
    trigger:
      - platform: event
        event_type: ios.notification_action_fired
        event_data:
          actionName: TOGGLE_TEST
    action:
      - service: light.toggle
        entity_id: light.kitchen

Push config remains under ios. It does not get moved under mobile_app.

But I have used ios in config but nothing happens when pressing the action button. The notification gets through though.

Are you 100% sure the event isn’t firing back to Home Assistant? Maybe you aren’t catching the right event? Take a look here for more info

It seems the only difference between the docs and my automation is the action_data part.
I am not using that but don´t know if that is essential.
Where can I see if the event is getting through back to HA?
Anyway shouldn´t I get some authentification request when pressing the action button?

It seems the only difference between the docs and my automation is the action_data part.
I am not using that but don´t know how essential that is.
Where can I see if the event is getting through back to HA?
Anyway shouldn´t I get some authentification request when pressing the action button?

You won’t see an authentication request since we have a long lived token.

You need to increase your logging level high enough to see debug messages from homeassistant.components.mobile_app.

If no authentification is requiered what is then the difference between “authenticationRequired: true” and “authenticationRequired: false” in the config?

I have increased logging level and get this in the log but nothing happens:

2019-05-28 08:41:50 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/webhook/7e2449beb7f75569fcd9886585d4a29d5e4db673cf5890abe3ea26fb8c4a1b7e to 192.168.1.1 (auth: False)
2019-05-28 08:41:50 DEBUG (MainThread) [homeassistant.components.mobile_app.helpers] Successfully decrypted mobile_app payload
2019-05-28 08:41:50 DEBUG (MainThread) [homeassistant.components.mobile_app.webhook] Received webhook payload for type fire_event: {'event_data': {'sourceDevicePermanentID': 'CDE859FE-D631-4AD0-B4F0-6568CA636CDF', 'sourceDeviceName': 'Jespers-iPhone', 'sourceDeviceID': 'jespersiphone_beta', 'actionName': 'TOGGLE_TEST'}, 'event_type': 'ios.notification_action_fired'}
2019-05-28 08:41:50 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event ios.notification_action_fired[R]: sourceDevicePermanentID=CDE859FE-D631-4AD0-B4F0-6568CA636CDF, sourceDeviceName=Jespers-iPhone, sourceDeviceID=jespersiphone_beta, actionName=TOGGLE_TEST>

The only difference is if true iOS will ask for your passcode or Face ID or Touch ID before continuing and the button will be red. More info here (in the table).

The event is coming in, so your automation isn’t catching it properly.

I have tried to set it to “false” but no difference to “true”. No passcode or faceID is required when pressing the red button.

My automation looks like this but I can´t see what is wrong.

      - alias: iOS notification action pressed
        trigger:
          - platform: event
            event_type: ios.notification_action_fired
            event_data:
              actionName: TOGGLE_TEST
        action:
          - service: light.toggle
            entity_id: light.kitchen

I don’t know if you can have triggers specified as a list like that. Please use the example syntax at the bottom of the docs which only has a single trigger instead of a list.

Please also use proper syntax highlighting when pasting YAML or log lines. A guide on how to do that is in the blue header box at the top of the forums.

Hmm I am not quite sure what you mean by triggers like a list. When I compare my automation and the one from the docs I don´t see any difference. Can you be more specific?
But anyhow shouldn´t I get the Face ID or Touch ID when “true” no matter what?

I think he might mean that you have a dash before platform and service which I think you only need to do if you are listing more than one.

Oh I see. I tried now to remove the dashes but there was no difference.
However by coincidence I tried to rename the alias from “pressed” to “pressed 1” and then it worked? strange!
So the buttons now Work but no matter what I do, I get no passcode or face ID requirements.
Anyone got this to Work?

Update: solved! passcode or faceID is only required when phone is locked and “authenticationRequired” is set to true.

update: But it would be nice if I would get the passcode or faceID request when choosen “authenticationRequired” even though I have unlocked the phone.

I can’t seem to get the action menu to show up. The notifications (both IOS and Alexa) work great. Force pressing doesn’t give options either. I have tried 2 different phones. Currently on 0.93.2. I think I have this correct by following this guide but I must be missing something. My Config looks like this:

ios:
  push:
    categories:
      - name: Garage
        identifier: 'garage'
        actions:
          - identifier: 'CLOSE_GARAGE'
            title: 'Close Garage Door'
            activationMode: 'background'
            authenticationRequired: false
            destructive: true
            behavior: 'default'

Automations look like this:

################################################################################################################
#                                                                                                              #
# Garage Door Open Notification                                                                                #
#                                                                                                              #
################################################################################################################
- alias: Garage Door Open Notification 
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.garage_door
    to: 'on'
  action:
    - service: notify.mobile_app_jeff_welvaerts_iphone
      data: 
        message: "The Garage Door Is Open"
        data: 
          push:
            category: "garage" 
            sound: "US-EN-Daisy-Garage-Door-Open.wav"
            badge: 0
          action_data:
            entity_id: switch.garage_control         
    - service: notify.alexa_media
      data:
        target: 
          group.alexa
        data:
          type: announce
        message: "The Garage Door Is Open"
################################################################################################################
#                                                                                                              #
# Garage Door Notification Action Button                                                                       #
#                                                                                                              #
################################################################################################################        
- alias: Garage Door Notification Action Button 
  initial_state: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: CLOSE_GARAGE 
  action:
    service: switch.turn_on
    entity_id: switch.garage_control   

I’ve pressed “Import push configuration from server” dozens of times.
After triggering the automation my log says:

2019-05-29 17:28:18 INFO (MainThread) [homeassistant.components.automation] Executing Garage Door Open Notification
2019-05-29 17:28:18 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Running script
2019-05-29 17:28:18 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Executing step call service
2019-05-29 17:28:19 INFO (MainThread) [homeassistant.components.mobile_app.notify] mobile_app push notification rate limits for Jeff Welvaert’s iPhone: 11 sent, 150 allowed, 0 errors, resets in 1:31:40
2019-05-29 17:28:19 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Executing step call service
2019-05-29 17:28:19 INFO (SyncWorker_0) [custom_components.alexa_media.notify] Message: The Garage Door Is Open, kwargs: {'target': ['group.alexa'], 'data': OrderedDict([('type', 'announce')])}
2019-05-29 17:28:19 INFO (SyncWorker_0) [custom_components.alexa_media.notify] f*****[email protected]: Announce by <Entity Bedroom Echo: standby> to targets: ['9************0V1', '3****************************f29', '8****************************891', '9****************************a9f', 'd****************************7c6']: The Garage Door Is Open

In the mobile app nothing shows up in the event log.
What am I doing wrong here?

You should increase your log level for homeassistant.components.mobile_app and homeassistant.core to debug. You should then be able to see the event coming in. If you don’t see it, then something is going wrong.

Not really sure what I’m looking for -

2019-05-29 22:13:23 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140180744663896] Received {'type': 'config/entity_registry/get', 'entity_id': 'automation.garage_door_open_notification', 'id': 15}
2019-05-29 22:13:23 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140180744663896] Sending {'id': 15, 'type': 'result', 'success': False, 'error': {'code': 'not_found', 'message': 'Entity not found'}}
2019-05-29 22:13:23 DEBUG (MainThread) [homeassistant.components.http.view] Serving /auth/token to 192.168.1.30 (auth: False)
2019-05-29 22:13:23 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/history/period/2019-05-29T23:22:09.184Z to 192.168.1.30 (auth: True)
2019-05-29 22:13:23 DEBUG (SyncWorker_1) [homeassistant.components.recorder.util] converting 2 rows to native objects took 0.008297s
2019-05-29 22:13:23 DEBUG (SyncWorker_1) [homeassistant.components.history] get_significant_states took 0.010600s
2019-05-29 22:13:23 DEBUG (SyncWorker_1) [homeassistant.components.history] getting 0 first datapoints took 0.000001s
2019-05-29 22:13:23 DEBUG (MainThread) [homeassistant.components.history] Extracted 2 states in 0.012283s
2019-05-29 22:13:23 DEBUG (MainThread) [aioesphomeapi.connection] sonoff2.local: Sending <class 'api_pb2.PingRequest'>: 
2019-05-29 22:13:23 DEBUG (MainThread) [aioesphomeapi.connection] sonoff2.local: Write: 00 00 07
2019-05-29 22:13:23 DEBUG (MainThread) [aioesphomeapi.connection] sonoff2.local: Got message of type <class 'api_pb2.PingResponse'>: 
2019-05-29 22:13:24 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/states/binary_sensor.snapshots_stale to 172.30.32.2 (auth: True)
2019-05-29 22:13:25 DEBUG (SyncWorker_4) [homeassistant.helpers.storage] Writing data for auth
2019-05-29 22:13:25 DEBUG (MainThread) [aioesphomeapi.connection] garage_door.local: Sending <class 'api_pb2.PingRequest'>: 
2019-05-29 22:13:25 DEBUG (MainThread) [aioesphomeapi.connection] garage_door.local: Write: 00 00 07
2019-05-29 22:13:25 DEBUG (MainThread) [aioesphomeapi.connection] garage_door.local: Got message of type <class 'api_pb2.PingResponse'>: 
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140180744663896] Received {'type': 'call_service', 'domain': 'automation', 'service': 'trigger', 'service_data': {'entity_id': 'automation.garage_door_open_notification'}, 'id': 16}
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=automation, service=trigger, service_data=entity_id=automation.garage_door_open_notification>
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Garage Door Open Notification, entity_id=automation.garage_door_open_notification>
2019-05-29 22:13:26 INFO (MainThread) [homeassistant.components.automation] Executing Garage Door Open Notification
2019-05-29 22:13:26 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Running script
2019-05-29 22:13:26 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Executing step call service
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=mobile_app_jeff_welvaerts_iphone, service_data=message=The Garage Door Is Open, data=push=category=garage, sound=US-EN-Daisy-Garage-Door-Open.wav, badge=0, action_data=entity_id=switch.garage_control>
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.140180744663896] Received {'type': 'call_service', 'domain': 'automation', 'service': 'trigger', 'service_data': {'entity_id': 'automation.garage_door_open_notification'}, 'id': 17}
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=automation, service=trigger, service_data=entity_id=automation.garage_door_open_notification>
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Garage Door Open Notification, entity_id=automation.garage_door_open_notification>
2019-05-29 22:13:26 INFO (MainThread) [homeassistant.components.automation] Executing Garage Door Open Notification
2019-05-29 22:13:26 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Executing step call service
2019-05-29 22:13:26 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=mobile_app_jeff_welvaerts_iphone, service_data=message=The Garage Door Is Open, data=push=category=garage, sound=US-EN-Daisy-Garage-Door-Open.wav, badge=0, action_data=entity_id=switch.garage_control>
2019-05-29 22:13:27 INFO (MainThread) [homeassistant.components.mobile_app.notify] mobile_app push notification rate limits for Jeff Welvaert’s iPhone: 3 sent, 150 allowed, 0 errors, resets in 20:46:32
2019-05-29 22:13:27 INFO (MainThread) [homeassistant.helpers.script] Script Garage Door Open Notification: Executing step call service
2019-05-29 22:13:27 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=alexa_media, service_data=target=group.alexa, data=type=announce, message=The Garage Door Is Open>

Does this give you a clue?

I am not getting into it too. I kust do not have buttons in notification. Seems like I am missing something stupid. Here is my configuration.yaml:

ios:
  push:
    categories:
      - name: Alarm
        identifier: 'alarm'
        actions:
          - identifier: 'SOUND_ALARM'
            title: 'Sound Alarm'
            authenticationRequired: true
            destructive: true
          - identifier: 'SILENCE_ALARM'
            title: 'Silence Alarm'
            activationMode: 'background'
            authenticationRequired: true
            destructive: false
            behavior: 'textInput'
            textInputButtonTitle: 'Silencio!'
            textInputPlaceholder: 'Placeholder'

Scripts.yaml:

'1538231974813':
  alias: Alarm notify
  sequence:
      service: notify.mobile_app_iphone
      data:
        message: "Something happened at home!"
        data:
          push:
            category: "SOUND_ALARM" # Needs to match the top level identifier you used in the ios configuration
          action_data: # Anything passed in action_data will get echoed back to Home Assistant.
            entity_id: light.test
            my_custom_data: foo_bar

Yes, I just copied everything, but still can not find what is