From 78e8b219770da088c07fac675b019e0d476a53f3 Mon Sep 17 00:00:00 2001 From: Sleeper85 Date: Tue, 13 Jan 2026 18:57:42 +0100 Subject: [PATCH] Dual counter for entering and exiting the `Cut-Off` phase --- packages/yambms/yambms_core.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/yambms/yambms_core.yaml b/packages/yambms/yambms_core.yaml index 7920277..acf2d50 100644 --- a/packages/yambms/yambms_core.yaml +++ b/packages/yambms/yambms_core.yaml @@ -1,4 +1,4 @@ -# Updated : 2025.12.30 +# Updated : 2026.01.13 # Version : 1.6.0 # GitHub : https://github.com/Sleeper85/esphome-yambms @@ -641,6 +641,7 @@ text_sensor: float current = id(${yambms_id}_current).state; float cutoff_resistance = ((cv_max - cv_min) / id(${yambms_id}_battery_capacity).state / 0.05); static int cutoff_counter = 0; + static int bulk_counter = 0; // +-----------------------------------------------+ // | Cut-Off Charging Logic | @@ -650,9 +651,15 @@ text_sensor: float cutoff_voltage = (max_cell_v - cutoff_resistance * current); if(cutoff_voltage > cv_min) + { cutoff_counter++; + bulk_counter = 0; + } else + { + bulk_counter++; cutoff_counter = 0; + } // Entering the Cut-Off phase // The criteria check must succeed 5 times in a row to ensure @@ -686,7 +693,9 @@ text_sensor: id(${yambms_id}_script_cutoff_timer).execute(); } // Continue charging - else + // The criteria check must succeed 5 times in a row to ensure + // that these are not random/erroneous/false readings of the BMS + else if (bulk_counter > 4) { // Stop timer if (id(${yambms_id}_script_eoc_timer).is_running()) id(${yambms_id}_script_eoc_timer).stop();