Mqtt config with .things file not working

I am running version 3.4.0.M4 in a docker container.
MQTT binding is installed

and this is my mqtt.things file in config/things folder

Bridge mqtt:broker:mymosquitto "mqtt Broker" [host="", secure=false, clientID="openHAB", port=1883 ]

Thing mqtt:topic:zuhause "mqtt Zuhause"
                Type    number : heizstromimpuls    "Impuls"           [stateTopic="SCHALTSCHRANK/Heizstrom/Count"]
                Type    number : heizstromzeit      "Impulsdauer"      [stateTopic="SCHALTSCHRANK/Heizstrom/Time"]
                Type    number : heizstromgesamt    "Gesamtverbrauch"  [stateTopic="SCHALTSCHRANK/Heizstrom/Total"]

                Type    number : dose_wama_power    "WaMa Leistung"    [stateTopic="Dose-WaMa/power"]
                Type    number : dose_wama_voltage  "WaMa Spannung"    [stateTopic="Dose-WaMa/voltage"]
                Type    number : dose_wama_energy   "WaMa Verbrauch"   [stateTopic="Dose-WaMa/energy"]
                Type    number : dose_wama_current  "WaMa StromstÀrke" [stateTopic="Dose-WaMa/current"]

                Type    number : dose_trockner_power      "Trockner Leistung"             [stateTopic="Dose-Trockner/power"]
                Type    number : dose_trockner_voltage    "Trockner Spannung"             [stateTopic="Dose-Trockner/voltage"]
                Type    number : dose_trockner_energy     "Trockner Verbrauch"            [stateTopic="Dose-Trockner/energy"]
                Type    number : dose_trockner_current    "Trockner StromstÀrke"          [stateTopic="Dose-Trockner/current"]

                Type    number : dose_stereo_max_power    "Stereoanlage-Max Leistung"     [stateTopic="Dose-Stereo-Max/power"]
                Type    number : dose_stereo_max_voltage  "Stereoanlage-Max Spannung"     [stateTopic="Dose-Stereo-Max/voltage"]
                Type    number : dose_stereo_max_energy   "Stereoanlage-Max Verbrauch"    [stateTopic="Dose-Stereo-Max/energy"]
                Type    number : dose_stereo_max_current  "Stereoanlage-Max StromstÀrke"  [stateTopic="Dose-Stereo-Max/current"]

                Type    number : dose_stereo_emmi_power   "Stereoanlage-Emmi Leistung"    [stateTopic="Dose-Stereo-Emmi/power"]
                Type    number : dose_stereo_emmi_voltage "Stereoanlage-Emmi Spannung"    [stateTopic="Dose-Stereo-Emmi/voltage"]
                Type    number : dose_stereo_emmi_energy  "Stereoanlage-Emmi Verbrauch"   [stateTopic="Dose-Stereo-Emmi/energy"]
                Type    number : dose_stereo_emmi_current "Stereoanlage-Emmi StromstÀrke" [stateTopic="Dose-Stereo-Emmi/current"]

                Type    number : dose_fernseher_power     "Multimedia Leistung"           [stateTopic="Dose-Fernseher/power"]
                Type    number : dose_fernseher_voltage   "Multimedia Spannung"           [stateTopic="Dose-Fernseher/voltage"]
                Type    number : dose_fernseher_energy    "Multimedia Verbrauch"          [stateTopic="Dose-Fernseher/energy"]
                Type    number : dose_fernseher_current   "Multimedia StromstÀrke"        [stateTopic="Dose-Fernseher/current"]

                Type    number : dose_drucker_power       "Drucker Leistung"              [stateTopic="Dose-Drucker/power"]
                Type    number : dose_drucker_voltage     "Drucker Spannung"              [stateTopic="Dose-Drucker/voltage"]
                Type    number : dose_drucker_energy      "Drucker Verbrauch"             [stateTopic="Dose-Drucker/energy"]
                Type    number : dose_drucker_current     "Drucker StromstÀrke"           [stateTopic="Dose-Drucker/current"]

                Type    number : dose_gefrierschrank_power       "Gefrierschrank Leistung"        [stateTopic="Dose-Gefrierschrank/power"]
                Type    number : dose_gefrierschrank_voltage     "Gefrierschrank Spannung"        [stateTopic="Dose-Gefrierschrank/voltage"]
                Type    number : dose_gefrierschrank_energy      "Gefrierschrank Verbrauch"       [stateTopic="Dose-Gefrierschrank/energy"]
                Type    number : dose_gefrierschrank_current     "Gefrierschrank StromstÀrke"     [stateTopic="Dose-Gefrierschrank/current"]

                Type    number : dose_bueroschreibtisch_power    "BueroSchreibtisch Leistung"     [stateTopic="Dose-BueroSchreibtisch/power"]
                Type    number : dose_bueroschreibtisch_voltage  "BueroSchreibtisch Spannung"     [stateTopic="Dose-BueroSchreibtisch/voltage"]
                Type    number : dose_bueroschreibtisch_energy   "BueroSchreibtisch Verbrauch"    [stateTopic="Dose-BueroSchreibtisch/energy"]
                Type    number : dose_bueroschreibtisch_current  "BueroSchreibtisch StromstÀrke"  [stateTopic="Dose-BueroSchreibtisch/current"]

                Type    number : dose_lampe_o_power       "Lampe O Leistung"              [stateTopic="Dose-WZ-LampeO/power"]
                Type    number : dose_lampe_nw_power      "Lampe NW Leistung"             [stateTopic="Dose-WZ-LampeNW/power"]
                Type    number : dose_lampe_sw_power      "Lampe SW Leistung"             [stateTopic="Dose-WZ-LampeSW/power"]
                Type    number : dose_lampe_no_power      "Lampe NO Leistung"             [stateTopic="Dose-WZ-LampeNO/power"]
                Type    number : dose_lampe_so_power      "Lampe SO Leistung"             [stateTopic="Dose-WZ-LampeSO/power"]

                Type    number : dose_staubfilter_power       "Staubfilter Leistung"        [stateTopic="Dose-Staubfilter/power"]
                Type    number : dose_staubfilter_voltage     "Staubfilter Spannung"        [stateTopic="Dose-Staubfilter/voltage"]
                Type    number : dose_staubfilter_energy      "Staubfilter Verbrauch"       [stateTopic="Dose-Staubfilter/energy"]
                Type    number : dose_staubfilter_current     "Staubfilter StromstÀrke"     [stateTopic="Dose-Staubfilter/current"]

                Type    number : licht_schuppen_power     "Licht Schuppen Leistung"       [stateTopic="LICHT-SCHUPPEN/power"]
                Type    number : licht_schuppen_energy    "Licht Schuppen Verbrauch"      [stateTopic="LICHT-SCHUPPEN/energy"]

                Type    switch : dose_drucker_switch       "Steckdose Drucker"            [stateTopic="Dose-Drucker/relay/0", commandTopic="Dose-Drucker/relay/0/set", on="1",off="0" ]
                Type    switch : dose_wama_switch          "Steckdose Waschmaschine"      [commandTopic="Dose-WaMa/relay/0/set", on="1", off="0", stateTopic="Dose-WaMa/relay/0"]
                Type    switch : dose_trockner_switch      "Steckdose Trockner"           [commandTopic="Dose-Trockner/relay/0/set", on="1", off="0", stateTopic="Dose-Trockner/relay/0"]
                Type    switch : dose_fernseher            "Multimedia"                   [commandTopic="Dose-Fernseher/relay/0/set", on="1", off="0", stateTopic="Dose-Fernseher/relay/0"]
                Type    switch : dose_stereo_emmi          "Steckdose Stereoanlage Emmi"  [commandTopic="Dose-Stereo-Emmi/relay/0/set",on="1", off="0", stateTopic="Dose-Stereo-Emmi/relay/0"]
                Type    switch : dose_stereo_max           "Steckdose Stereoanlage Max"   [commandTopic="Dose-Stereo-Max/relay/0/set", on="1", off="0", stateTopic="Dose-Stereo-Max/relay/0"]
                Type    switch : dose_lampe_nw             "Lampe NW"                     [commandTopic="Dose-WZ-LampeNW/relay/0/set", on="1", off="0", stateTopic="Dose-WZ-LampeNW/relay/0"]
                Type    switch : dose_lampe_sw             "Lampe SW"                     [commandTopic="Dose-WZ-LampeSW/relay/0/set", on="1", off="0", stateTopic="Dose-WZ-LampeSW/relay/0"]
                Type    switch : dose_lampe_no             "Lampe NO"                     [commandTopic="Dose-WZ-LampeNO/relay/0/set", on="1", off="0", stateTopic="Dose-WZ-LampeNO/relay/0"]
                Type    switch : dose_lampe_o              "Lampe O"                      [commandTopic="Dose-WZ-LampeO/relay/0/set", on="1", off="0", stateTopic="Dose-WZ-LampeO/relay/0"]
                Type    switch : dose_lampe_so             "Lampe SO"                     [commandTopic="Dose-WZ-LampeSO/relay/0/set", on="1", off="0", stateTopic="Dose-WZ-LampeSO/relay/0"]
                Type    switch : dose_staubfilter          "Steckdose Staubfilter"        [commandTopic="Dose-Staubfilter/relay/0/set", on="1", off="0", stateTopic="Dose-Staubfilter/relay/0"]
                Type    switch : dose_gefrierschank        "Steckdose Gefrierschrank"     [commandTopic="Dose-Gefrierschrank/relay/0/set", on="1", off="0", stateTopic="Dose-Gefrierschrank/relay/0"]
                Type    switch : dose_bueroschreibtisch    "Steckdose Bueroschreibtisch"  [commandTopic="Dose-Bueroschreibtisch/relay/0/set", on="1", off="0", stateTopic="Dose-Bueroschreibtisch/relay/0"]

                Type    switch : aussen_licht_s            "Außenlampe S"                 [commandTopic="LICHT-AUSSEN-S/relay/0/set", on="1", off="0", stateTopic="LICHT-AUSSEN-S/relay/0"]
                Type    switch : aussen_licht_o            "Außenlampe O"                 [commandTopic="LICHT-AUSSEN-O/relay/0/set", on="1", off="0", stateTopic="LICHT-AUSSEN-O/relay/0"]
                Type    switch : licht_schuppen            "Licht Schuppen"               [commandTopic="LICHT-SCHUPPEN/relay/0/set", on="1", off="0", stateTopic="LICHT-SCHUPPEN/relay/0"]

                Type    number : garagentoroben            "Garagentor offen"             [stateTopic="GARAGE/O1D1G5TorEndlageOben/State"]
                Type    number : garagentorunten           "Garagentor zu"                [stateTopic="GARAGE/O2D2G4TorEndlageUnten/State"]
                Type    switch : garagencheck              "Garagenposition nach Paketbote"  [stateTopic="RPi_Klingel/garagencheck"]

                Type    string : rpi_status_uhrzeit        "Datum"                        [stateTopic="RPi_Klingel/time"]
                Type    number : rpi_status_temperatur     "CPU Temperatur"               [stateTopic="RPi_Klingel/temp"]
                Type    number : rpi_status_cpuprozent     "CPU Auslastung"               [stateTopic="RPi_Klingel/cpu"]
                Type    number : rpi_status_discuse        "Klingelstatus"                [stateTopic="RPi_Klingel/diskusage"]
                Type    switch : rpi_status_kamera         "Kamerastatus"                 [stateTopic="RPi_Klingel/video"]
                Type    string : klingel_status_input      "Klingelstatus"                [stateTopic="RPi_Klingel/status"]

                Type    number : temperatureaussenhinten    "Temperatur AußenH"           [stateTopic="TEMP-AUSSEN/BME680/Temperature"]
                Type    number : temperatureaussenvorne     "Temperatur AußenV"           [stateTopic="TEMP-AUSSEN/DS18B20/Temperature"]
                Type    number : humidityaussen             "Luftfeuchtigkeit Außen"      [stateTopic="TEMP-AUSSEN/BME680/Humidity"]
                Type    number : pressureaussen             "Luftdruck Außen"             [stateTopic="TEMP-AUSSEN/BME680/Pressure"]
                Type    number : voltageaussen              "Spannung Akku"               [stateTopic="TEMP-AUSSEN/100k/Spannung"]
                Type    number : helligkeitaussen           "Helligkeit Außen"            [stateTopic="TEMP-AUSSEN/LICHTSENSOR/Lux"]
                Type    number : luftqualitaetaussen        "LuftqualitĂ€t Außen"          [stateTopic="TEMP-AUSSEN/BME680/Gas"]


log shows only this entry:
022-11-22 21:38:05.988 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘mqtt.things’

no further message

I am followed this tutorial:

I tried then to install a mqtt broker bridge in GUI
then added a channel
then added to this channel a number type

between each step I restarted the container to look if the file is recognized anyway.
but the file seems to be not took into account

The channel with the number type was working. But as you may see I would have to do a lot of clicking work to get all mqtt things in 

Does your OH2 system use the same clientID? Make sure that this is unique for every single device connecting to Mosquitto.

Also, your Thing is not referencing the Bridge. Check the example again in the page you linked.

Thanks for your fast help.

I changed client ID to openHAB3 even if under OH2 it is not defined

I guess I found what you talked about
That it should look like

Thing mqtt:topic:zuhause "mqtt Zuhause" (mqtt:broker:mymosquitto)

But it did not help showing the mqtt things in GUI
I restarted the docker then and it showed this in the log:

2022-11-22 22:07:13.941 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'jdbc.persist'
2022-11-22 22:07:14.231 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mqtt.things'
2022-11-22 22:07:14.272 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'modbus_sma.things'

but no things in GUI

Try Creating a new things file and paste the example in it to see if you can get that working first.

Dose your broker have a username and password?

Here, the channel belongs to to the Thing - because it/they are enclosed in curly braces { }
It is effectively
Thing blah { channel, channel }

The Thing does not belong to the broker Bridge. No curly braces.

You can either use curly braces to nest Things in Bridge

Bridge mqtt:broker:mymosquitto "mqtt Broker" [host="", secure=false, clientID="openHAB", port=1883 ]
    Thing topic zuhause "mqtt Zuhause"

or you can tell each Thing which broker it belongs to

Thing mqtt:topic:mymosquitto:zuhause "mqtt Zuhause" ...

I tried both and acc the guide there is no curly braces

Thanks, did not work.

I gave up !

Thanks anyway

Well, I told you what is wrong with the version you showed us. If you want to know what is wrong with some other version that you made, you’ll have to show us that.

It may not be the only thing wrong of course, you would still need to get broker connection details correct.

1 Like