diff --git a/SmartEVSE-3/src/main.cpp b/SmartEVSE-3/src/main.cpp index e9f234bf..e19ec990 100644 --- a/SmartEVSE-3/src/main.cpp +++ b/SmartEVSE-3/src/main.cpp @@ -3205,7 +3205,6 @@ void mqttPublishData() { MQTTclient.publish(MQTTprefix + "/EVCurrentL2", EVMeter.Irms[1], false, 0); MQTTclient.publish(MQTTprefix + "/EVCurrentL3", EVMeter.Irms[2], false, 0); } - MQTTclient.publish(MQTTprefix + "/ESPUptime", esp_timer_get_time() / 1000000, false, 0); MQTTclient.publish(MQTTprefix + "/ESPTemp", TempEVSE, false, 0); MQTTclient.publish(MQTTprefix + "/Mode", Access_bit == 0 ? "Off" : Mode > 3 ? "N/A" : StrMode[Mode], true, 0); MQTTclient.publish(MQTTprefix + "/MaxCurrent", MaxCurrent * 10, true, 0); @@ -3224,7 +3223,6 @@ void mqttPublishData() { MQTTclient.publish(MQTTprefix + "/EVPlugState", (pilot != PILOT_12V) ? "Connected" : "Disconnected", true, 0); MQTTclient.publish(MQTTprefix + "/WiFiSSID", String(WiFi.SSID()), true, 0); MQTTclient.publish(MQTTprefix + "/WiFiBSSID", String(WiFi.BSSIDstr()), true, 0); - MQTTclient.publish(MQTTprefix + "/WiFiRSSI", String(WiFi.RSSI()), false, 0); #if MODEM MQTTclient.publish(MQTTprefix + "/CPPWM", CurrentPWM, false, 0); MQTTclient.publish(MQTTprefix + "/CPPWMOverride", CPDutyOverride ? String(CurrentPWM) : "-1", true, 0); diff --git a/SmartEVSE-3/src/network.cpp b/SmartEVSE-3/src/network.cpp index 0b81a3ef..7e1e9ac0 100644 --- a/SmartEVSE-3/src/network.cpp +++ b/SmartEVSE-3/src/network.cpp @@ -1368,6 +1368,7 @@ void WiFiSetup(void) { // called by loop() in the main program void network_loop() { static unsigned long lastCheck_net = 0; + static int seconds = 0; if (millis() - lastCheck_net >= 1000) { lastCheck_net = millis(); //this block is for non-time critical stuff that needs to run approx 1 / second @@ -1375,9 +1376,13 @@ void network_loop() { if (!LocalTimeSet && WIFImode == 1) { _LOG_A("Time not synced with NTP yet.\n"); } + //this block is for non-time critical stuff that needs to run approx 1 / 10 seconds #if MQTT - MQTTclient.publish(MQTTprefix + "/ESPUptime", esp_timer_get_time() / 1000000, false, 0); - MQTTclient.publish(MQTTprefix + "/WiFiRSSI", String(WiFi.RSSI()), false, 0); + if (seconds++ >= 9) { + seconds = 0; + MQTTclient.publish(MQTTprefix + "/ESPUptime", esp_timer_get_time() / 1000000, false, 0); + MQTTclient.publish(MQTTprefix + "/WiFiRSSI", String(WiFi.RSSI()), false, 0); + } #endif }