Mqtt 2.4, GUI configured broker, text item files

Hello i have a problem,
would relly like to configure my mqtt items in text files but im not able to make it work.

I would like to use this type:
{mqtt="<[broker:landroid/status/firmware:state:default]"}
there is no connecting i have triede alot of things with out luck

If i use a Generic MQTT Thing in paper-ui to create a channel and use this type:{channel=“mqtt:topic:Fiddo:dateandtime”}
Everything works as it should

My GUI configured mqtt broker
image

Can anyone point me in the right direction ?

Thanks Mads

You are using the MQTT Version 1 Syntax for the Item, however you have the Verion 2 installed! Using the Generic MQTT THing is the correct way.
The correct Syntax for a complete Setup using files can be found at the Bottom of this documentation page.

2 Likes

Thanks Opus

I fell it would be easyer to use the “old” way instead of clicking around in paper-ui to make a “channel” that i can use in my mqtt items fil. but if there only the “Generic MQTT Thing” way so be it. :slight_smile:

I actully tried this

Switch Kitchen_Light "Kitchen Light" {channel="mqtt:mybroker:topic:mything:lamp" }

From on of my tries
{channel="mqtt:topic:broker:32811816:landroid/status/dateTime:state:default"}

The exact used syntax needs to be adjusted to your system. The needed channel syntax can be copied from the displayed Thing on PaperUI (it doesn’t matter how the thing was created, via File or via PaperUI).
The example you showed can’t be correct!

If we use the lamp as example

Switch Kitchen_Light “Kitchen Light” {channel=“mqtt:mybroker:topic:mything:lamp” }

With my broker ???
Switch Kitchen_Light “Kitchen Light” {channel=“mqtt:broker:32811816:topic:mything:lamp” }

image

I have tried to make a thing
Thing mqtt:topic:landroid {
Channels:
Type number : landroid_firmware1 “Firmware [v%s]” [ stateTopic=“landroid/status/firmware” ]

And a item
Number Landroid_firmware “Firmware [v%s]” {channel=“mqtt:broker:32811816:topic:landroid:landroid_firmware1”}

I still having problems, can someone please give me and example using my “settings”

Thanks Mads

IMHO the channel for the item should look like:

{channel=“mqtt:topic:32811816:landroid:landroid_firmware1”}

However look into PaperUI, under the channel you will see the correct syntax!

1 Like

Personally if you’re insisting on configuring all mqtt with items files, I’d stick with the mqtt1 addon.

The 2.4+ is good if your devices comply to a scheme and can be discovered. But to configure by hand, especially if you have lots of devices, it’s just a lot of work.

this is really wrong. 2.4 is very easy to setup without paperUI and I personally recommend to avoid depreciated gui anyways…

OP:
here is how you configure your broker (make it separate file so it won’t be refreshed when you need to change some other things)

Bridge mqtt:broker:home "Mosquitto MQTT Broker" [ 
  host="xx.xx.xx.xx",
  secure=false,
  port=1883,
  qos=0,
  retain=false,
  clientid="someid",
  //certificate="",
  //certificatepin=false,
  //publickey="",
  //publickeypin=false,
  keep_alive_time=30000,
  reconnect_time=60000,
  //lastwill_message="",
  //lastwill_qos=1,
  //lastwill_topic="",
  username="",
  password=""
]

then for example some temp/hum thing

/* attic */
Thing mqtt:topic:AtticClimate   "Attic Climate" (mqtt:broker:home) @ "Attic" {
Channels:
    Type number : temperature   "Temperature"       [ stateTopic="homie/attic/climate/temperature"]
    Type number : humidity      "Humidity"          [ stateTopic="homie/attic/climate/humidity"]
}

and item

/* attic */
Number  Attic_Temperature       "Temperature [%.1f °C]"     <temperature>   (gStore10, gAT)                                                     { channel = "mqtt:topic:AtticClimate:temperature" }
Number  Attic_Humidity          "Humidity [%.0f %%]"        <humidity>      (gStore10, gAT)                                                     { channel = "mqtt:topic:AtticClimate:humidity" }

as you can see I’m using homie convention, so those things will be autodiscovered by OH, but I’m not using it at all, as I don’t feel very comfortable to not have any reliable and intuitive backup/control over it via paperUI… files are easy to maintain and easy to backup.

just my 2cents

1 Like

It works :heart_eyes::smiley::smiley::smiley::smiley:

my things file: (this is with the GUI configured mqtt broker)

Thing mqtt:topic:landroid "testing" (mqtt:broker:32811816) {
Channels:
    Type number : landroid_firmware1   "Firmware [v%s]" [ stateTopic="landroid/status/firmware" ]

}
my items file:

Number Landroid_firmware  "Firmware [v%s]"  <lawnmower> {channel="mqtt:topic:landroid:landroid_firmware1"}

BIG thanks to everyone :-):smiley:

1 Like