Limitation / 1:1 - relationship between bridge and thing w/ channels in MQTT binding?


I’m quite new to invoking MQTT and stumbled upon some interesting behaviour i can’t quite understand.

I started off with a bridge

Bridge mqtt:broker:myAuthenticatedBroker [ host="192.168.xx.yy", port="1883", secure=false, username="myVerySpecialUserName", password="myQuiteNicePassword" ]

and a thing having multiple channels:

Thing mqtt:topic:s11_BalkonkraftPergolaTopic "Balkonkraft S11" (mqtt:broker:myAuthenticatedBroker) {
    Type number : s11_BalkonkraftPergola_power_ac "S11 Leistung AC" [ stateTopic="s11/solar/balkon/ac/power" ]
    Type number : s11_BalkonkraftPergola_power_dc "S11 Leistung DC" [ stateTopic="s11/solar/balkon/dc/power" ]

both configured in the file mqtt.things.

The corresponding items are configured as well and received updates - I’d spare them here as the observed behaviour happended when appending the mqtt.things file with a second thing using the same broker:

Thing mqtt:topic:r05_BalkonkraftSchuppenTopic "Balkonkraft R05" (mqtt:broker:myAuthenticatedBroker) {
    Type number : r05_BalkonkraftSchuppen_power_ac              "R05 Leistung AC"                  [ stateTopic="r05/solar/balkonkr/schuppen/ac/power" ]  
    Type number : r05_BalkonkraftSchuppen_yieldday_ac           "R05 Ertrag (Tag) AC"              [ stateTopic="r05/solar/balkonkr/schuppen/ac/yieldday" ]

I realized the following:
All items bound to the first thing (s11) stopped receiving updates whilst the items bound to the 2nd thing received updates.

So I wonder now whether there is a strict 1:1 relationship between thing and bridge, i.e. if all MQTT Topics are to be configured within the same thing then.

Thanks a lot in advance


You can create as many things as you need using the same bridge. In fact you can even create your things in separate .things file and refer to a bridge created in another .things file.

Sometimes, editing a .things file is a bit weird, and changes aren’t reloaded properly. Commenting → saving → uncommenting may sometimes help, or failing that, restarting openhab will surely fix it.

1 Like

Another note, if you are going to end up with lots of things of similar devices, e.g. Lightbulb1, Lightbulb2… Lightbulb 50… etc., this might come in handy:

It allows you to create a template of your device / things / items definition and then maintain a list of your devices in a simpler yaml file. The tool then generates the repetitive Things and Items definition for you based on the given template.

Hi @JimT,
thanks a bunch for sharing your insights.
I now separated the config into three actual files - one covering only the bridge for now, one for all MQTT stuff related to the location “s11” and the final one for the “r05” location.

Funny enough, after separating the config into the files, openhab either received updates on the s11 -OR- the r05 topics (depending on which things file was saved last), but afer a reboot I now seem to receive updates on all topics.

I’ll look into your Items and Things Generator later, might actually come in handy with my setup.