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:
broker.url=tcp://192.168.1.168:1883
broker.user=DVES_USER
broker.pwd=xxxxxxx
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: 192.168.1.168:s
I grepped it and found it in /var/lib/openhab2/config/org/eclipse/smarthome/mqttbroker.config
host="192.168.1.168"
port="1883.0"
service.pid="org.eclipse.smarthome.mqttbroker"
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,
Michael