Hide obsolete notification via rule

With sendBroadcastNotification, I can send a notification to my mobile.
Is it somehow possible, to remove such a message again?

The task I would like to solve: When the garage door is still open late at night, I want to be reminded on the mobile to close it. Now after I (or anyone else) closed the door, the message is not relevant anymore, and should disappear automatically on all devices.

According to the docs, there exist some Hide Notification Actions, but I couldn’t get my head around the explanation, and also did not find any sample code.

This is what I tried for testing, but hideBroadcastNotificationByTag is not a valid command.

rule "NotificationTest"
when 
  Item testMessageItem received command
then
    if (receivedCommand == "ON")
    {
      sendBroadcastNotification("TestMessage", "garage", "garage_tag")
    }
    else 
    {
      hideBroadcastNotificationByTag("garage_tag");
    }
end
1 Like

There is some documentation here.

Checking the documentation once again, I realized, this feature was just introduced with OH 4.2, while I was still at OH 4.1.3 :man_facepalming:
After upgrading to OH 4.2, the above code now works as expected :slight_smile:

Thanks.

I using OH 4.3.2 and the notifications cannot be hidden again.
I have tried it with an action in the rule but also with inline script (DSL).

configuration: {}
triggers: []
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      tag: Klingel
    type: notification.HideBroadcastNotificationByTag
  - inputs: {}
    id: "2"
    configuration:
      referenceId: id-doorbell
    type: notification.HideBroadcastNotificationByReferenceId

@hofingerandi
How did you get it to work?

For me it is working, but I’m still at 4.2.2.

Upgraded to 4.3.3 - still working (with the script from the first post)