Things files with MQTT 2.4

Are the broker and things ONLINE? I didn’t spot a reason why not, besides the missing username and password for the broker, but you could have setup yours like that.

The channel definition of your items do miss the "HeatpumpMqttBroker " between topic and the thing-name.

The broker is configured with no security and I’m able to post to it from another client. The post generates the error message so something it taking place :slightly_smiling_face:

The Thing syntax is where I’m getting confused. Some documentation says I should use mqtt:topic:broker:thing but that doesn’t work when enclosed inside a Bridge definition.

That syntax does work if the things (broker and thing) are defined via PaperUI, when defining them via file ( as you did) you need to specify the broker. You can verify that on your PaperUI, it will show the actually needed syntax of your channel in both cases!

Opus – my home has 6 heat pumps so I thought a file approach will be more efficient - especially as I go through multiple iteration in the development phase. (I also plan on creating a binding for the Mistu heat pump later on).

I would love to use the single PaperUI defined broker, but haven’t been able to get the syntax right. So I defined a Bridge and here we are.

Would love to know how to ‘use the paperUI to show you the right syntax’?
I can define a Generic MQTT thing link it to the broker, then what?

If you have defined a broker and a device-thing via file, they will show up on PaperUI. Hopefully online!
When looking into the device-thing you will see the channels created and underneath each channel the needed syntax for it.

I did a bit more digging and it seems that the system creates a second MQTT client (Bridge?) at restart and the two clients are conflicting?

What is the syntax to define an existing bridge for a Things file? I saw
Thing mqtt:topic:myTopic (mqtt:broker:theBroker) {….} somewhere in the documentation but VSCode does not seem to like it.

Again I am asking for how to define a Thing in a separate Thing file using an existing broker.

The following is a small snippet from my demo setup, showing how you can split the broker definition from the generic thing:

first, the bridge.things file:

Bridge mqtt:broker:hotti "MQTT Broker: Hottis Mosquitto"

next, the clock.things file

Thing mqtt:topic:hotti:hotticlock_one  "MQTT Thing: HottiClock One"
     (mqtt:broker:hotti) @ "Living Room"
        Type string : raw "Raw"
                stateTopic = "fablab02/CLOCK",
                commandTopic = "fablab02/CLOCK"

and lastly my items file:

String HottiClock_One_RAW "Hotticlock One RAW Data [%s]"
(gMQTT, gHottiClock)
    channel = "mqtt:topic:hotti:hotticlock_one:raw"

Hope this helps a little bit.


hakan - it helps a lot. I was getting a parsing error (EOF) when I used this syntax:

Thing mqtt:topic:living_heatpump (mqtt:broker:HeatpumpMqttBroker) “Living Heatpump” @ “living” {…}

Your works and the file now parses correctly. However, the original error message persists. I will remove my own broker definition and try to use one defined in the paperUI to see what happens.

Seems to work with defining the Broker in the paperUI and then ‘coding’ it in the files using hakan’s syntax.

I understand that a single MQTT client exists for server/port combo, but I made sure the only client was the one I defined in the bridge and that triggered the error.

Is this an issue that should be reported?

  1. Do you have mqtt1 installed as well?
  2. Did you configure a broker via a mqtt.cfg file for mqtt2?

In both cases an unwanted broker connection could exist.

That looks serious. Are you publishing binary data via mqtt? I’m not sure if the embedded broker can handle that.

And you are running on windows. I haven’t really tested the embedded broker on windows. Might as well be a cause.

Fresh install on windows. Did nothing with MQTT v1.x
Mqtt.cfg empty.

No binary data. Simple JSON ({roomTemperature:64,compressor:ON,mode:‘HEAT’})

The same problem existed on an RPi instance, but I can’t be 100% sure since I was trying many things at the same time.

You are using a thing syntax that I haven’t come around. What is the meaning of “( mqtt:broker:hotti)”? The bridge that this thing is connected to?
Where can I find that syntax documentated?

Are you using MQTTLens? (Because of this bug report:

No MQTTLens I used mosquito_sub

Because the embedded broker works for me on Linux and for another developer on MacOS, it seems to be that Windows is the culprit here. A quick workaround is to use an external broker like Mosquitto.

1 Like

As I said earlier, tried and failed on RPi. But will try Mosquito to see if I get different results.

Are you aware that you answered a post from 8 month ago?
Posting an example which is using the embedded broker and stating that you can’t get it to work with the embedded broker sounds weird.

how can i put more than one “thing” in my mqtt.thing file, without breaking something ?
i have a working setup with 1 thing and 2 channels , but as soon as i put another thing in it, the whole stuff breaks.

Which version are you on?
It sounds as if you are on 2.4, for this one that is a known bug, you have the restart the mqtt bundle or switch to a milestone version . Or change the setup from .things file to PaperUI.

i am on 2.4 correct.
its good if this is a known bug.
i will create a .thing file for each mqtt-device as long as it takes to fix.