sendBroadcastNotification with more than three values

Hi, I’m currently trying to switch my notifications from Telegram to OH notifications.

Example from the documentation

sendBroadcastNotification(message, icon, tag, title, referenceId, onClickAction, mediaAttachmentUrl, actionButton1, actionButton2, actionButton3)

This works for me

sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security")

But if I want to specify more then (message, icon, tag), such as title or mediaURL, it no longer works.

sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security", "Bewegungerkennung")
sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security", null, null, null, item:Camera_Hof_Last_snapshot)

Can someone please tell me what the correct syntax is and especially how to enter an item:Image correctly in mediaAttachmentUrl

Have you checked openHAB Cloud Connector - System Integrations | openHAB

Yes, that’s why I have the example above

Does that work for you?

sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security", "Bewegungerkennung")

I only get a basic message in the log that the rule cannot be executed.

If I only use the three values then it works.

sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security")

Which oh version? The new stuff is only in 4.3

the latest version 4.3.2 - Release Build

I think this is the reason why the notificationBuilder as created in openhab-js. For those using JS you’d use something like:

notificationBuilder("Bewegung erkannt im Hof").withIcon("camera")
                                              .withTag("Security")
                                              .withTitle("Bewegungerkennung")
                                              .withMediaAttachmentUrl("item:Camera_Hof_Last_snapshot")
                                              .send()

Note that the media attachment URL is a String, even if you use the reference to an image Item like it mentions in the docs.

That’s probably why the last example you show didn’t work. It should be

sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security", null, null, null, "item:Camera_Hof_Last_snapshot")

You might need to supply nulls for the action buttons too.

sendBroadcastNotification("Bewegung erkannt im Hof", "camera", "Security", "Bewegungerkennung", null, null, "item:Camera_Hof_Last_snapshot", null, null, null)

I don’t know if it supports skipping arguments that you don’t have a value for. The last DSL example on the cloud connector page implies this is the case.

Yes, they all have to be specified as a string and you really have to set everything else to null, if you specify more than message, icon and tag in the message.

sendBroadcastNotification("Bewegung erkannt im Hof!", "camera", "Security","Bewegungserkennung", "motion-id-hof", null, "item:Camera_Hof_Last_snapshot", null, null, null)
sendBroadcastNotification("Bewegung erkannt im Hof!", "camera", "Security","Bewegungserkennung", null, null, null, null, null, null)  

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.