[SOLVED] Embedded MQTT broker works, but binding fails with strange non-integer port parameter (1883.0)

OK, I’ve managed to set up the embedded MQTT broker. And it works fine. I have a Sonoff S20 power outlet connected to it and I can observe and switch on/off the power with a simple MQTT app on my iPhone.

After having installed the embedded broker addon, I see it in the service configuration. Additionally, I see an entry named “MQTT system broker connection” there. When I click on manage, an empty screen with a “+” appears, when I click on the “+” a popup with a title but no further properties appears, which I can save. It then confirms that the configuration is saved. I expected something like this, as it should “know” without further information how to connect to the embedded server.

Then I have set up an item (SonoffS20.items):

Switch Sonoff_Socket "Sonoff Steckdose" { mqtt=">[broker:cmnd/sonoff/POWER:command:*:default], <[broker:stat/sonoff/POWER:state:default]" }

And I have added that item to my sitemap. When I switch on/off the item with the paper ui, I see changes in the event.log accordingly, but no reaction on behalf of mqtt.

So I manually added the “MQTT binding” (binding-mqtt - 2.4.0).

And I’ve added a mqtt.cfg to the services directory:


This is the part I cannot understand fully. What exactly am I supposed to configure in case of an embedded broker? The messages I get in the openhab.log are funny (this is where the questionable 1883.0 appears).

2018-12-29 12:00:18.638 [WARN ] [me.config.core.internal.ConfigMapper] - Could not set field value for field 'port': For input string: "1883.0"
java.lang.NumberFormatException: For input string: "1883.0"

Subsequently, it fails with:

2018-12-29 12:00:18.648 [WARN ] [.MqttBrokerConnectionServiceInstance] - Ignore existing broker connection configuration for:

I grepped it and found it in /var/lib/openhab2/config/org/eclipse/smarthome/mqttbroker.config


Again, a bit strange (look at the trailing :s).

Where does this come from? It does not help to edit that file and get rid of the “.0” decimal places by manually editing that file.

I couldn’t get this running and I tried to read and understand various other posts, but with respect to the new embedded broker some things seem to behave a bit different!?

Does somebody have an insight into what is going wrong or what relevant documentation I might have missed?

BTW: I am running openHab 2.4.0 on raspberry 3 (upgraded from the previous version recently, caches cleared multiple times, rebooted multiple times, …).

Kind regards,

You are using the MQTTv2 binding
So no need for the mqtt.cfg file

You need to create a broker thing
And MQTT generic things for your sonoffs





Thank you for the fast answer.

Adding the thing file worked immediately. The second link you provided was new for me, but I had read and tried to understand the first link about the new embedded broker before. I must have misunderstood something there.

I remember reading there:

A new Broker Connection appears in your Inbox. Just add it, no further configuration necessary.

But that never worked for me. I assumed that the “thing” would be an automatism and the items might suffice. But obviously, I was wrong.

Now after having set up the things file it works like a charm. I’ll buy more of these.

Best regards,

Please tick the solution, thanks

I ticked it as solved.

Unfortunately after changing only the topic name (replacing “sonoff” by “sonoff-86DF27” to prepared for more deviced), it stopped to work and I get strange NullPointerExceptions.

I’ve added the details to another thread with the NPE in the topic.

Have to find out how to link to that post in this reply…


OK, it took me some time to get it working again and resolve the mess.
What I did:

  • Uninstall MQTT Binding
  • Uninstall MQTT Embedded Broker
  • stop Openhab
  • remove cache etc.
  • start Openhab
  • Install and configure embedded Broker
  • Install MQTT Binding
  • Deploy Bridge thing, generic mqtt thing and items in three different files

What was new (as compared to previous attempts): I uninstalled services and bindings before cleaning cache.

Hope it stays alive, thank you for your support and attention,

1 Like

OMG, I looked for Embedded MQTT Broker through all bindings in openHAB 2.4. People, where did you find it? Can you tell me how to install it? Thanks in advance!

It’s not a binding it’s a service

Yes, I found it. Thanks a lot. It was in Misc not in Bindings.