Function cmpToMainTopic?

Hi.
Is the line 441 (main.ino) correct? “if (strstr(topicOri, topic) != NULL) {”
I have changed it for: “if (strstr(topic, topicOri) != NULL) {”
to make function MQTTtoFASTLED work… thanks

Hi,

Could you share the MQTT command that you are publishing?

Hi, I have not found the documentation to confirm my publications, I am using these topics:

for “subjectMQTTtoFASTLEDsetled”
topic: “home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setled”
payload: “{“led”:3,“hex”:“ffffff”,“blink”:false}”
qos: 1
retain: false

for “subjectMQTTtoFASTLEDsetanimation”
topic: “home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setanimation”
payload: “fire”
qos: 1
retain: false

for “subjectMQTTtoFASTLEDsetbrightness”
topic: “home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness”
payload: “0 78”
qos: 1
retain: false

for “subjectMQTTtoFASTLED”
“home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED”
payload: “0 0”
qos: 1
retain: false

for “subjectGTWFASTLEDtoMQTT”
Not implemented?

Thanks

Would it be possible to add a

Log.notice(F("topicOri : %s" CR), topicOri);
Log.notice(F("toAdd : %s" CR), toAdd);

Into: https://github.com/1technophile/OpenMQTTGateway/blob/a184355f9bb03bb59fd67197f4ddfba184d552b0/main/main.ino#L437

And share the log once your commands are launched?

Hi.
TX mqtt:
topic: “home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness”
payload: “0 78”
qos: 1
retain: false

Code:
bool cmpToMainTopic(char* topicOri, char* toAdd) {
char topic[mqtt_topic_max_size];
strcpy(topic, mqtt_topic);
strcat(topic, toAdd);
Log.notice(F(“topicOri : %s” CR), topicOri);
Log.notice(F(“toAdd : %s” CR), toAdd);
if (strstr(topicOri, topic) != NULL) {
Log.notice(F(“true” CR));
return true;
} else {
Log.notice(F(“false” CR));
return false;
}
}
Serial output:
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTto433
N: false
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTtoFASTLED
N: true
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTtoONOFF
N: false


Code change:
bool cmpToMainTopic(char* topicOri, char* toAdd) {
char topic[mqtt_topic_max_size];
strcpy(topic, mqtt_topic);
strcat(topic, toAdd);
Log.notice(F(“topicOri : %s” CR), topicOri);
Log.notice(F(“toAdd : %s” CR), toAdd);
if (strstr(topic, topicOri) != NULL) {
Log.notice(F(“true” CR));
return true;
} else {
Log.notice(F(“false” CR));
return false;

}
}

Serial output:
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTto433
N: false
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTtoFASTLED
N: false
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTtoFASTLED/setbrightness
N: true
N: FASTLED brillo Número: 120
N: topicOri : home/OpenMQTTGateway_ESP32_RF/commands/MQTTtoFASTLED/setbrightness
N: toAdd : /commands/MQTTtoONOFF
N: false