mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
добавил ответ конфигом на запрос
This commit is contained in:
@@ -7,3 +7,6 @@ extern void initMDNS();
|
|||||||
|
|
||||||
extern void HttpServerinitWS();
|
extern void HttpServerinitWS();
|
||||||
extern void HttpServerinit();
|
extern void HttpServerinit();
|
||||||
|
|
||||||
|
//===========web sockets==============================
|
||||||
|
extern void sendEspSetupToWS();
|
||||||
@@ -112,8 +112,10 @@ void onWsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventTyp
|
|||||||
}
|
}
|
||||||
Serial.printf("%s\n", msg.c_str());
|
Serial.printf("%s\n", msg.c_str());
|
||||||
|
|
||||||
if (msg.startsWith("HELLO")) {
|
if (msg.startsWith("config")) {
|
||||||
SerialPrint("I", F("WS"), F("Full update"));
|
SerialPrint("I", F("WS"), F("config send"));
|
||||||
|
sendEspSetupToWS();
|
||||||
|
|
||||||
// publishWidgetsWS();
|
// publishWidgetsWS();
|
||||||
// publishStateWS();
|
// publishStateWS();
|
||||||
// choose_log_date_and_send(); // функцию выгрузки архива с графиком я не сделал. Забираю при выгрузке по MQTT
|
// choose_log_date_and_send(); // функцию выгрузки архива с графиком я не сделал. Забираю при выгрузке по MQTT
|
||||||
@@ -209,3 +211,18 @@ void HttpServerinitWS() {
|
|||||||
server.addHandler(&events);
|
server.addHandler(&events);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========web sockets==============================
|
||||||
|
void sendEspSetupToWS() {
|
||||||
|
File file = seekFile("/setup.json");
|
||||||
|
DynamicJsonDocument doc(1024);
|
||||||
|
file.find("[");
|
||||||
|
|
||||||
|
do {
|
||||||
|
deserializeJson(doc, file);
|
||||||
|
|
||||||
|
// Serial.println(doc.as<String>());
|
||||||
|
ws.textAll(doc.as<String>());
|
||||||
|
|
||||||
|
} while (file.findUntil(",", "]"));
|
||||||
|
}
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ void setup() {
|
|||||||
},
|
},
|
||||||
nullptr, true);
|
nullptr, true);
|
||||||
|
|
||||||
setupESP();
|
// setupESP();
|
||||||
|
|
||||||
|
sendEspSetupToWS();
|
||||||
|
|
||||||
SerialPrint("I", F("System"), F("✔ Initialization completed"));
|
SerialPrint("I", F("System"), F("✔ Initialization completed"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user