Don't send status diffferent from opened or closed because it will be an undfined satus for clients retrieving the stored message from the server.
This commit is contained in:
@@ -253,7 +253,7 @@ void setup(void) {
|
|||||||
server.sendHeader("Connection", "close");
|
server.sendHeader("Connection", "close");
|
||||||
boolean isOpen=digitalRead(buttonPin)==HIGH;
|
boolean isOpen=digitalRead(buttonPin)==HIGH;
|
||||||
server.send(200, "application/json", "{ \"isOpen\": " + String(isOpen?"true":"false") + " }");
|
server.send(200, "application/json", "{ \"isOpen\": " + String(isOpen?"true":"false") + " }");
|
||||||
send_mqtt("statusquery");
|
//send_mqtt("statusquery");
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on("/sendmqtt", HTTP_GET, []() {
|
server.on("/sendmqtt", HTTP_GET, []() {
|
||||||
@@ -300,7 +300,7 @@ void loop(void) {
|
|||||||
|
|
||||||
if (!mqttClient.connected()) {
|
if (!mqttClient.connected()) {
|
||||||
reconnect();
|
reconnect();
|
||||||
send_mqtt("(re)connected");
|
// send_mqtt("(re)connected");
|
||||||
}
|
}
|
||||||
mqttClient.loop();
|
mqttClient.loop();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user