Automation using clickAction as a trigger

Hello everyone,

I get a notification when someone rings the doorbell:

service: notify.notify
data:
  title: Alguém tocou à campainha!
  data:
    timeout: 180
    priority: high
    ttl: 0
    clickAction: /lovelace/campainha
    tag: campainha
    image: >-
      https://example.ddns.com/local/doorpi/doorbell-image.jpg?{{now().second}}
  message: ''

And I want to create an automation to clear the notification on all devices when some of the users click on the notification (using clickAction). What is the trigger for automation? Or can I have a clickAction with two actions (one for opening the application and one for a boolean variable)?

Thank you everyone!
Best regards
Gonçalo Almeida

clickAction only controls what view or app is opened when its selected, there is no specific event sent back to HA. You can try to see if the notification clear event gets fired but that will be your easiest indication to clear the notification.

You can also try to see if the notification shows up in the active notification count and then clear based on it not being present.

1 Like

With “mobile_app_notification_cleared” only works if notification is cleared if I open it don’t clean it on all devices…

alias: Clean Doorbell Notification
description: ''
trigger:
  - platform: event
    event_type: mobile_app_notification_cleared
    event_data:
      tag: campainha
condition: []
action:
  - service: notify.notify
    data:
      data:
        tag: campainha
      message: clear_notification
mode: single

1 Like

Can you help me with active notification count?
Or can I have a clickAction with two actions (one for opening the application and one for a boolean variable)?

Best regards