Dismiss mobile notification with specific tag with appdaemon?

I have an automation that triggers a notification on my android phone. This notification has a specific tag an looks like this:

    - service: notify.mobile_app_op7t
      data:
        message: 'Was möchstest du tun?'
        title: 'Schlafmodus eingeschaltet'
        data:
          tag: "push_sz_sleepmode"
          actions:
            - action: 'SZ_GOODNIGHT'
              title: 'Alles aus'
            - action: 'SZ_CAST'
              title: 'CAST'
            - action: 'SZ_BLUETOOTH'
              title: 'Bluetooth'

How can I dismiss this notification with appdaemon? I don’t know how to specify the tag in the appdaemon call. I have tried this but it does not work:

self.call_service("notify/mobile_app_op7t", message="clear_notification", tag="push_sz_sleepmode")

Can anybody help me out?

You need to put the tag inside a data block, same as in the original service call that generated the automation, something like this:

self.call_service(
    "notify/mobile_app_op7t", 
    message="clear_notification",
    data={"tag":"push_sz_sleepmode"}
)
1 Like

Thank you!