From 6a5b129048f77a0f1529007853a53a0e46457b0b 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 | 2 ++ webapp/src/locales/en.json | 2 ++ webapp/src/locales/fr.json | 2 ++ 6 files changed, 24 insertions(+) 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 2a539af79..75b332a81 100644 --- a/src/WebApi_ws_vedirect_live.cpp +++ b/src/WebApi_ws_vedirect_live.cpp @@ -195,6 +195,16 @@ void WebApiWsVedirectLiveClass::populateJson(const JsonObject &root, const VeDir output["SBSTemperature"]["u"] = "°C"; output["SBSTemperature"]["d"] = "0"; } + 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 6bf5f9776..ae13e2c11 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -188,6 +188,8 @@ "V": "Spannung", "I": "Strom", "E": "Effizienz (berechnet)", + "AbsorptionVoltage": "Absorptionsspannung", + "FloatVoltage": "Erhaltungsspannung", "SBSTemperature": "SBS Temperatur" }, "section_input": "Eingang (Solarpanele)", diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index 2ade82335..5e76c52ff 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -188,6 +188,8 @@ "V": "Voltage", "I": "Current", "E": "Efficiency (calculated)", + "AbsorptionVoltage": "Absorption voltage", + "FloatVoltage": "Float voltage", "SBSTemperature": "SBS temperature" }, "section_input": "Input (Solar Panels)", diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index 58e157962..37e107ac1 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -188,6 +188,8 @@ "V": "Voltage", "I": "Current", "E": "Efficiency (calculated)", + "AbsorptionVoltage": "Absorption voltage", + "FloatVoltage": "Float voltage", "SBSTemperature": "SBS temperature" }, "section_input": "Input (Solar Panels)",