From 8073810b04b820b7458a08eb7b683577fdd14960 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 29 Jun 2026 20:26:23 +0200 Subject: [PATCH] Adjust Rebulk SoC if higher than target SoC With Automatic SoC Limit Mode set to Float and Rebulk SoC >= Automatic SoC Limit it won't work as expected because Rebulk SoC takes priority and switches to Bulk. This was reported in the forum: https://diysolarforum.com/threads/yambms-jk-bms-can-with-new-cut-off-charging-logic-open-source.79325/page-294#post-1848293 When Rebulk SoC >= Automatic SoC Limit and Automatic SoC Limit is enabled, set Rebulk SoC to Automatic SoC Limit - Auto SoC Limit Hysteresis - 5%. For example: Rebulk SoC = 85%, Automatic SoC Limit = 80%, Auto SoC Limit Hysteresis = 5% would result in Rebulk SoC = 70%. --- packages/yambms/yambms_auto_soc_limit.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/yambms/yambms_auto_soc_limit.yaml b/packages/yambms/yambms_auto_soc_limit.yaml index 1366b2a..a7caa80 100644 --- a/packages/yambms/yambms_auto_soc_limit.yaml +++ b/packages/yambms/yambms_auto_soc_limit.yaml @@ -1,5 +1,5 @@ -# Updated : 2026.06.27 -# Version : 1.1.5 +# Updated : 2026.06.29 +# Version : 1.1.6 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -188,6 +188,18 @@ interval: last_execution_ms = current_ms; + // Rebulk SoC must be lower than target SoC + if (id(yambms${yambms_id}_rebulk_soc).state >= id(yambms${yambms_id}_auto_soc_limit).state) { + // Set Rebulk SoC to Automatic SoC Limit - Auto SoC Limit Hysteresis - 5% + float new_rebulk_soc = id(yambms${yambms_id}_auto_soc_limit).state - id(yambms${yambms_id}_auto_soc_hysteresis).state - 5; + // Clamp to 0 + if (new_rebulk_soc < 0) { + new_rebulk_soc = 0; + } + id(yambms${yambms_id}_rebulk_soc).publish_state(new_rebulk_soc); + ESP_LOGW("yambms_debug", "Auto SoC Limit: Rebulk SoC must be lower than target SoC, adjusting Rebulk SoC"); + } + // Only work in Bulk or Float mode if (id(yambms${yambms_id}_var_charge_status) != "Bulk" && id(yambms${yambms_id}_var_charge_status) != "Float") { id(yambms${yambms_id}_var_auto_soc_limit) = 0;