event onWifi

This commit is contained in:
Mit4el
2025-03-13 20:01:57 +03:00
parent 4bd168494f
commit 7627874766
2 changed files with 3 additions and 2 deletions

View File

@@ -178,7 +178,7 @@ void IoTItem::checkIntFromNet() {
if (_intFromNet >= 0) {
// если время жизни истекло, то удаляем элемент чуть позже на следующем такте loop
// если это было уведомление не об ошибке или начале работы, то сообщаем, что сетевое событие давно не приходило
if (_intFromNet == 0 && _id.indexOf("onError") == -1 && _id.indexOf("onStart") == -1 && _id.indexOf("onInit") == -1) {
if (_intFromNet == 0 && _id.indexOf("onError") == -1 && _id.indexOf("onStart") == -1 && _id.indexOf("onInit") == -1 && _id.indexOf("onWifi") == -1) {
SerialPrint("E", _id, "The new data did not come from the network. The level of trust is low.", _id);
}
_intFromNet--;

View File

@@ -46,6 +46,7 @@ void WiFiEvent(arduino_event_t *event)
SerialPrint("i", "WIFI", "http://" + WiFi.localIP().toString());
jsonWriteStr(settingsFlashJson, "ip", WiFi.localIP().toString());
#endif
createItemFromNet("onWifi", "1", 1);
// запускаем MQTT
mqttInit();
SerialPrint("i", F("WIFI"), F("Network Init"));
@@ -380,7 +381,7 @@ void routerConnect()
SerialPrint("i", "WIFI", "http://" + WiFi.localIP().toString());
jsonWriteStr(settingsFlashJson, "ip", WiFi.localIP().toString());
#endif
createItemFromNet("onWifi", "1", 1);
mqttInit();
}
SerialPrint("i", F("WIFI"), F("Network Init"));