194 Commits
Author SHA1 Message Date
Sebastian 61424486c0 Round daily energy sensors to 10 Wh (#339)
Daily Charging/Discharging Energy (YamBMS and per BMS) were published
with 1 Wh resolution. Home Assistant records every float change, so a
new state was written every few seconds while charging or discharging.

- Add a round: 2 filter and set accuracy_decimals to 2 (0.01 kWh).
- bms_base_daily_energy 1.1.4, changelog updated.
2026-11-08 23:08:34 +01:00
Sleeper85 58c03ac83f Packages: Declare each CAN node in the package that consumes it
yambms_canbus.yaml and the Deye top packages now import their node from
canbus_platform (esp32_can, mcp2515 or external). canbus_bitrate replaces
esp32_canbus_bitrate and mcp2515_canbus_bitrate. Breaking change.
2026-11-08 23:08:34 +01:00
Sleeper85 e3f35aedb0 Packages: Declare each UART in the package that consumes it
Each package now imports its UART from its *_uart_id var and keeps its own baud
rate key. WK2168 channels work the same way, uart_flow_control_pin replaces the
flow control include, and min_version moves to 2026.10.0. Breaking change.
2026-11-08 23:08:34 +01:00
Sleeper85 5c171aea14 Docs: Explain the 0 A limit in the combiner
Document why the combiner accepts 0 A as a valid charge and discharge limit.
2026-11-08 23:08:34 +01:00
Sleeper85 668b50d7a0 Set YamBMS version to 1.8.1 2026-11-08 23:08:33 +01:00
Sebastian c7e498d5ca Improve Deye support (#337)
* Fix Deye power update interval
* Keep batteries the report CCL/DCL 0A

A battery that reports a charge limit (CCL) or discharge limit (DCL) of 0 A now stays in the combine. Before, a full Deye at 0 A CCL, or an empty one at 0 A DCL, dropped out of capacity, SoC and the totals.

- Missing values are still caught: a CCL or DCL with no value yet still fails >= 0, because comparisons with NaN are always false.
- No effect on the limits: CCL and DCL are added up, so a battery at 0 A adds 0 A to the total.
- All BMS models are affected

https://github.com/Sleeper85/esphome-yambms/issues/335
2026-11-08 23:08:33 +01:00
Sleeper85 abcc715d33 BMS: PACE word_from_hex_str moved to modbus::helpers (ESPHome 2026.10) 2026-11-08 23:08:33 +01:00
Sleeper85 35332227a4 BMS: PACE Modbus compatibility with ESPHome 2026.10 #332 2026-11-08 23:08:33 +01:00
Sebastian 4a23cb6b47 BMS: Fix sensor device_class and state_class (#331)
Several sensors had a device_class that did not match their unit, so
Home Assistant shows warnings and handles them wrongly (unit
conversion, statistics).

- Power sensors in W used device_class 'current'; now 'power'
  (BASEN RS485, DEYE CAN module full/minimal, FAKE).
- Ah sensors had a device_class that does not accept Ah ('battery',
  'energy', 'energy_storage'). Removed it, since Home Assistant has no
  device_class for Ah (BASEN RS485, DEYE CAN module/top full/minimal,
  JK RS485 Display, Modbus client).
- DEYE battery capacity used state_class 'total_increasing', but the
  value is not a counter. Changed to 'measurement'.
2026-11-08 23:08:33 +01:00
Sleeper85 0fb9cc8116 Refresh 60min 2026-11-08 23:08:33 +01:00
Sleeper85 7d00721dfe Charging cycles published 0 instead of NaN when no BMS is combined
bms_base_charging_cycles.yaml coerced a NaN raw reading to 0 before adding
the user offset, instead of letting NaN propagate like the sensors fixed
in dee203e4 ("Sensors published to NAN when no BMS is combined"). *_raw is
NaN until the first trusted BMS frame arrives after a reboot, so both
`charging cycles` and `total charging cycle capacity` published a literal
0 during that transient - with `state_class: total`, that 0 also landed
in Home Assistant's long-term statistics.

Fix is to drop the two `if (isnan(...)) = 0;` coercions and let
`NaN + offset == NaN` propagate, so both sensors go unavailable through
the transient instead of reporting 0.

Both sensors also moved from `or: [throttle: 10s, delta: 1]` to the
NaN-safe rate-limit filter already used throughout yambms_core.yaml, since
the built-in `delta` filter drops a NaN transition without updating its
reference and would otherwise freeze the sensor on its last value for up
to 10s.

That filter is extracted from yambms_core.yaml into
packages/base/device_base.yaml, which every node loads via its board_*.yaml
regardless of whether it runs the YamBMS engine - unlike yambms_core.yaml,
which is absent from a multi-node Modbus-server node that only exposes
BMS/Shunt packages. Renamed yambms_rate_limit_filter to rate_limit_filter
now that it is no longer engine-specific.
2026-11-08 23:08:33 +01:00
Sleeper85 9dd22fa56b Inferred equalizing for BMS that do not report a balancing flag
Some BMS balance their cells but never expose a balancing flag, so
`bms_equalizing` stays false and the core cannot tell a pack that is still
balancing from one that has finished. This is not cosmetic : while
equalizing is true, yambms_core.yaml stops the Cut-Off timer and lets the
charge run to the EOC timer instead of terminating early.

bms_options_fake_equalizing.yaml infers that flag from the pack itself. No
absolute cell voltage is hardcoded : the anchor is bulk_voltage / cell
count, the same derivation as cell_bulk_v in yambms_core.yaml, so it
follows `yambms_battery_chemistry`, the cell count and the configured bulk
voltage automatically.

  START when BOTH are true
    max cell >= cell_bulk_v                     the pack is at the setpoint
    AND (max - min) >= trigger voltage          its own balancing threshold

  STOP when EITHER is true
    max cell <  cell_bulk_v - hysteresis        the pack dropped off the setpoint
    OR (max - min) <  trigger - delta hyst.     the spread closed back below it

Only two deltas and one offset are configurable, and none of the three
depends on the chemistry - LFP, Li-ion and LTO all want the same few tens
of mV. The absolute anchor they hang off comes from the core, for free.

The delta condition is what keeps this honest : a pack that reaches the
setpoint perfectly balanced has nothing to equalize, so it reports false
and the Cut-Off timer does its job. A plain voltage comparison would report
balancing forever and terminate every charge on the EOC timer.

It extends bms<id>_bms_equalizing, the raw BMS flag, and not the combined
bms<id>_equalizing sensor. bms_base_balancer.yaml is therefore neither
modified nor duplicated, and keeps giving an external balancer priority
whenever one is online : the inference only applies when no balancer
reports for this pack.

This commit only adds the package. Nothing includes it yet, so no existing
configuration changes behaviour. Candidates sharing the same case are
Seplos V3, Seplos V1/V2, EG4 LL V2 and JK RS485 DISPLAY, whose
bms_equalizing is a hardcoded `return false;`.
2026-11-08 23:08:33 +01:00
Sleeper85 0783bc8ab0 Added battery_capacity number 2026-11-08 23:08:33 +01:00
Sleeper85 cb3b0eedba Installed Battery Capacity now follows a capacity change at runtime
The installed total was accumulated once per BMS per boot, latched by
bms<id>_combined_once, so a BMS reconfigured with a different capacity
kept contributing its boot value until the next reboot.

Each BMS now remembers the last capacity it contributed in
bms<id>_installed_capacity and applies only the difference to the total.

- the update runs in the can_be_combined branch, so an offline BMS simply
  stops updating its contribution, which stays in the total : the installed
  capacity still never shrinks on an uncombine, as before
- a BMS coming back with a different capacity is applied as a delta, with
  no double counting
- combined_once had no other reader and is removed

The total is deliberately not turned into a per-round accumulator reset in
the Global vars reset block like the other totals : its sensor is polled
independently of STEP 2 and its state is written straight into CAN frame
0x379 with no has_state() guard, so a transient zero would announce 0 Ah of
installed capacity to the inverter. See Design_decisions.md.
2026-11-08 23:08:33 +01:00
Sleeper85 39febc31d4 Support of the new errors_bitmask_hex from JK-BLE 2026-11-08 23:08:33 +01:00
Sleeper85 0f7bf94111 Added KS BMS support #151 2026-11-08 23:08:33 +01:00
Andrew Rankin 40daa229b5 Update EG4 LL-V2 component to v1.1.0 (fixes zero-value BMS readings) (#315)
* Update EG4 LL-V2 component to v1.1.0

Fixes RAR/esphome-eg4-bms#7: some EG4 LL-V2 units intermittently answer
with a CRC-valid function-03 response whose register data area is
entirely zero. The component published those zeroes as a real reading,
collapsing SoC, pack voltage and capacity for one poll cycle.

v1.1.0 rejects implausible blocks and no longer lets them refresh the
online tracker, so a unit stuck returning zeroes now goes offline
instead of reporting a flat-zero battery.

No YamBMS-side changes are required: neither EG4 package uses the
removed designed_capacity sensor, and both already use the
cell_average_voltage key.
2026-11-08 23:08:32 +01:00
Sleeper85 fa9f101d1b Move vars bms_model & bms_protocol 2026-11-08 23:08:32 +01:00
Sleeper85 31314847d9 YamBMS core 1.8.0 - CVL, CCL and DCL code improvements 2026-11-08 23:08:32 +01:00
Sleeper85 9b2787ecca Improved PACE BMS modbus (esphome >= 2026.7.0) 2026-11-08 23:08:32 +01:00
Sleeper85 c82af08d3c Updated multi-node modbus default settings + documentation #310 2026-11-08 23:08:32 +01:00
Sleeper85 cd385bc462 Removal of max_dishcarge_current limit (processed in yambms_core) 2026-11-08 23:08:31 +01:00
Sleeper85 277cfd49bc Compliance with esphome PR_11969 (modbus_server send_wait_time) 2026-07-11 00:29:11 +02:00
Sleeper85 7d76d7c991 Compliance with esphome 2026.6.0 (modbus_server) 2026-07-11 00:16:36 +02:00
Sleeper85 69ac0294e1 Compliance with esphome PR_11781 (modbus_controller) 2026-07-11 00:05:53 +02:00
Sleeper85 f186f53da3 Uncomment cell balancing trigger voltage name 2026-07-02 11:37:46 +02:00
Sleeper85 ef06261150 Fixed ${yambms_id} 2026-06-29 16:07:07 +02:00
Sleeper85 3da758fe00 Fixed yambms_id 2026-06-29 12:21:16 +02:00
Sleeper85 9bcb4d7177 New yambms_id format 2026-06-28 00:09:39 +02:00
Sleeper85 683499c8d7 Alignment of sensor names for component JK V3 2026-06-22 16:16:06 +02:00
Sleeper85 bee5abec64 Using a fake sensor instead of errors_bitmask_hex 2026-06-20 00:15:26 +02:00
Sleeper85 3d1ea45eb6 JK BLE - Sync latest changes from @syssi git 2026-06-18 23:40:19 +02:00
Sleeper85 f117319007 Improved Sub-Devices and entity names 2026-03-24 00:37:48 +01:00
Sebastian be772ab1fc Throttle/filter BMS sensors (#242) 2026-03-16 17:52:54 +01:00
Sleeper85 ef5bd4a45e Updated Current min_value 2026-03-07 18:38:17 +01:00
Sebastian 0817a13485 Add fault registry calls to Modbus clients (#239) 2026-02-19 23:54:28 +01:00
Sebastian 1969f14892 Basen: Add "Enable communication" switch (#235)
Add switch to enable/disable communication with Basen BMS. For example
this can be used during maintenance to disable communication with the
selected battery.
2026-02-16 21:01:05 +01:00
Sleeper85 040da87739 Set SEPLOS V3 extended as the default version #216 2026-02-16 15:18:29 +01:00
Andrew Rankin 500d7fa8f6 Add Ecoworthy BMS integration for YamBMS (#199) 2026-02-15 22:49:43 +01:00
Sleeper85 247643195b Create bms_combine_DEMO.yaml 2026-02-15 13:33:09 +01:00
Sleeper85 f70359c0a8 SEPLOS V3 extended version 2026-02-13 16:15:19 +01:00
Sleeper85 7bf602fd1c Added BMS FAKE extended 2026-02-11 15:58:59 +01:00
Sleeper85 b486f34a06 Create bms_demo_charge_simulation.yaml 2026-02-11 02:06:04 +01:00
Sleeper85 b4ff48d377 New BMS FAKE automated 2026-02-11 02:05:53 +01:00
Sleeper85 16937f9e1f Added missing unit_of_measurement 2026-02-10 08:55:27 +01:00
Sleeper85 5ed95b0db9 Updated switch id name 2026-02-07 17:17:37 +01:00
Sleeper85 29a0fe1dee Update bms_options_charging_logic.yaml 2026-02-07 13:53:23 +01:00
Sleeper85 57f256a71d Modbus packages update for testing modbus dev PRs 2026-02-06 16:59:49 +01:00
Sebastian 0b52365492 Clamp Modbus client sensors to reasonable values (#209) 2026-02-06 16:08:28 +01:00
Sebastian 80d5c9ab39 JK-BMS: Add temperature configuration (#205) 2026-02-06 00:30:59 +01:00