ESPEasy MQTT with multiple input switches

Hi, I am completely new to Open Hub but have some experience with domoticz
so here is my question, Espeasy can have more than one input or output but it can only
subscribe to 1 MQTT Topic, with domoticz we had the IDX / VAR for each I/O
to identify the I/O and be able to work with only one topic.
I am sure that as a beginner I must be missing something, but I am able
to bind 1 switch and work well, but when I add another they go off and on at the same time.

Any help on this, please ?

When using MQTT you create Generic MQTT Things. A Generic MQTT Thing has zero or more Channels. You create each Channel. When you create the Channel you define the stateTopic (i.e. subscription) and the commandTopic (i.e. publish). Configure the commandTopic to the 1 MQTT topic.

If you have multiple ESPEasy devices, you need to configure them to each subscribe to a different topic.

You’ve provided absolutely zero details about what you’ve done to try to configure this so We are all just making wild ass guesses as to how to help.

Hi rlkoshak , thanks for you prompt reply

as i already said i totally new to this , i have no problem with multiple devices ,
as every device can subscribe to a different Topic , my problem is with a single device that has more than 1 output connected to it but can subscribe to 1 topic only .

You’d need to know how your device packs its multiple data into one topic’s payload, perhaps?

I think you need to provide specifics.

Do you have two sensors and one actuator? Than:

  • 1 Channel subscribes to sensor 1’s topic and leave the commandTopic blank
  • 2 Channel subscribes to sensor 2’s topic and leave the commandTopic blank
  • 3 Channel subscribes to the status topic for the actuator and publishes to the command topic

If you have multiple actuators that subscribe to only one topic, well than the answer to your question will probably be on the ESPEasy forum and not here. You will need to figure out what the message needs to look like that openHAB publishes to that the command goes to the right actuator. But that’s outside of OH, that’s an ESPEasy thing.

I am using ESPeasy Mega here is the controller config

on debian server when i run command : mosquitto_sub -h localhost -t testing1/#
to spy on MQTT data I only see 1 and 0 nothing more

I guess i have to research much more before I can migrate from domoticz to openhub :slight_smile:

Thanks very much for your help .

I don’t know ESP Easy Mega but it looks like it subscribes to all topics that match “%sysname%” which I’m sure that %sysname%" is configured somewhere else. So where do you map the actual topic to an actuator? The answer to that will I’m sure be in the ESP Easy Mega docs.

Ok I have solved it , i was missing a lot of things so
using a MQTT spy on my pc i was able to see the real topic name


I thought it was just : testing1/# in reality the # symbol represents the
switch Name & switch Value which be customized for every I/O and
sensor on EspEasy.
That makes a different topic for every device connected to Esp .

So that was it Hope this thread helps someone with the same problem :slight_smile:

thanks