just comment
This commit is contained in:
@@ -129,7 +129,7 @@ bool switchLight(uint8_t nLamp, int state, bool pub)
|
||||
if (pub){
|
||||
digitalWrite(LED_WRK, LOW);
|
||||
led_ms = millis();
|
||||
mqttClient.publish("/home/kuh/lighttbl", 1, false, state ? "true" : "false");
|
||||
mqttClient.publish("/home/kuh/lighttbl", 1, false, state ? "1" : "0");
|
||||
}
|
||||
return state;
|
||||
}
|
||||
@@ -154,9 +154,9 @@ void onWifiDisconnect(const WiFiEventStationModeDisconnected& event) {
|
||||
}
|
||||
|
||||
void onMqttConnect(bool sessionPresent) {
|
||||
mqttClient.publish("/home/kuh/lighttbl_set", 1, false, digitalRead(LAMP) == 1 ? "true" : "false");
|
||||
mqttClient.publish("/home/kuh/lighttbl_set", 1, false, digitalRead(LAMP) == 1 ? "1" : "0");
|
||||
mqttClient.subscribe("/home/kuh/lighttbl_set", 1);
|
||||
mqttClient.publish("/home/kuh/lighttbl", 1, false, digitalRead(LAMP) == 1 ? "true" : "false");
|
||||
mqttClient.publish("/home/kuh/lighttbl", 1, false, digitalRead(LAMP) == 1 ? "1" : "0");
|
||||
digitalWrite(LED_MQ, HIGH);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
||||
strncpy(pl, payload, len);
|
||||
pl[len] = '\0';
|
||||
if(strcmp(topic, "/home/kuh/lighttbl_set") == 0){
|
||||
if (strcmp("true", pl) == 0) switchLight(LAMP, 1, true);//lStat2 = true;
|
||||
if (strncmp("1", pl, 1) == 0) switchLight(LAMP, 1, true);//lStat2 = true;
|
||||
else switchLight(LAMP, 0, true);//lStat2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user