From 7b55794247c45207d4a2637db2727969239a15c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Bo=CC=88hm?= Date: Sun, 18 Aug 2024 21:03:40 +0200 Subject: [PATCH 1/2] allow use of 'use battery at night' without vedirect --- src/PowerLimiter.cpp | 3 +-- src/WebApi_powerlimiter.cpp | 3 ++- webapp/src/views/PowerLimiterAdminView.vue | 20 +++++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/PowerLimiter.cpp b/src/PowerLimiter.cpp index 1c471a3dc..93f027b07 100644 --- a/src/PowerLimiter.cpp +++ b/src/PowerLimiter.cpp @@ -251,8 +251,7 @@ void PowerLimiterClass::loop() if (isStartThresholdReached()) { return true; } - if (config.PowerLimiter.SolarPassThroughEnabled && - config.PowerLimiter.BatteryAlwaysUseAtNight && + if (config.PowerLimiter.BatteryAlwaysUseAtNight && !isDayPeriod && !_batteryDischargeEnabled) { _nighttimeDischarging = true; diff --git a/src/WebApi_powerlimiter.cpp b/src/WebApi_powerlimiter.cpp index b28380d3c..b13bc0daa 100644 --- a/src/WebApi_powerlimiter.cpp +++ b/src/WebApi_powerlimiter.cpp @@ -153,7 +153,6 @@ void WebApiPowerLimiterClass::onAdminPost(AsyncWebServerRequest* request) if (config.Vedirect.Enabled) { config.PowerLimiter.SolarPassThroughEnabled = root["solar_passthrough_enabled"].as(); config.PowerLimiter.SolarPassThroughLosses = root["solar_passthrough_losses"].as(); - config.PowerLimiter.BatteryAlwaysUseAtNight= root["battery_always_use_at_night"].as(); config.PowerLimiter.FullSolarPassThroughStartVoltage = static_cast(root["full_solar_passthrough_start_voltage"].as() * 100) / 100.0; config.PowerLimiter.FullSolarPassThroughStopVoltage = static_cast(root["full_solar_passthrough_stop_voltage"].as() * 100) / 100.0; } @@ -173,6 +172,8 @@ void WebApiPowerLimiterClass::onAdminPost(AsyncWebServerRequest* request) config.PowerLimiter.IgnoreSoc = root["ignore_soc"].as(); config.PowerLimiter.BatterySocStartThreshold = root["battery_soc_start_threshold"].as(); config.PowerLimiter.BatterySocStopThreshold = root["battery_soc_stop_threshold"].as(); + config.PowerLimiter.BatteryAlwaysUseAtNight = root["battery_always_use_at_night"].as(); + if (config.Vedirect.Enabled) { config.PowerLimiter.FullSolarPassThroughSoc = root["full_solar_passthrough_soc"].as(); } diff --git a/webapp/src/views/PowerLimiterAdminView.vue b/webapp/src/views/PowerLimiterAdminView.vue index c87d8ffe5..65d38e8d5 100644 --- a/webapp/src/views/PowerLimiterAdminView.vue +++ b/webapp/src/views/PowerLimiterAdminView.vue @@ -105,6 +105,14 @@ wide /> + +
- - Date: Sun, 18 Aug 2024 22:07:43 +0200 Subject: [PATCH 2/2] allow 'use battery at night' when no battery is connected --- src/WebApi_powerlimiter.cpp | 3 +-- webapp/src/views/PowerLimiterAdminView.vue | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/WebApi_powerlimiter.cpp b/src/WebApi_powerlimiter.cpp index b13bc0daa..adea6105b 100644 --- a/src/WebApi_powerlimiter.cpp +++ b/src/WebApi_powerlimiter.cpp @@ -159,6 +159,7 @@ void WebApiPowerLimiterClass::onAdminPost(AsyncWebServerRequest* request) config.PowerLimiter.IsInverterBehindPowerMeter = root["is_inverter_behind_powermeter"].as(); config.PowerLimiter.IsInverterSolarPowered = root["is_inverter_solar_powered"].as(); + config.PowerLimiter.BatteryAlwaysUseAtNight = root["battery_always_use_at_night"].as(); config.PowerLimiter.UseOverscalingToCompensateShading = root["use_overscaling_to_compensate_shading"].as(); config.PowerLimiter.InverterId = root["inverter_serial"].as(); config.PowerLimiter.InverterChannelId = root["inverter_channel_id"].as(); @@ -172,8 +173,6 @@ void WebApiPowerLimiterClass::onAdminPost(AsyncWebServerRequest* request) config.PowerLimiter.IgnoreSoc = root["ignore_soc"].as(); config.PowerLimiter.BatterySocStartThreshold = root["battery_soc_start_threshold"].as(); config.PowerLimiter.BatterySocStopThreshold = root["battery_soc_stop_threshold"].as(); - config.PowerLimiter.BatteryAlwaysUseAtNight = root["battery_always_use_at_night"].as(); - if (config.Vedirect.Enabled) { config.PowerLimiter.FullSolarPassThroughSoc = root["full_solar_passthrough_soc"].as(); } diff --git a/webapp/src/views/PowerLimiterAdminView.vue b/webapp/src/views/PowerLimiterAdminView.vue index 65d38e8d5..96f51ed46 100644 --- a/webapp/src/views/PowerLimiterAdminView.vue +++ b/webapp/src/views/PowerLimiterAdminView.vue @@ -496,8 +496,7 @@ export default defineComponent({ }, canUseBatteryDischargeAtNight() { const cfg = this.powerLimiterConfigList; - const meta = this.powerLimiterMetaData; - return this.isEnabled() && meta.battery_enabled && !cfg.is_inverter_solar_powered; + return !cfg.is_inverter_solar_powered; }, canUseSolarPassthrough() { const cfg = this.powerLimiterConfigList;