Add support for Rebulk Days (#259)

This adds `Rebulk Days` which specify the number of days since last full charge to enter `Bulk` again. It works like `Rebulk SoC` or `Rebulk V.` and can be disabled by setting it to 0 days.
This commit is contained in:
Sebastian authored and GitHub committed 2026-03-16 17:38:28 +01:00
1 parent 3b7238f3c7
commit 62791addde
9 files changed
+82 -5

No files matched your search

@@ -345,6 +345,8 @@ views:
name: Rebulk SoC
- entity: number.yambms_demo_yambms_1_rebulk_v
name: Rebulk V.
- entity: number.yambms_demo_yambms_1_rebulk_days
name: Rebulk Days
- entity: switch.yambms_demo_yambms_1_force_bulk_top_bal
name: Force Bulk (top bal)
title: YamBMS - ReBulk
@@ -307,6 +307,8 @@ views:
name: Rebulk SoC
- entity: number.yambms_yambms_1_rebulk_v
name: Rebulk V.
- entity: number.yambms_yambms_1_rebulk_days
name: Rebulk Days
- entity: switch.yambms_yambms_1_force_bulk_top_bal
name: Force Bulk (top bal)
title: YamBMS - ReBulk
@@ -307,6 +307,8 @@ views:
name: Rebulk SoC
- entity: number.yambms_yambms_1_rebulk_v
name: Rebulk V.
- entity: number.yambms_yambms_1_rebulk_days
name: Rebulk Days
- entity: switch.yambms_yambms_1_force_bulk_top_bal
name: Force Bulk (top bal)
title: YamBMS - ReBulk
@@ -307,6 +307,8 @@ views:
name: Rebulk SoC
- entity: number.yambms_yambms_1_rebulk_v
name: Rebulk V.
- entity: number.yambms_yambms_1_rebulk_days
name: Rebulk Days
- entity: switch.yambms_yambms_1_force_bulk_top_bal
name: Force Bulk (top bal)
title: YamBMS - ReBulk
@@ -307,6 +307,8 @@ views:
name: Rebulk SoC
- entity: number.yambms_yambms_1_rebulk_v
name: Rebulk V.
- entity: number.yambms_yambms_1_rebulk_days
name: Rebulk Days
- entity: switch.yambms_yambms_1_force_bulk_top_bal
name: Force Bulk (top bal)
title: YamBMS - ReBulk
+4 -2
View File
@@ -79,7 +79,8 @@ The `Requested Discharge Voltage` is the `UVP + 0.2` value of your BMS multiplie
![Image](../../images/YamBMS_ReBulk.png "YamBMS_ReBulk")
There are two parameters to start a new `Bulk` phase. You can set a `Rebulk SoC` or a `Rebulk V.` value, only one of these conditions must be met.
There are three parameters to start a new `Bulk` phase. You can set a `Rebulk SoC`, a `Rebulk V.` value or the `Rebulk Days` (since last full charge), only one of these conditions must be met.
`Rebulk Days` can be disabled by setting them to `0`.
If needed you can also force a `Bulk` charge with the `Force Bulk (top bal)` switch. The switch will automatically deactivate when your cells enter the `Balancing` phase.
@@ -215,7 +216,8 @@ There are some configuration options to adjust the behaviour:
The text sensor `Auto SoC Limit Status` will show the current status of the function:
- `Stop: Disabled`: Function is disabled.
- `Stop: Force Bulk active`: The `Force Bulk` switch is enabled.
- `Stop: Force Bulk active`: The `Force Bulk` switch is enabled, this function will not be enabled
- `Stop: Rebulk Days active`: `Rebulk Days` is `> 0` and last full charge was longer ago than the specified number of days, this function will not be enabled.
- `Stop: Not in Bulk/Float`: Charging status is not `Bulk` or `Float`, this function will not be enabled during `Cut-Off` or `Balancing`.
- `Stop: SoC limit reached`: The configured `SoC` limit was reached.
- `Wait: Reactivating at xx%`: The configured `SoC` limit was reached, now it waits until the SoC goes down to `Auto SoC Limit` - `Auto SoC Hysteresis`.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 27 KiB

+12 -2
View File
@@ -1,5 +1,5 @@
# Updated : 2026.03.12
# Version : 1.1.2
# Updated : 2026.03.14
# Version : 1.1.3
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -161,6 +161,16 @@ interval:
return;
}
// Check if Rebulk Days is active
if (id(${yambms_id}_var_rebulk_days_active)) {
// If Rebulk Days is active, we should not limit charge current or switch to Float
id(${yambms_id}_var_auto_soc_limit) = 0;
id(${yambms_id}_auto_soc_limit_status).publish_state("Stop: Rebulk Days active");
id(${yambms_id}_var_auto_soc_target_reached) = false;
id(${yambms_id}_var_charge_current_step)++;
return;
}
// Update in 60s intervals only
static uint32_t last_execution_ms = 0;
uint32_t current_ms = millis();
+56 -1
View File
@@ -1,4 +1,4 @@
# Updated : 2026.03.11
# Updated : 2026.03.14
# Version : 1.7.0
# GitHub : https://github.com/Sleeper85/esphome-yambms
@@ -302,6 +302,10 @@ globals:
type: time_t
restore_value: true
initial_value: ''
- id: ${yambms_id}_var_rebulk_days_active
type: bool
restore_value: no
initial_value: 'false'
# Execute once
esphome:
@@ -708,6 +712,36 @@ interval:
float cell_rebulk_v = (id(${yambms_id}_rebulk_voltage).state / id(${yambms_id}_cell_count).state);
float max_cell_v = id(${yambms_id}_max_cell_voltage).state;
// +-----------------------------------------------+
// | Rebulk after N days since last full charge |
// +-----------------------------------------------+
int rebulk_days = (int)id(${yambms_id}_rebulk_days).state;
if (rebulk_days == 0) // Function disabled
{
id(${yambms_id}_var_rebulk_days_active) = false;
}
else if (!id(${yambms_id}_var_rebulk_days_active)) // Function enabled
{
if (rebulk_days > 0)
{
time_t last_eoc = id(${yambms_id}_var_eoc_timestamp);
if (last_eoc > 0)
{
// Round down to 00:00:00 so rebulk gets enabled early in the day
struct tm *eoc_tm = localtime(&last_eoc);
eoc_tm->tm_hour = 0; eoc_tm->tm_min = 0; eoc_tm->tm_sec = 0;
time_t last_eoc_day = mktime(eoc_tm);
time_t now = id(my_time).utcnow().timestamp;
float days_since_eoc = (float)(now - last_eoc_day) / 86400.0f;
if (days_since_eoc >= rebulk_days)
{
id(${yambms_id}_var_rebulk_days_active) = true;
ESP_LOGD("yambms_debug", "Rebulk after %d days since last full charge: activating rebulk logic", rebulk_days);
}
}
}
}
// +-----------------------------------------------+
// | Force Bulk Logic |
// +-----------------------------------------------+
@@ -732,6 +766,9 @@ interval:
// SoC <= 85% (default value)
else if (id(${yambms_id}_battery_soc).state <= id(${yambms_id}_rebulk_soc).state)
id(${yambms_id}_var_charge_status) = "Bulk";
// Rebulk Days >= 14 (default value)
else if (id(${yambms_id}_var_rebulk_days_active) == true)
id(${yambms_id}_var_charge_status) = "Bulk";
// Force Charge requested
else if (id(${yambms_id}_requested_force_charge).state)
id(${yambms_id}_var_charge_status) = "Bulk";
@@ -1037,6 +1074,8 @@ script:
else id(${yambms_id}_var_charge_status) = "EOC";
id(${yambms_id}_var_eoc) = true; // SOC 100% can be sent
id(${yambms_id}_var_eoc_timestamp) = id(my_time).utcnow().timestamp; // Store charge completion timestamp
id(${yambms_id}_var_rebulk_days_active) = false; // Rebulk after N days logic reset
@@ -1188,6 +1227,22 @@ number:
icon: mdi:battery-medium
optimistic: true
entity_category: config
- platform: template
name: "${name} ${yambms_name} Rebulk Days"
id: "${yambms_id}_rebulk_days"
step: 1
min_value: 0
max_value: 30
restore_value: true
mode: "${yambms_input_number_mode}"
initial_value: 14
unit_of_measurement: days
icon: mdi:calendar-refresh
optimistic: true
entity_category: config
on_value:
then:
- lambda: id(${yambms_id}_var_rebulk_days_active) = false;
- platform: template
name: "${name} ${yambms_name} Inverter Offset V."
id: "${yambms_id}_inverter_offset_v"