Notification/Actionable Notification default action

Hi All

I have an actionalble notification to my iOS devices and is working absolutley fine

The notification ask’s a question, it pops up on my iPhone and I press and hold to get two options ‘Yes’ or ‘No’

If i click ‘Yes’ or ‘No’ the action fires off the automation behind it and does what they are supposed to do no problem so my Notification and actions are working fine

My problem is that if I just click the notification banner and not hold to get the ‘yes’ or ‘no’ it seems to default to ‘Yes’, opens the HA app and fires off the ‘Yes’ automation which is not what I want it to do

The question is, how do I set the default action for an actionable notification to be ‘no’ when just the notification banner is pushed and it launches the HA app

I can past the notification setup and automations if needed

I don’t know whethter this can be configured or not. Maybe just changing the order of the actions will help, so that the first button is ‘mo’ and the second button is ‘yes’.

Thanks

I have tried that but does not seem to work, that was my logic also :slight_smile:

Can you please point me to the place where it talks about the default action selected for an actionable notification with multiple options? I couldn’t find anything in the docs…

Can you share your config? Use the ```yaml syntax to format it.

Also:

I’m well aware of the docs but there’s no explanation for the behaviour that OP describes or at least I couldn’t find it.

I would have assumed that no action would be fired if no button has been pressed, but according to OP it fires the “yes” button automation.

Hi All

Here is the iOS push setup:

push:
  categories:
    - name: Do you want a bath tonight
      identifier: 'doyouwantabath'
      actions:
        - identifier: 'NOIDONOTWANTABATH'
          title: 'No'
          activationMode: 'background'
          authenticationRequired: true
          destructive: false
          behavior: 'default'
        - identifier: 'YESIDOWANTABATH'
          title: 'Yes'
          activationMode: 'background'
          authenticationRequired: true
          destructive: false
          behavior: 'default'

The three automations I have are as follows:

First, This one fires off the notification @ 10am asking “Do you want a bath tonight?” - I get this and displays “Do you want a bath tonight?” as a banner on IOS

- id: '1587474512128'
  alias: Bath Tonight - iOS Notification
  description: ''
  trigger:
  - at: '10:00:00'
    platform: time
  condition: []
  action:
  - data:
      data:
        push:
          badge: 0
          category: doyouwantabath
      message: Do you want a bath tonight?
    service: notify.all

If as per the IOS push I press and hold the banner I get a ‘Yes’ or “No” options

If ‘Yes’ is pressed, it fires the automation below and puts the Waterheater into a “Manaul” mode

- id: '1587473272743'
  alias: Bath Tonight - Yes
  description: ''
  trigger:
  - event_data:
      actionname: YESIDOWANTABATH
    event_type: ios.notification_action_fired
    platform: event
  condition:
  - after: '10:00:00'
    before: '12:00:00'
    condition: time
  action:
  - data:
      message: Yay! Someone stinks and is having a bath
    service: notify.all
  - data:
      option: Scheduled
    entity_id: input_select.waterheater_status
    service: input_select.select_option
  - device_id: b44fd6df9b8f4af789d4e592e5ef146b
    domain: switch
    entity_id: switch.waterheaterbottom
    type: turn_on
  - delay: 02:00:00
  - device_id: cb152ce39838407f878245ffe87049f3
    domain: switch
    entity_id: switch.waterheatertop
    type: turn_on
  - delay: 02:00:00
  - device_id: b44fd6df9b8f4af789d4e592e5ef146b
    domain: switch
    entity_id: switch.waterheaterbottom
    type: turn_off
  - device_id: cb152ce39838407f878245ffe87049f3
    domain: switch
    entity_id: switch.waterheatertop
    type: turn_off
  - data:
      option: Standby
    entity_id: input_select.waterheater_status
    service: input_select.select_option

If ‘No’ pressed it fires the automation below and put the water heater into “Idle” temp mode (Another automation)

- id: '1587475086548'
  alias: Bath Tonight - No
  description: ''
  trigger:
  - event_data:
      actionName: NOIDONOTWANTABATH
    event_type: ios.notification_action_fired
    platform: event
  condition: []
  action:
  - device_id: b44fd6df9b8f4af789d4e592e5ef146b
    domain: switch
    entity_id: switch.waterheaterbottom
    type: turn_off
  - device_id: cb152ce39838407f878245ffe87049f3
    domain: switch
    entity_id: switch.waterheatertop
    type: turn_off

So, At this point everything works 100%

Now, the issue comes in when somone does not press and hold the notification to open it and get the ‘Yes’ or ‘No’ buttons but just rather “Tap” on the notification

It just opens the app and fires the ‘Yes’ and starts to heat the water

I cannot figure out why it would be doing this. As suggested I have tried putting no first and yes second but still the same

Hope it makes sense. I have tested many times and get the same reseult

I have reset my app a, cache and deleted/reimported the rule

I have an actionable notification that tracks the intersections into my neighborhood. I then have zones between those and the house.
When NodeRed traps that I came from Away, to the Intersection and the transitional zones before the house. An Actionable notification says “looks like you’re coming home, wanna open the garage and asks which stall”
This works pretty good, the actions work.
If I single tap the notification the app launches and doesn’t trip anything off for me.
Just affirmed it.
Also have a notification if the doors are open, it sends a notice and I can close either door (I did this just to simplify notifications/automations). I force triggered in Nodered just now and single tap just causes app launch no automatons fire.
But my automatons are all in nodered.

Your push config seems ok to me and similar to mine. I haven’t done automation in HA since moving to NR a long time ago but I would think your issue must arise from there?

I have just tested again and still if I just tap the notification, the app launches and fires off the “Yes” automation

Can anyone post there code/automations showing the notifictaion, the multiple responses and the automations?

I did mention this, but I’m not sure whther you tried this:

data:
  url: /

If this is in an automation, this is a second data.

FYI : I had similar issue,

Trying to change behavior of clicking on banner of notification for camera feed, instead of swiping down and clicking the actionable button.

Default click action can be customized if it is a URL or lovelace card.
the info is here. Introduction | Home Assistant Companion Docs
actionable notifications is here Actionable Notifications | Home Assistant Companion Docs

my ANDROID config is this now

action:
  - service: image_processing.scan
    data: {}
    target:
      entity_id: image_processing.deepstack_face_blueiris_doorbell
  - service: notify.mobile_app_note_10
    data:
      message: A person has been detected at the Front Door.
      data:
        # iOS URL
        url: /lovelace/doorbell-cam
        # Android URL
        clickAction: /lovelace/doorbell-cam
        image: /media/local/snapshots/deepstack_face_blueiris_doorbell_latest.jpg
        entity_id: camera.doorbell
        actions:
          - action: URI
            title: Open Camera
            uri: /lovelace/doorbell-cam

the default action is the # commented lines, ABOVE/BEFORE/OUTSIDE of actions section

3 Likes

Is it possible to do anything else than open a dashboard in HA or a webpage?

I would like a click on the message itself to extend it to show the other actions.
Now I got to long hold on the message to show this.