Merge pull request #323 from Mit4el/ver4dev

bugfix ExternalMqtt
This commit is contained in:
2023-10-03 22:44:06 +03:00
committed by GitHub
2 changed files with 18 additions and 6 deletions

View File

@@ -121,13 +121,16 @@ void mqttSubscribe() {
}
void mqttSubscribeExternal(String topic, bool usePrefix) {
SerialPrint("i", F("MQTT"), ("subscribed external" + topic).c_str());
// SerialPrint("i", F("MQTT"), mqttRootDevice);
String _sb_topic = topic;
if (usePrefix)
{
mqtt.subscribe((mqttPrefix + topic).c_str());
_sb_topic = mqttPrefix + "/" + topic;
}
mqtt.subscribe(topic.c_str());
mqtt.subscribe(_sb_topic.c_str());
SerialPrint("i", F("MQTT"), ("subscribed external " + _sb_topic).c_str());
}
void mqttCallback(char* topic, uint8_t* payload, size_t length) {