mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
добавил ответ конфигом на запрос
This commit is contained in:
@@ -7,3 +7,6 @@ extern void initMDNS();
|
||||
|
||||
extern void HttpServerinitWS();
|
||||
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());
|
||||
|
||||
if (msg.startsWith("HELLO")) {
|
||||
SerialPrint("I", F("WS"), F("Full update"));
|
||||
if (msg.startsWith("config")) {
|
||||
SerialPrint("I", F("WS"), F("config send"));
|
||||
sendEspSetupToWS();
|
||||
|
||||
// publishWidgetsWS();
|
||||
// publishStateWS();
|
||||
// choose_log_date_and_send(); // функцию выгрузки архива с графиком я не сделал. Забираю при выгрузке по MQTT
|
||||
@@ -209,3 +211,18 @@ void HttpServerinitWS() {
|
||||
server.addHandler(&events);
|
||||
#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);
|
||||
|
||||
setupESP();
|
||||
// setupESP();
|
||||
|
||||
sendEspSetupToWS();
|
||||
|
||||
SerialPrint("I", F("System"), F("✔ Initialization completed"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user