MQTT manual config, confusion and issues

It’s recommended to use PaperUI to create the Thing and place items in files. From PaperUI things copy the item description and place in item file. I’m hard headed and use files for all so here is my example.

Item file:

Switch LivingRoom_Light "Living Room Light" <light>  ["Lighting"] { channel="mqtt:topic:pibroker:sonoff11:power" }
Number LivingRoom_Light_Temp "Temperature [%.1f °F]"      <temp>             { channel="mqtt:topic:pibroker:sonoff11:temperature" }
Number LivingRoom_Light_Humidity    "Humidity [%.1f %%]"    <humidity>       { channel="mqtt:topic:pibroker:sonoff11:humidity" }

Things file:

Bridge mqtt:broker:pibroker "pibroker" [ host="", port=1883, secure=false, username="xxxxxx", password="xxxxxx" ]
    // Sonoffs
    Thing topic sonoff11 "Living Room Light" @ "Living Room" {
        Type switch : power       "Power"         [ stateTopic="stat/sonoff11/POWER", commandTopic="cmnd/sonoff11/POWER" ]
        Type number : temperature "Temperature"   [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Temperature" ]
        Type number : humidity    "Humidity"      [ stateTopic="tele/sonoff11/SENSOR", transformationPattern="JSONPATH:$.SI7021.Humidity" ]

Hi and thank you very much for your assistance!

However, after modifying my things-file to match yours, my MQTT-server is no longer showing up in paperUI>configuration>things…

I removed my earlier things-files, replaced with a single one.
so no more minMQTT-bridge.things or minMQTT-blackbox.things…

Any clues or ideas?


Bridge mqtt:broker:minMQTT "MQTT Broker: minMQTT Mosquitto" [ host="", port=1883, secure="AUTO", username="redacted", password="redacted" ]
    Thing topic blackbox_metrics "BlackBox Metrics" @ "TV-möbeln"
        Type String : uptime "uptime" [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/system/uptime"]
        Type String : currentUser "currentUser" [ stateTopic= "iotlink/workgroups/blackbox/windows-monitor/stats/system/current-user" ]

What does openhab.log have to say about loading your new things file?
What does openhab.log have to say about connecting to your broker?

What mqtt broker are you using and the logs as rossko57 mentioned.

Im using Mosquitto and its verified as working, i can publish info from my pc and read it on my android phone.

The logfile says:
2020-01-10 17:53:16.786 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘minMQTT.things’ has errors, therefore ignoring it: [5,14]: mismatched input ‘String’ expecting RULE_ID
[6,14]: mismatched input ‘String’ expecting RULE_ID

and a whole lot of:

2020-01-10 20:44:25.582 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to ‘’. Next attempt in 60000ms
2020-01-10 20:44:25.589 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to ‘’ with clientid 7fd5025e-898c-4ebd-87f6-b632cc7d2a65

my current .things file:

Bridge mqtt:broker:minMQTT "MQTT Broker: minMQTT Mosquitto" [ host="", port=1883, secure="AUTO", username="redacted", password="redacted" ]
    Thing topic blackbox_metrics "BlackBox Metrics" @ "TV-möbeln"
        Type String : uptime "uptime" [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/system/uptime"]
        Type String : currentUser "currentUser" [ stateTopic= "iotlink/workgroups/blackbox/windows-monitor/stats/system/current-user" ]

Seems important. Are you going to fix it?
If you look at other peoples examples of Thing topic ... there are curly braces involved for the Channels: section.
An example -


i did add those curly brackets i was missing, but i also noticed that the “string” data-type is lowercase in things.

So i changed those too and now its actually “working”, i had to manually link my mqtt-thing to items from the paperUI things page, but the control-page in paperui is showing my PC metrics.

But i think i need to fix the issue with the linkage, how do i link the .items and .things?

Every time i change the things-file, my linked items gets removed from my thing, forcing me to manually link them again in the PaperUI…

edit: i solved the linkage!

String BlackBox_uptime "BlackBox Uptime [%s]" { Channel="mqtt:broker:minMQTT:blackbox_metrics:BlackBox_uptime" }


Bridge mqtt:broker:minMQTT "MQTT Broker: minMQTT Mosquitto" [ host="", port=1883, secure="AUTO", username="redacted", password="redacted" ]
    Thing topic blackbox_metrics "BlackBox Metrics" @ "TV-möbeln" {
        Type string : BlackBox_uptime "uptime" [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/system/uptime"]
        Type string : BlackBox_currentUser "current User" [ stateTopic= "iotlink/workgroups/blackbox/windows-monitor/stats/system/current-user" ]
        Type string : BlackBox_cpu_used "CPU usage" [ stateTopic= "iotlink/workgroups/blackbox/windows-monitor/stats/cpu/usage" ]

edit2: its NOT solved, linkage still gets deleted when .things-file gets updated…

But earlier you showed us your Items with channels defined in Items files.
You cannot use both methods to link,
If an Item is defined in an xxx.items file, there must also link using {channel= } format.
If you created your Item in PaperUI, there you make the link.
Mixing will not work.

thanks for the input rossko57, im sincerely grateful for all the help im getting!

However, ive been at this for days now and im simply not understanding the finer details here…
But i do belive i AM using the channel= format, but im probably linking to the wrong item…


 String BlackBox_uptime "BlackBox Uptime [%s]" { Channel="mqtt:broker:minMQTT:blackbox_metrics:BlackBoxUptime" }
String BlackBox_currentUser "BlackBox Current User" { Channel="mqtt:broker:minMQTT:blackbox_metrics:BlackBoxCurrentUser" }
String BlackBox_cpu_used "BlackBox CPU Usage" { Channel="mqtt:broker:minMQTT:blackbox_metrics:BlackBoxCPUused" }
String BlackBox_idle_time "BlackBox Idle Time" { Channel="mqtt:broker:minMQTT:blackbox_metrics:BlackBoxIdleTime" }

Look in your PaperUI and determine if that is really the channel uid (“name”).
With many changes in both configuration systems you might well have ended up with duplicate broker Things, etc.
If you think you are now close to the right setup, stop openHAB and restart it, to get rid of old rubbish,
What do the logs say about the linking?

1 Like

Heh… My channel name was actually mqtt:topic:minMQTT:blackbox_metrics:BlackBoxUptime

I changed the config file and rebooted the pi server but its hard to know if it did anything…
I didnt have any duplicates in paperUI, but i do have 2 mqtt-things, one broker (the server) and one generic thing (the pc metrics)

Yes, having defined a Broker Thing and a Topic Thing, you might expect to see two Things in PaperUI. So far, so good.

So, does it work?

well, its not quite working properly yet…
My previously added items are now all showing up in the paperUI>control page, even showing correct data! :smiley:

I tried to add more metrics details (harddrive info) in the config files, but it doesnt show up on the paper ui.
The paperUI>configuration>things>blackbox metrics lists all the new channels but none of the new .things entries have any links.

The paperUI>configuration>items lists all the new channel items aswell (the thing link targets), so appearantly i am still not linking thing>item properly in the config files…


Bridge mqtt:broker:minMQTT "MQTT Broker: minMQTT Mosquitto" [ host="", port=1883, secure="AUTO", username="redacted", password="redacted" ]
    Thing topic blackbox_metrics "BlackBox Metrics" @ "TV-möbeln" {
        Type string : BlackBoxUptime "uptime" 		 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/system/uptime"]
        Type string : BlackBoxCurrentUser "current User" [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/system/current-user" ]
        Type string : BlackBoxCPUused "CPU usage"  	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/cpu/usage" ]
        Type string : BlackBoxIdleTime "idle time" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/system/idle-time" ]
        Type string : BlackBoxDisk1Name  "disk1Name" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/c/volume-label" ]
	Type string : BlackBoxDisk1Free  "disk1Free" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/c/available-free-space" ]
        Type string : BlackBoxDisk2Name  "disk2Name" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/d/volume-label" ]
	Type string : BlackBoxDisk2Free  "disk2Free" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/d/available-free-space" ]
        Type string : BlackBoxDisk3Name  "disk3Name" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/e/volume-label" ]
	Type string : BlackBoxDisk3Free  "disk3Free" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/e/available-free-space" ]
        Type string : BlackBoxDisk4Name  "disk4Name" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/m/volume-label" ]
	Type string : BlackBoxDisk4Free  "disk4Free" 	 [ stateTopic= "iotlink/workgroup/blackbox/windows-monitor/stats/hard-drive/m/available-free-space" ]


String BlackBox_uptime "BlackBox Uptime [%s]" 		{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxUptime" }
String BlackBox_currentUser "BlackBox Current User" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxCurrentUser" }
String BlackBox_cpu_used "BlackBox CPU Usage"  		{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxCPUused" }
String BlackBox_idle_time "BlackBox Idle Time" 		{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxIdleTime" }

String BlackBox_Disk1_Name "BlackBox disk1 Name" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk1Name" }
String BlackBox_Disk1_Free "BlackBox disk1 Free" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk1Free" }
String BlackBox_Disk2_Name "BlackBox disk2 Name" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk2Name" }
String BlackBox_Disk2_Free "BlackBox disk2 Free" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk2Free" }
String BlackBox_Disk3_Name "BlackBox disk3 Name" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk3Name" }
String BlackBox_Disk3_Free "BlackBox disk3 Free" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk3Free" }
String BlackBox_Disk4_Name "BlackBox disk4 Name" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk4Name" }
String BlackBox_Disk4_Free "BlackBox disk4 Free" 	{ Channel="mqtt:topic:minMQTT:blackbox_metrics:BlackBoxDisk4Free" }

PaperUI does not play very nice with stuff defined in files. It was never designed to be compatible, and it’s all rather hit and miss and inconsistent.

Which is to say, don’t rely on PaperUI for xxx.items file defined Items.
You can use REST API to interrogate Items directly, you can see if Items get changed in your events.log, you can see when configuration errors get grumbled about in openhab.log, you can display information in the user facing UIs.
Learn to use all the tools to get all the clues.

Well, i havent a clue what REST is, API suggests a programming interface and that means i´ll learn to live without it… :slight_smile:

I guess i´ll have to manually link the things > items in the paperUI for all my MQTT topics…
Its not the end of the world, hopefully i´ll only set it once. :slight_smile:

Please yourself, this stuff is not simple and does require effort on your part.

I know, and im sorry if i came across as a buffoon, that was not my intention.

Im just a “tiny” bit frustrated over the fact that im not getting it to work even tho im working HARD trying to learn…

At any rate, i am sincerely grateful for your assistance, kudos to you for your effort! :smiley:

That’s what the heart icon on each post is for. :wink:

While reading through all the topics on the forum if you come across one that helps you can show your appreciation by giving it a like. This lets the person know that their time and effort was helpful and your grateful. :smiley:

1 Like

thank you for that nugget of wisdom! :slight_smile: i´ll make sure to use it! :heart:

1 Like

That’s probably partly how you got in a mess earlier.

It’s fine to configure with xxx.things and xxx.items files - but you must be precise.
If you mess up and have to make minor edits, they do not always get taken into account immediately. Stuff has to be restarted to make sure your new settings are fully read.
openhab.log bears watching, it will tell you at least about syntax errors.

PaperUI does not play nicely with all this.
If you make changes with PaperUI they are never reflected back into xxx.things or xxx.items files.
If you mix and mismatch configuring methods you will get frustrated.

Some folk manage all their Things in PaperUI, and all Items in files.
Some manage one tech/bindings Things one way, another bindings another way.
It’s abour personal consistency.