[SOLVED] New MQTT binding 2.4

Thing mqtt:topic:miflora
1 Like

Sorry, that is what I meant, forgot to delete the ‘broker’ bit…

1 Like

Thanks for the reply’s
Will play around and read some more. If i need more help al post back of not i’l close the topic.

The “broker” witch is in the code is the name of my broker, so sould that not be in there ?

I do now receive a error aboute [%.1f °C] pasrt:

Configuration model 'miflora1.items' has errors, therefore ignoring it: [1,39]: no viable alternative at input '%'

this is the item, i removed the second item, will add it when i have it working.
Number temperature "Air Temperature" [%.1f °C] {channel="mqtt:topic:miflora:temperature"}

In the PUI i do see Generic MQTT Thing online:

Generic MQTT Thing ONLINE

Generic MQTT Thing


and the MQTT Broker online:


MQTT Broker




"Air Temperature[%.1f °C]"

special attention needs to be paid to copying paste

Thanks all for the help, its now working.
Info for others with this problem.

my .items

Number Temperature "Air Temperature[%.1f °C]" {channel="mqtt:topic:broker:miflora:temperature"}
    Number Humidity "Humidity[%d %%]" {channel="mqtt:topic:broker:miflora:humidity"}

my .sitemap

    sitemap temp label="temp"
            Frame label="temp" {

    Text item=Temperature
    Text item=Humidity


My .things

Bridge mqtt:broker:broker [ host="", secure=false, clientid="openhab", username="openhab2", password="Mypasswd" ]
      Thing topic miflora {
         Type number : temperature "Air Temperature"   [ stateTopic="sensor/temperature_celsius"]
         Type number : humidity "Humidity"  [stateTopic="sensor/humidity"]


I do not think so

What do you mean?

you have to change


I just tried that, but for some reason it keeps type the wrong ones.

That’s because you are not using the code fences

Thanks, i think i now have them all the correct way

Q1:When the new MQTT binding looses its connection, it there anything I can do to trigger a reconnect? e.g. a rule, some setting in the .things file.

Q2: Is there a way to not trigger any more mqtt messages out of a rule when the Broker is disconnected? e.g can I check the status of the “actions” variable before I do an

actions.publishMqtt(“topic”,“some message”).

mqtt:broker:solace [ host="m11.cloudmqtt.com", port=11403, username="username", clientID="someClient", qos=0, password="somePW" ]

val actions = getActions(“mqtt”,“mqtt:broker:solace”)
actions.publishMQTT(“moosecabin/homeautomation/persistence”,i.name + “,” + i.state)

2018-12-28 16:00:37.044 [INFO ] [ansport. **mqtt** .internal.ClientCallback] - MQTT connection to 'm11.cloud **mqtt** .com' was lost
org.eclipse.paho.client. **mqtt** v3.MqttException: Connection lost
at org.eclipse.paho.client. **mqtt** v3.internal.CommsReceiver.run(CommsReceiver.java:181) [213:org.eclipse.paho.client. **mqtt** v3:1.2.0]

at org.eclipse.paho.client. **mqtt** v3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92) ~[?:?]

at org.eclipse.paho.client. **mqtt** v3.internal.CommsReceiver.run(CommsReceiver.java:133) ~[?:?]

1.Solved using dimmer not using number (how use number?)

Troubles to create mqtt Things file. on way with paperUI its work.
wats is my trouble on Code?:

Its xiaomi smoke detector an cc2531 on zigbee2mqtt


Bridge mqtt:systemBroker:embedded-mqtt-broker
    // Rauchmelder 1
    Thing mqtt:topic:Rauchmelder_1 "Rauchmelder 1" @ "MQTT"  {
          Type contact : Rauchmelder1_Rauch "Rauchmelder1 Rauch" [ 
          Type dimmer : Rauchmelder1_battery "Rauchmelder1 battery" [ 

        // Rauchmelder 2
    Thing mqtt:topic:Rauchmelder_2 "Rauchmelder 2" @ "MQTT"  {
          Type contact : Rauchmelder2_Rauch "Rauchmelder2 Rauch" [ 
          Type dimmer : Rauchmelder2_battery "Rauchmelder2 battery" [ 

            // Rauchmelder 3
    Thing mqtt:topic:Rauchmelder_3 "Rauchmelder 3" @ "MQTT"  {
          Type contact : Rauchmelder3_Rauch "Rauchmelder3 Rauch" [ 
          Type dimmer : Rauchmelder3_battery "Rauchmelder3 Battery" [ 



Contact     RAUCHMELDER_1_RAUCH     "Rauchmelder Kinderzimmer Rauch"        {channel="mqtt:topic:Rauchmelder_3:Rauchmelder1_Rauch" }
Dimmer      RAUCHMELDER_1_Battery   "Rauchmelder Kinderzimmer Battery"      {channel="mqtt:topic:Rauchmelder_3:Rauchmelder1_battery" }

Contact     RAUCHMELDER_2_RAUCH     "Rauchmelder Schlafzimmer Rauch"        {channel="mqtt:topic:Rauchmelder_3:Rauchmelder2_Rauch" }
Dimmer      RAUCHMELDER_2_Battery   "Rauchmelder Schlafzimmer Battery"      {channel="mqtt:topic:Rauchmelder_3:Rauchmelder2_battery" }

Contact     RAUCHMELDER_3_RAUCH     "Rauchmelder Wohnen Rauch"              {channel="mqtt:topic:Rauchmelder_3:Rauchmelder3_Rauch" }
Dimmer      RAUCHMELDER_3_Battery   "Rauchmelder Wohnen Battery"            {channel="mqtt:topic:Rauchmelder_3:Rauchmelder3_battery" }


018-12-30 20:16:48.219 [ERROR] [ansport.mqtt.internal.ClientCallback] - MQTT message received. MqttMessageSubscriber#processMessage() implementation failure

java.lang.IllegalArgumentException: Value must be between 0 and 100

	at org.eclipse.smarthome.core.library.types.PercentType.validateValue(PercentType.java:58) ~[?:?]

	at org.eclipse.smarthome.core.library.types.PercentType.<init>(PercentType.java:53) ~[?:?]

	at org.eclipse.smarthome.core.library.types.DecimalType.as(DecimalType.java:160) ~[?:?]

	at org.eclipse.smarthome.core.internal.items.ItemStateConverterImpl.convertToAcceptedState(ItemStateConverterImpl.java:58) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.sendUpdate(ProfileCallbackImpl.java:135) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onStateUpdateFromHandler(SystemDefaultProfile.java:54) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$9(CommunicationManager.java:477) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.lambda$11(CommunicationManager.java:497) ~[?:?]

	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.handleCallFromHandler(CommunicationManager.java:493) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.CommunicationManager.stateUpdated(CommunicationManager.java:475) ~[?:?]

	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl$1.stateUpdated(ThingManagerImpl.java:167) ~[?:?]

	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:287) ~[?:?]

	at org.eclipse.smarthome.binding.mqtt.generic.internal.handler.AbstractMQTTThingHandler.updateChannelState(AbstractMQTTThingHandler.java:215) ~[?:?]

	at org.eclipse.smarthome.binding.mqtt.generic.internal.generic.ChannelState.processMessage(ChannelState.java:177) ~[?:?]

	at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.lambda$3(ClientCallback.java:90) ~[259:org.eclipse.smarthome.io.transport.mqtt:0.10.0.oh240]

	at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:?]

	at org.eclipse.smarthome.io.transport.mqtt.internal.ClientCallback.messageArrived(ClientCallback.java:90) [259:org.eclipse.smarthome.io.transport.mqtt:0.10.0.oh240]

	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:499) [256:org.eclipse.paho.client.mqttv3:1.2.0]

	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:402) [256:org.eclipse.paho.client.mqttv3:1.2.0]

	at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:206) [256:org.eclipse.paho.client.mqttv3:1.2.0]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

mqtt message


  1. ASK its a BUG?
    and wats a realy bug. If the thing file include the Bride Line
Bridge mqtt:systemBroker:embedded-mqtt-broker

its disconect the embedet Broker. Or if the line include a IP information, Broker.
its only function given a new Broker Name on every new save version.

I need a little on this one - it should be fairly simple, but I cannot figure out why it isn’t working.
The issue is I can’t see the temperature in my sitemap with the new MQTT 2.4 binding

This is my config :

Bridge mqtt:broker:mosquitto "local mosquitto" [ host="localhost",secure=false ]
		Type number : MQTT_BoilerRoom_1_1  "Flow"  [ stateTopic="/ESP_Easy_BoilerRoom/OneWireBus1_1/Temperature" ]


Number  Temp1  "Temperature"  {channel="mqtt:broker:mosquitto:MQTT_BoilerRoom_1_1"}


Text item=Temp1	label="Temp1 [%.2f °C]"

In the openhab.log (and paperUI) I can see that the broker is online, and in the events.log I see events regarding receiving temperatures. I guess this indicates that the binding is working as expected, and the issue is related to my item/sitemap config, but I cannot figure out what I’m missing ?

2019-01-01 21:07:10.250 [me.event.ThingUpdatedEvent] - Thing 'mqtt:broker:mosquitto' has been updated.
2019-01-01 21:07:10.329 [hingStatusInfoChangedEvent] - 'mqtt:broker:mosquitto' changed from OFFLINE to ONLINE
2019-01-01 21:07:10.330 [me.event.ThingUpdatedEvent] - Thing 'mqtt:broker:mosquitto' has been updated.

2019-01-01 21:28:07.413 [vent.ChannelTriggeredEvent] - mqtt:broker:mosquitto:MQTT_BoilerRoom_1_1 triggered 27.87

Any ideas ?


You did create a broker thing, after that you need to create a “Generic MQTT Thing”.


Bridge mqtt:broker:myBroker [ host="MyIP", secure=false, username="myUser", password="myPassword" ]
  Thing topic sonoff_1_Thing "Light_1" @ "Sonoff" {  
        Type switch : PowerSwitch  [ stateTopic="stat/sonoff_1/POWER" , commandTopic="cmnd/sonoff_1/POWER", on="ON", off="OFF" ]
        Type string : Version [stateTopic="stat/sonoff_1/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Version"]

and an item like:

Switch Stern_1 "Stern1" ["Lighting"] { channel="mqtt:topic:myBroker:sonoff_1_Thing:PowerSwitch" }


Hi Jürgen

It works :partying_face: :+1:
I really thought I had tried all combinations, but apparently there was one, I hadn’t tried

Thank you very much

Hi Jürgen

First of all thank you for your help, things are working now (thanks to you), but now I would really like to understand what I’m doing :thinking:

On this page https://www.openhab.org/blog/2018-12-16-mqtt-arrives-in-the-modern-openhab-2-x-architecture.html the thing-syntax is described with a colon (and a mqtt: in the beginning) Thing mqtt:topic:mything and you have spaces between Thing topic sonoff_1_Thing - do you know if both are valid, or is it just a typo on the blog-page?

Your example has Light_1" @ “Sonoff”, which the example on the doc page doesn’t have https://www.openhab.org/addons/bindings/mqtt.generic/ - what is the purpose of Light_1" @ “Sonoff” ?

And last but not not least… the channel part of the item is a “little” confusing - it looks like its a mix something from “bridge”:“thing”:“bridge”:“thing”:“channel” - i can’t find any documentation about channels in general. Do you know if its described somewhere, or can you explain it ?

I have tried to visualize it with this image


On the differences in syntax please see this thread.

The"Light_1" @ "Sonoff" part will label the thing as “Ligth_1” and put it under the Location “Sonoff” (visible on PaperUI Controls if at least one channel is linked to an item). Both are not required!

1 Like

Once again thank you - things are finally beginning to make sense.

Apparently I wasn’t the only one who was a little bit confused about the syntax :thinking: And this was exactly was I was looking for https://www.openhab.org/docs/configuration/things.html

1 Like