Skip to content

Commit

Permalink
do not publish live data for broken MPPT controllers
Browse files Browse the repository at this point in the history
in case the user defines the respective pins, an MPPT controller will be
setup and the websocket would previously publish its invalid data even
if no data at all was received. this lead to using an invalid index and
to publish a useless card. instead, skip those controllers.

if the connection to a controller breaks, it will always present as a
card in the live view with the respective serial number and the last
known data.
  • Loading branch information
schlimmchen committed Mar 23, 2024
1 parent 0154da9 commit 1fb2d42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/WebApi_ws_vedirect_live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ void WebApiWsVedirectLiveClass::generateJsonResponse(JsonVariant& root, bool ful

VeDirectMpptController::spData_t &spMpptData = spOptMpptData.value();

const JsonObject &nested = array.createNestedObject(spMpptData->SER);
String serial(spMpptData->SER);
if (serial.isEmpty()) { continue; } // serial required as index

const JsonObject &nested = array.createNestedObject(serial);
nested["data_age_ms"] = VictronMppt.getDataAgeMillis(idx);
populateJson(nested, spMpptData);
_lastPublish = millis();
Expand Down

0 comments on commit 1fb2d42

Please sign in to comment.