Apple Watch Actionable Notifications Not Working

I’m using actionable notifications in an automation as a daily medicine reminder (borrowed heavily from a Blueprint shared here).

I’m presenting the actions of “Taken”, “Remind”, and “Skip”. This works perfectly fine if I choose one of the actions from my iPhone. However, when I choose on of the actions from my Apple Watch, HA never seems to get the response.

HA version 2021.6.4, Companion App version 2021.6, iOS 14.6, WatchOS 7.5.

Here is the relevant code from my automation:

action:
  - service: input_boolean.turn_on
    target:
      entity_id: !input input_boolean
      
  - alias: "Send Notification Until Taken or Skipped"
    repeat:
      while:
        - condition: state
          entity_id: !input input_boolean
          state: "on"
      
      sequence:
        - alias: "Log that we are sending initial med reminder"
          service: logbook.log
          data:
            name: !input notification_title
            message: !input logbook_message_remind
            entity_id: !input input_boolean
        
        - alias: "Send the mobile notification and ask for response"
          device_id: !input notify_device
          domain: mobile_app
          type: notify
          title: !input notification_title
          message: !input notification_message
          data:
            actions:
              - action: "TAKEN"
                title: !input notification_action_taken
              - action: "LATER"
                title: !input notification_action_later
              - action: "SKIP"
                title: !input notification_action_skip
        
        - alias: "Wait for a response"
          wait_for_trigger:
            - platform: event
              event_type: mobile_app_notification_action
              event_data:
                action: "TAKEN"
            - platform: event
              event_type: mobile_app_notification_action
              event_data:
                action: "LATER"
            - platform: event
              event_type: mobile_app_notification_action
              event_data:
                action: "SKIP"
          timeout:
            minutes: !input ask_later_wait_time
        
        - alias: "Perform the action"
          choose:
            - conditions: "{{ wait.trigger.event.data.action == 'TAKEN' }}"
              sequence:
                - service: input_boolean.turn_off
                  target:
                    entity_id: !input input_boolean
                - service: logbook.log
                  data:
                    name: !input notification_title
                    message: !input logbook_message_taken
                    entity_id: !input input_boolean
            - conditions: "{{ wait.trigger.event.data.action == 'LATER' }}"
              sequence:
                - service: logbook.log
                  data:
                    name: !input notification_title
                    message: !input logbook_message_later
                    entity_id: !input input_boolean
                - delay:
                    minutes: !input ask_later_wait_time
            - conditions: "{{ wait.trigger.event.data.action == 'SKIP' }}"
              sequence:
                - service: input_boolean.turn_off
                  target:
                    entity_id: !input input_boolean
                - service: logbook.log
                  data:
                    name: !input notification_title
                    message: !input logbook_message_skip
                    entity_id: !input input_boolean

The watch will try 2 mechanisms when trying to send the event for the actionable notification:

  1. Send to the phone, and ask it to fire the event. This happens if the Watch and phone are directly connected via e.g. Bluetooth or Wi-Fi at the time.
  2. Send to the event fire to the HA server directly. This is the fallback for the case where, for example, the Watch can’t talk to the phone, like when wireless.

I believe both of these should work, so the question is where it’s breaking down. Assuming the notification came in and you immediately acted upon it, I’m guessing it’s the first case; fortunately, we can look at the logs from the device at that time to see what happened there. (The Watch logs, too, but it’s a lot harder to get details out of it.) After tapping the action on the watch, go to App Configuration (within the HA app), then ‘Debugging’ and export the logs. This will give you a .zip file with the contents. Inside there, look the undated/most-recent .txt file. You can either take a gander and see if there’s anything relevant, but it logs a lot and that can be confusing; feel free to upload it to me and I’ll take a look then delete the log file.

Logs sent. I poked around but didn’t see anything that stood out to me. I tested the notification at 14:42.

Both the phone and watch are on wi-fi and since just about a foot away from each other, I also assume connected via BT.

Thanks for the help!

I see some earlier notifications in the log (through around 11:30 this morning, your time) that were using a lowercase ‘action’ – double checked, I don’t see this happening automatically anywhere, so that may have been an issue in config.


Here’s what I see in the logs:

11:48, phone-side TAKEN

This one woke the app.

2021-06-12 11:48:24.413 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, “event_data”: [“action”: “TAKEN”]], localMetadata: nil)

11:49, phone-side SKIP

2021-06-12 11:49:44.665 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, “event_data”: [“action”: “SKIP”]], localMetadata: nil)

11:51, phone-side LATER

2021-06-12 11:51:07.510 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, “event_data”: [“action”: “LATER”]], localMetadata: nil)

11:53, phone-side TAKEN

2021-06-12 11:53:19.231 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, “event_data”: [“action”: “TAKEN”]], localMetadata: nil)

12:00, watch-side TAKEN, LATER, SKIP, TAKEN

2021-06-12 12:00:07.982 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_data”: [“action”: “TAKEN”], “event_type”: “mobile_app_notification_action”], localMetadata: nil)
2021-06-12 12:00:08.041 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, >“event_data”: [“action”: “LATER”]], localMetadata: nil)
2021-06-12 12:00:08.041 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, “event_data”: [“action”: “SKIP”]], localMetadata: nil)
2021-06-12 12:00:08.041 [Info] [main] [WebhookManager.swift:212] sendEphemeral(request:) > sending: WebhookRequest(type: “fire_event”, data: [“event_type”: “mobile_app_notification_action”, “event_data”: [“action”: “TAKEN”]], localMetadata: nil)


Clearly something caused the Watch<->App communication to all get batched up when the app was woken up around 12:00, but I’m not sure what the cause of that is. The Watch decides to try to send to the phone if it believes it’s going to be able to communicate ASAP, so it’s possible it was guessing wrong there.

It might be worth doing something like (noting the time for each):

  1. Go to Developer Tools, events, and listen for mobile_app_notification_action
  2. Send yourself a notification
  3. Respond to the notification
  4. Perform the action
  5. Look for the event firing in Developer Tools

It’s possible a restart of both devices will make the ‘immediate’ messaging get back to normal as this behavior is definitely abnormal. It does appear the events are firing, just delayed, so it doesn’t seem like something is getting lost, at least.

Wow, thanks for looking at this. I will start by giving everything a reboot and then dig into the developer tools.

After reboots of both iOS devices, everything seems to be working 99% of the time. I had one action event that did not come through and it was batched up with the next action event. I haven’t been able to recreate it in about 20 more attempts. I’ll keep monitoring, but I think everything is good for now.

So I am having this same issue. I am sending the event and using “wait for trigger”. I can see the event arrive, but the “wait for trigger” doesnt seem to act when it gets the trigger

{{ wait.trigger.event.data.action == close_left }}

{
    "event_type": "mobile_app_notification_action",
    "data": {
        "action": "close_left"
    },
    "origin": "REMOTE",
    "time_fired": "2021-09-01T14:05:50.679982+00:00",
    "context": {
        "id": "c299beaa025a419ef9a0897926d711e4",
        "parent_id": null,
        "user_id": "15bfdc7e86e3405aabebdec1a54672cb"
    }
}