From 6179b5f89309a4c14fb8a73ecd332dc65957fda4 Mon Sep 17 00:00:00 2001 From: SW-Nico Date: Thu, 24 Oct 2024 10:48:04 +0200 Subject: [PATCH] Add absorption and float voltage to live view, MQTT and HASS --- src/MqttHandleVedirect.cpp | 2 ++ src/MqttHandleVedirectHass.cpp | 6 ++++++ src/WebApi_ws_vedirect_live.cpp | 10 ++++++++++ webapp/src/locales/de.json | 4 +++- webapp/src/locales/en.json | 4 +++- webapp/src/locales/fr.json | 4 +++- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/MqttHandleVedirect.cpp b/src/MqttHandleVedirect.cpp index c244afc68..009519dd7 100644 --- a/src/MqttHandleVedirect.cpp +++ b/src/MqttHandleVedirect.cpp @@ -138,6 +138,8 @@ void MqttHandleVedirectClass::publish_mppt_data(const VeDirectMpptController::da PUBLISH_OPT(NetworkTotalDcInputPowerMilliWatts, "NetworkTotalDcInputPower", currentData.NetworkTotalDcInputPowerMilliWatts.second / 1000.0); PUBLISH_OPT(MpptTemperatureMilliCelsius, "MpptTemperature", currentData.MpptTemperatureMilliCelsius.second / 1000.0); + PUBLISH_OPT(BatteryAbsorptionMilliVolt, "BatteryAbsorption", currentData.BatteryAbsorptionMilliVolt.second / 1000.0); + PUBLISH_OPT(BatteryFloatMilliVolt, "BatteryFloat", currentData.BatteryFloatMilliVolt.second / 1000.0); PUBLISH_OPT(SmartBatterySenseTemperatureMilliCelsius, "SmartBatterySenseTemperature", currentData.SmartBatterySenseTemperatureMilliCelsius.second / 1000.0); #undef PUBLILSH_OPT } diff --git a/src/MqttHandleVedirectHass.cpp b/src/MqttHandleVedirectHass.cpp index 883705ad9..2d873ebcf 100644 --- a/src/MqttHandleVedirectHass.cpp +++ b/src/MqttHandleVedirectHass.cpp @@ -95,6 +95,12 @@ void MqttHandleVedirectHassClass::publishConfig() if (optMpptData->MpptTemperatureMilliCelsius.first != 0) { publishSensor("MPPT temperature", "mdi:temperature-celsius", "MpptTemperature", "temperature", "measurement", "°C", *optMpptData); } + if (optMpptData->BatteryAbsorptionMilliVolt.first != 0) { + publishSensor("Battery absorption voltage", "mdi:battery-charging-90", "Absorption", "voltage", "measurement", "V", *optMpptData); + } + if (optMpptData->BatteryFloatMilliVolt.first != 0) { + publishSensor("Battery float voltage", "mdi:battery-charging-100", "Float", "voltage", "measurement", "V", *optMpptData); + } if (optMpptData->SmartBatterySenseTemperatureMilliCelsius.first != 0) { publishSensor("Smart Battery Sense temperature", "mdi:temperature-celsius", "SmartBatterySenseTemperature", "temperature", "measurement", "°C", *optMpptData); } diff --git a/src/WebApi_ws_vedirect_live.cpp b/src/WebApi_ws_vedirect_live.cpp index abf3376eb..50cfcd2a7 100644 --- a/src/WebApi_ws_vedirect_live.cpp +++ b/src/WebApi_ws_vedirect_live.cpp @@ -170,6 +170,16 @@ void WebApiWsVedirectLiveClass::populateJson(const JsonObject &root, const VeDir output["E"]["v"] = mpptData.mpptEfficiency_Percent; output["E"]["u"] = "%"; output["E"]["d"] = 1; + if (mpptData.BatteryAbsorptionMilliVolt.first > 0) { + output["AbsorptionVoltage"]["v"] = mpptData.BatteryAbsorptionMilliVolt.second / 1000.0; + output["AbsorptionVoltage"]["u"] = "V"; + output["AbsorptionVoltage"]["d"] = "2"; + } + if (mpptData.BatteryFloatMilliVolt.first > 0) { + output["FloatVoltage"]["v"] = mpptData.BatteryFloatMilliVolt.second / 1000.0; + output["FloatVoltage"]["u"] = "V"; + output["FloatVoltage"]["d"] = "2"; + } const JsonObject input = values["input"].to(); if (mpptData.NetworkTotalDcInputPowerMilliWatts.first > 0) { diff --git a/webapp/src/locales/de.json b/webapp/src/locales/de.json index 73543afe6..d9d590b51 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -175,7 +175,9 @@ "P": "Leistung (berechnet)", "V": "Spannung", "I": "Strom", - "E": "Effizienz (berechnet)" + "E": "Effizienz (berechnet)", + "AbsorptionVoltage": "Absorptionsspannung", + "FloatVoltage": "Erhaltungsspannung" }, "section_input": "Eingang (Solarpanele)", "input": { diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index e88adaacf..a26ed6192 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -175,7 +175,9 @@ "P": "Power (calculated)", "V": "Voltage", "I": "Current", - "E": "Efficiency (calculated)" + "E": "Efficiency (calculated)", + "AbsorptionVoltage": "Absorption voltage", + "FloatVoltage": "Float voltage" }, "section_input": "Input (Solar Panels)", "input": { diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index 1279a1bb8..e5de2d272 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -175,7 +175,9 @@ "P": "Power (calculated)", "V": "Voltage", "I": "Current", - "E": "Efficiency (calculated)" + "E": "Efficiency (calculated)", + "AbsorptionVoltage": "Absorption voltage", + "FloatVoltage": "Float voltage" }, "section_input": "Input (Solar Panels)", "input": {