New XMPP (Jabber) Binding

Hello!

I developed a new version of XMPP (Jabber) binding (it`s my primary messenger), which is based on the newest version of the Smack Library. Binding allows you to send and receive messages via xmpp using new Actions interface.

For example:

rule "Leak detected"
when
    Item Xi_Leak changed
then
    if(Xi_Leak.state == ON) {
        val actions = getActions("xmpp","xmppclient:xmppBridge:xmpp")
        actions.publishXMPP("pavel@example.com","Warning! Leak detected!")
    }
end

And process received messages like this:

rule "Turn off all lights with separator and reply"
when
    Channel "xmppclient:xmppBridge:xmpp:xmpp_command" triggered
then
    var actionName = receivedEvent.getEvent().split("#")
    if(actionName.get(1).toLowerCase() == "turn off lights") {
        Group_Light_Home_All.sendCommand(OFF)

        val actions = getActions("xmpp","xmppclient:xmppBridge:xmpp")
        actions.publishXMPP(actionName.get(0),"All lights was turned off")
    }
end

Source code: https://github.com/pavel-gololobov/openhab2-addons/tree/xmpp_binding/addons/binding/org.openhab.binding.xmppclient

Building:

mvn clean install

Binding has been working with me for several weeks steadily, so I can recommend it for production use.

If someone helps me, I can try to make pull request to the main repository of openhab. Any comments and suggestions are welcome!

5 Likes

Thanks for your work.
I suggest you create a .jar and a docs page please to explain settings so anyone can test it.
Then check out Contribution | openHAB and simply create the PR (openhab2-addons should be the right repo).
Please be aware though that maintainers are currently very busy with ESH reintegration so it might take some weeks to get answered, meanwhile you can still optimize it based on feedback from here.

If you go to the original addons2 repository page on github, there should be a yellow pull request note. If you click that github will create a PR for you.

You can then continue to push commits to your own repository and they are reflected in the created PR.
You will probably have to fix a few findings of the reviewers.

Cheers, David

Could you perhaps move your binding to the new “bnd” build system before creating the pull request? Details on how to do this can be found at:

https://github.com/openhab/openhab2-addons/issues/5005

A requirement for accepting a new extension is indeed the new build system usage.

I’m just not sure if it makes sense to migrate if still changes are to expected. Because we have no working guide for eclipse IDE development with the new build system.

Thank you for answers.

I did not see information about the transition to a new build system, I used the current documentation for the developer.

I think, it makes sense to wait for a new release with tested and ready-to-use development tools and documentation. While it is possible to use XMPP binding from my fork.

If someone needs it, I can put the .jar file for easy installation into the system.

Please create the PR anyway. We need to know which OH1 bindings can be ignore in a release, and your binding is deprecating an old one, isn’t it?

Without knowing that a developer will spend time on making the old binding fit for a release -> wasted time basically.

We do not except people to develop with the new buildsystem right now.

I tried to use old OH1 XMPP binding first, but it didn’t work for me. And yes, my version is deprecating an old binding, except for support of sending attachments. I can add this feature later if interesting for anyone.

Ok, I will try to make pull request. Thank you.

1 Like

Done. PR: https://github.com/openhab/openhab2-addons/pull/5253

3 Likes

Hi Pavel,

I want to use your XMPPClient in my OH2.4 installation.
But from the openhabian installation for my Raspberry Pi your binding is not included.
How can I install it?

Best,

Marcel.

I realize this is a bit stale, but I will leave this anyway in case anyone else is searching around.

I do not think xmppclient (this binding) is available in 2.4, only 2.5 and later. It is now the default XMPP binding. I am still on 2.4 because reasons. So I have to use the old XMPP Action (action-xmpp) which can only send but not receive.

You can see this if you go to https://www.openhab.org/addons/bindings/xmppclient/ and click on the drop-down for Version at the upper right. Only version 2.5 shows any information, 2.4 and earlier just give a 404.

There is not much information out there about this, so I thought I would contribute my $0.02.

Soon I will upgrade, because it will be nice to be able to send XMPP messages to openHAB in addition to other control options.

Jabber xmpp action/binding and OMEMO encoding possibel?

I use the XMPP action binding on OH2, but with the old binding from OH1 (snapshot 1.14). All works as expected and descripted in the doc: https://www.openhab.org/addons/actions/xmpp/

I ask mself, if it is possible to use the encoding OMEMO in addition. I cannot find any documention about this for this “old” binding, or the new version https://www.openhab.org/addons/bindings/xmppclient/

Is there a chance to get the encoding working?

It would depend if whatever underlying library openHAB is using for XMPP supports it or not. I would venture a guess probably not, but I did exactly zero research to come up with that answer. :slight_smile:

OMEMO I think is somewhat over-recommended anyway. If your server is using TLS, then there is already some level of encryption. But the way some of these apps (Conversations on Android being one I generally recommend but comes to mind in this context) make it sound is that if you are not using OMEMO then your traffic is totally unencrypted which is simply not true.

The other thing I realized is that you only really need to consider OMEMO when you don’t know or necessarily trust the server. When I first started using XMPP I went through someone else’s server and I was really keen to use OMEMO and so I did. Eventually I set up my own server (Prosody is great and not that hard actually) and I don’t worry about OMEMO any more now.

Just some food for thought.

1 Like

Sorry to dig up an old thread, but would anyone know if this would be migrated to OH3 ? I’m missing using Google Hangouts for my house alerts.

While I can’t comment on the binding, I believe Google have removed all xmpp compatibility from Hangouts.

Yea, looks like you’re right :frowning: Going to see if I can find something that would work on the command line so I can integrate that way.

Thanks