This commit is contained in:
Dmitry Borisenko
2020-12-11 17:37:29 +03:00
parent 71468599fe
commit 3e5d9770a1
10 changed files with 105 additions and 43 deletions

View File

@@ -71,7 +71,7 @@ void mqttSubscribe() {
mqtt.subscribe((mqttRootDevice + "/+/control").c_str());
mqtt.subscribe((mqttRootDevice + "/update").c_str());
if (jsonReadBool(configSetupJson, "snaMqtt")) {
if (jsonReadBool(configSetupJson, "MqttIn")) {
mqtt.subscribe((mqttPrefix + "/+/+/event").c_str());
mqtt.subscribe((mqttPrefix + "/+/+/info").c_str());
}
@@ -143,7 +143,7 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) {
}
else if (topicStr.indexOf("event") != -1) {
if (!jsonReadBool(configSetupJson, "snaMqtt")) {
if (!jsonReadBool(configSetupJson, "MqttIn")) {
return;
}
if (topicStr.indexOf(chipId) == -1) {
@@ -215,7 +215,7 @@ boolean publishStatus(const String& topic, const String& data) {
boolean publishEvent(const String& topic, const String& data) {
String path = mqttRootDevice + "/" + topic + "/event";
return mqtt.publish(path.c_str(), data.c_str(), false);
return mqtt.publish(path.c_str(), data.c_str(), true);
}
boolean publishInfo(const String& topic, const String& data) {