How the MQTT-Broker identify the generic things?

Hello everyone,

at first, sorry because my English.

Currently I have openHAB on a virtual-machine for testing and one nodeMCU als testing-device.
I wait for delivering my Pi4 and some smarthome-devices, but we have some problems with delivering in Germany at the moment.

Yesterday I programming my nodeMCU to publish strings in two channels.
I post the code below.

Than I crate a generic thing for MQTT and add the both Channels.
But by creating I named the thing Test_MCU not Test_nodeMCU.
But still the thing will be run. On the Dashboard I add two dummy-widgets and they show me the strings of both channels. It’s all fine.
But I wondering how the broker oder openHAB identify this unique thing.
What is if I want to add more nodeMCU or D1mini to the openHAB? Have I create one new generic MQTT thing for each of them, or have I only add the channels to this one generic thing what I have?
So the generic thing will not be a unique thing but it is a interface for all my micro-controller how I wand to connect?

I hope you understand what I try to explain and my question.
Thank you
Mario

Code for nodeMCU

#include "Arduino.h"
#include "EspMQTTClient.h"

EspMQTTClient client(
  "SSID",
  "password",
  "192.168.178.157",
  "Test_nodeMCU"
);

void setup() {
}

void onConnectionEstablished() {
}

void loop() {
  client.loop();
  client.publish("Labor/EG/EG_Studio/msg", "Hallo Welt - Endlich geschafft!!");
  int  zahl = random(1,50);
  String wert = String(zahl);
  client.publish("Labor/DG/DG_Kitchen/zahl",wert);
  delay(3000);
}

You go to Paper UI
Add a channel to MQTT generic

Set MQTT topic to “Labor/EG/EG_Studio/msg”

then add the second channel

For each channel you must add an Item as well

Thank you, but this is not my problem/question.
Both channels are running fine an show me the data in the Dashboard.

My question is, how the MQTT Broker identify the generic things if I create more then the one.
Or are the nodeMCU not the thing what I create? If any channel channel a item and the generic thing is only the interface where the channel/items will be connect?
In future I want more nodeMCUs from my projects let display data in the Dashboard.

I have about 17 channels from 6 different ESP32 devices connected this way.
Some of the devices for 4 channels with different topics.
They are all identified by the channel

1 Like

Thank you so much!
That is the Info I need.
I have ordered now five nodeMCU for replace my Arduinos with there.

1 Like