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);
}