Files
esphome-yambms/packages
Sleeper85 fcbe5023af Suspend the charging logic while no BMS is combined
The STEP 3 guard tested its values with has_state(), which ESPHome sets on
every publication, NaN included. STEP 2 publishes NaN when no BMS is
combined, so STEP 3 ran on every tick of a boot or a BMS dropout. The
charging logic then saw "Charging allowed" false and set the status to
Wait, and the Init/Wait -> Bulk rebulk rule restarted a Bulk on a full
battery as soon as the BMS came back.

- The guard follows the can_be_combined rules: isnan() or a comparison
  for sensors, has_state() for binary sensors. It reads the live
  var_to_combine_bms_counter rather than bms_combined, which STEP 2 only
  publishes once per round.
- The inner "At least one BMS combined" check is removed: the guard is
  now the single test. CVL, DVL, CCL, DCL and Requested Force Charge
  move up one level.
- A new else branch suspends the logic: var_charge_status keeps its
  value, the instructions and requested values are cleared for Home
  Assistant, and var_initialized is set to false.
- The end of STEP 3 no longer tests bms_combined and total_voltage,
  already guaranteed by the guard.

This fixes the dropout case of #343. A BMS that blocks charging while
combined still goes through Wait.

Charging_logic documents the BMS dropout behaviour, Design_decisions the
guard and its else branch.

Refs #343
2026-11-11 00:20:09 +01:00
..