XMPP OH3 - new Syntax?


I am using the days off from work to set up the new Openhab 3. I did not migrate, but started from scratch.
I am slowly finding my way around in the new UI.
Important for me is to get notifications on my mobile, until now I used the xmpp-binding for that and I was very happy with it.
Trying to set up a new rule with ‘DSL Script or ECMA Script’ for the notification und copy / pasting it from my old OH2 files does not work for me.
Trying the Email-Notification as an alternative with copy/paste did neither, but I did find a new syntax for the ‚ECMA-Script‘ here in the community as follows below. This works for me for succesful email notifications.
actions.get(“mail”, “mail:smtp:yoursmtp”).sendMail(“Example@gmail.com”, “openHAB 3 Alert”, “Something changed!”);

I tried adapting it to use xmpp, but this did not work for me, e.g.

actions.get(“xmpp”, “xmppclient:xmppBridge:yourxmpp").sendXMPP(“jid@xmpp.server”, “openHAB 3 Alert”);

What am I doing wrong?

Thanks in advance for your help!


Hi @ecko,
while I’m not familiar with the ECMA-Scripts, I also had problems getting, getting the xmppclient's example rules to work with OH3 and found out, that the following works with OH3 to send a message from DSL Scripts:

val actions = getActions("xmppclient","xmppclient:xmppBridge:xmpp")
actions.publishXMPP("pavel@example.com","Warning! Leak detected!")

Basically you just need to change the first parameter of getActions() from “xmpp” to “xmppclient”.


Great, that‘s it.

Adapted to ECMA Code it would be like this:

actions.get("xmppclient", "xmppclient:xmppBridge:xmpp").publishXMPP("jid@yourserver.xy", "Openhab 3 Alert ");

That works for me, great. Now I can write my rules! Perfect!
Thanks a lot!