Commit Graph
803 Commits
Author SHA1 Message Date
Sleeper85 d2001d8394 Docs: Add the hub daily energy fix (#336) to the 1.8.1 changelog 2026-11-08 23:11:30 +01:00
MrPabloUK 2e21aa73c0 Fix hub daily energy by publishing 0 W on the unused charge/discharge sign (#336)
- Hub `battery_charging_power` / `battery_discharging_power` left the unused sign as NAN, while the shunt already publishes 0 W.
- ESPHome `total_daily_energy` (`method: right`) skips NAN without advancing `last_update_`, so the next finite watt is multiplied by the whole gap (for example a charge spike after a long discharge).
- Publish 0 W on the unused sign (and when power is NAN / no BMS is combined) so both daily meters keep integrating.
2026-11-08 23:11:30 +01:00
Sleeper85 b3af7e89a9 YamBMS 1.8.1 DEMO firmware 2026-11-08 23:08:34 +01:00
Sleeper85 1cf367f333 Docs: Add the 1.8.1 upgrade guide and complete the changelog
New Changelog_upgrade_to_YamBMS_1.8.1.md: a short step-by-step guide to
move a 1.7.0 or 1.8.0 YAML to 1.8.1, starting from the example YAML. It
covers the biggest changes (inverter brand, UART and CAN declared by the
packages, RS485 entry point, C-Rate defaults, CCL/DCL divided by the
number of declared links), CAN and RS485 examples with the valid UART
ids, the inverter brand selection, the 1.8.1 dashboard, the common
validation errors and the PVbrain2 board files.

Changelog.md: link the new documentation pages and the 1.8.1 dashboards,
and list the remaining 1.8.1 changes (services and telemetry, Auto CCL,
0 A limits, fixes and merged PRs).
2026-11-08 23:08:34 +01:00
Sleeper85 faad9e60ce YamBMS 1.8.1 LP/RP examples
Update the root YAML and the examples for the UART and CAN declarations, the
RS485 block and the Board Options section.
2026-11-08 23:08:34 +01:00
Sleeper85 cab5a63e0e Docs: Rewrite the inverter brand and protocol section
Lead with the three setup steps: select the inverter brand, leave
Protocol on Automatic, then configure the inverter from the dashboard.
Forcing a protocol moves to its own subsection, as the exception it is.

The screenshot now shows the brand and protocol selects and the active
protocol card, and replaces YamBMS_CANBUS_Protocol.png.
2026-11-08 23:08:34 +01:00
Sleeper85 cb9638653d Docs: The CCL/DCL divider counts declared links
Document that every declared CAN or RS485 inverter link divides the requested
CCL/DCL, including a link whose protocol is `Disabled` or left on `Automatic`
with no brand, and that only links actually wired to an inverter should be
declared.

Design_decisions.md records why the divider must not be restricted to active
links: a disabled link usually still has an inverter drawing from the bank, an
unconfigured link is the state every link starts in after 1.8.0, and a lost
link must never raise the current sent to the remaining inverters.

YamBMS_functions.md: fix the RS485 package name (`yambms_rs485.yaml`).
2026-11-08 23:08:34 +01:00
Sleeper85 00e04df04b Docs: Add the Telemetry page and change the services URL
Replace the README Data collection section with Telemetry.md and point
the update and telemetry requests to script.yambms.org.
2026-11-08 23:08:34 +01:00
Sebastian a4844fc947 YamBMS: Auto EOC 24h charging window (#338)
Auto EOC assumed daylight charging: the target was always today and the
target hour was limited to 12-23, so a night window could not be planned.

- New Auto EOC Start Hour/Minute define the charging window from the
  start time to the next target time. It may cross midnight
  (e.g. 22:00 -> 06:00 for grid charging); start = target is 24h.
- Target hour can be set from 0 to 23.
- Outside the window the status is "Wait: Starts at hh:mm" instead of
  "Stop: Target time passed". The 1h grace period is unchanged and has
  priority over a window starting within it.
- Times are local and DST safe.
- Default start 00:00 keeps the previous daylight behaviour.
- Dashboards, docs and changelog updated.
2026-11-08 23:08:34 +01:00
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 7b750a4b35 Docs: Fix 1.8.1 changelog errors and discharge C-Rate comment 2026-11-08 23:08:34 +01:00
Sleeper85 a17fa3aea8 HA dashboards 1.8.1
Update the dashboard headers and show one more character of the ESPHome version.
2026-11-08 23:08:34 +01:00
Sleeper85 9203dd09f9 Docs: Add why_yambms and update the Cut-Off diagram
Explain why YamBMS is useful when the BMS already talks to the inverter, and
refresh the Cut-Off charging logic diagram.
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 ee12380087 YamBMS: Inverter brand registry and RS485 entry point
Rename the inverter registry to yambms_brand_registry.yaml and add the new brands.
yambms_rs485.yaml becomes the file to include, with a rs485_protocol var that
selects PYLON or Voltronic LIB.
2026-11-08 23:08:34 +01:00
Sleeper85 9febfa4161 Dashboards 1.8.1 2026-11-08 23:08:34 +01:00
Sleeper85 51cf3972ed Added RS485 Voltronic LIB protocol
Added RS485 Voltronic LIB protocol

Experimental support for Voltronic Power's own Modbus RTU protocol
(YB_PROTO_RS485_VOLTRONIC_LIB), distinct from Pylontech and confirmed by
an independent Epever cross-reference (PRO=26, same document authors).
Implemented natively via ESPHome's modbus_server rather than an external
component, since it's plain Modbus RTU unlike Pylontech's own framing.

Voltronic (Axpert/InfiniSolar) and MPP Solar share this protocol and are
added to both inverter brand selects - confirmed identical by MPP Solar's
own manual. Required splitting the RS485 entry point the other way round
(yambms_rs485_pylon.yaml/yambms_rs485_voltronic.yaml now include the
shared yambms_rs485.yaml, not the reverse) so a node can run a different
protocol on each RS485 link.

Scope is deliberately reduced to what the inverter firmware actually
honors: per Voltronic's own documentation only the charge voltage limit
is applied, so Auto CCL Current Taper and Auto Float have no effect
through this link - accurate SOC/telemetry and charge/discharge
enable/disable are the real value here. Unverified on real hardware.
2026-11-08 23:08:34 +01:00
Sleeper85 281d39ac18 New inverter brand select drives the CAN and RS485 protocol
BREAKING CHANGE: both inverter link selects are renamed, so their stored value is
reset. The link stays inactive until an inverter brand is selected. See
documents/README/changelog/Changelog_Inverter_brand_and_protocol.md

New `Inverter brand` select (16 brands) and reworked `Protocol` select, now
defaulting to `Automatic`. Selecting the brand is enough, the protocol follows;
an explicit protocol still takes priority over the brand.

The protocol is resolved once, at boot and on every select change, into
`canbus${canbus_id}_active_protocol` / `rs485${rs485_id}_active_protocol`.
Everything else reads that integer instead of dispatching on `active_index()`,
where `== 5` meant LuxPower purely by convention of the option order.

New shared `yambms_inverter_registry.yaml`: protocol dictionary (`YB_PROTO_*`),
brand to protocol mapping, and the battery mode and note of each couple.

Removed the `YamBMS name` select: the manufacturer name sent on CAN frame 0x35E
now derives from the protocol in use, which is what `Automatic` already did.

Removed the `canbus_extended_ack` substitution: both the 11-bit and the 29-bit
ACK triggers are registered, so the Schneider XW Pro needs no configuration.

Renamed CAN `PYLON 1.2` to `PYLON V1` and RS485 `Pylontech` to `PYLON`.

New per-link diagnostics `Inverter link protocol`, `Inverter battery mode` and
`Note`, with a markdown card in the dashboards, alongside a system fault card.

Telemetry: `comm_bus` / `comm_protocol` replaced by `inverter_brand`,
`inverter_bus`, `inverter_protocol` and `inverter_protocol_source`, one slot per
declared link instead of a single value overwritten by the last one.

RS485 packages split: `yambms_rs485.yaml` is the entry point carrying the selects,
`yambms_rs485_pylon.yaml` the protocol implementation. The baud rate is applied
with `set_baud_rate()` + `load_settings()` instead of extending the uart
component, so boards using a UART expander no longer need their own include.

Fixes:
- the CAN bus kept re-emitting the last frame every 100 ms when the protocol was
  set to `Disabled` at runtime
- the RS485 link kept answering the inverter with stale data on `Disabled`, the
  proxy sensors it reads are now invalidated
- a `Disabled` link no longer lights the fault LED, it is unregistered from the
  fault registry instead of being reported as failing
- the reported bus and protocol were overwritten when a node declares several
  inverter links
- changing the protocol restarts the CAN frames immediately instead of waiting up
  to 30 s for the next retry tick
2026-11-08 23:08:33 +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 0d56db9849 Board: Waveshare Touch-LCD backlight pin conflict (ESPHome 2026.10)
ESPHome 2026.10 fails to validate the Waveshare ESP32-S3 Touch-LCD 4.3,
4.3B and 7 boards with "Pin 2 is used in multiple places". The mipi_rgb
models now set ch422g pin 2 (backlight) as a default enable_pin, and
the board already uses that pin for backlight_output, which drives the
backlight light used by the LVGL designs to turn the screen off and on.

- Override enable_pin to leave out pin 2, so the backlight stays under
  light control: pin 6 only on the 7 board, none on the 4.3 and 4.3B.
- This matches what esphome/esphome#21605 will do automatically. The
  override can be removed once min_version includes that change.
2026-11-08 23:08:33 +01:00
Sleeper85 7c8abeec0a Set ESPHome min_version to 2026.10.0 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
Lewa-Reka 35e839f1fd Add CrowPanel Advanced (ESP32-P4) board and Blue Navy 1024x600 HA display (#322)
* add crowpanel board
* add blue navy layout 1024x600
2026-11-08 23:08:33 +01:00
Sebastian 14dd332412 YamBMS: Auto CCL smooths max cell voltage, minimum 1 A (#329)
Near the top of charge the Auto CCL curve is steep (about 3.5 A per mV
at 3.46 V/cell). The max cell voltage arrives only every 10-15 s in
1 mV steps and moves a few mV with the charge current. Each new reading
moved the target by 10-20 A. Cuts are applied at once and increases
ramp up, so the requested CCL swung between about 8 A and 45 A every
20-40 s.

- Smooth the max cell voltage used for the curve with a time-based
  moving average (auto_ccl_max_cell_v_tau, default 30 s, '0' disables).
- Safety guard: a raw reading more than auto_ccl_max_cell_v_guard
  (default 5 mV) above the average is used instead (minus the guard),
  so real voltage rises still cut the current at once.
- Add auto_ccl_min_current (default 1 A): Auto CCL never requests less,
  also above the end of its curve or with an invalid float/OVP setting.
  Other limits can still request 0 A.
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 3e596ea82a Reworked the update and telemetry services
- update and telemetry are now gated independently by substitution;
  var_service and its Update service switch are removed
- the uptime text sensor is published by its source instead of polling
  it, which fixes the 24855d readings that reached the telemetry, and
  the raw seconds are now sent instead of the formatted string
- the MAC address is replaced by a salted SHA-256, derived identically
  server side so no pairing window is needed
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 17360765d4 Update Changelog.md 2026-11-08 23:08:33 +01:00
Sleeper85 c9b7cf7b84 Set esphome min_version to 2026.8.0 2026-11-08 23:08:33 +01:00
Sleeper85 3bbb37eadf Added digest auth 2026-11-08 23:08:33 +01:00
Sleeper85 7fc55192c8 Updated Auto CVL changelog 1.8.0 2026-11-08 23:08:33 +01:00
Sleeper85 6973cee171 PVbrain2 board split into two DevKitC-1 pin variants
The DevKitC-1 swapped the RGB LED between V1.0 (GPIO 48) and V1.1 (GPIO 38),
and the freed pin is the one PVbrain2 uses for CAN TX. Both pins are therefore
board-revision dependent and cannot stay hardcoded in a single board file.

board_ESP32-S3_DevKitC-1_PVbrain2.yaml becomes the common base :
- tx_pin_4 / rx_pin_4 and the LED strip pin are removed from it
- esp_light now reads ${rgb_led_pin}
- GPLv3 header added, which was missing

Two thin wrappers provide the revision-specific pins and include the base :
- board_ESP32-S3_DevKitC-1_PVbrain2_LED-48.yaml : V1.0, LED 48 / CAN TX 38
- board_ESP32-S3_DevKitC-1_PVbrain2_LED-38.yaml : V1.1, LED 38 / CAN TX 48

YamBMS_LP_PVbrain2.yaml and YamBMS_RP_PVbrain2.yaml include the LED-48 variant,
the LED-38 line being commented right next to it.

Same split applied to the RS485 Pylontech package : the content moves to
yambms_rs485_pylon_core.yaml and yambms_rs485_pylon.yaml keeps only the uart
baud_rate extend, so PVbrain2 — whose board already declares the UART — can
include the core directly.

PCB LED 1 / PCB LED 2 / ESP32 LED are no longer prefixed by ${name}, and the
`name` substitution is added to the PVbrain2 root YAMLs.
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 bf044c159d Migrating canbus ESP_LOGI to ESP_LOGD 2026-11-08 23:08:33 +01:00
Sleeper85 1af8514863 LED capabilities detected at runtime, rgb_order migrated to channel_colors
board_options_led_control.yaml called set_brightness() unconditionally, so
every board whose status LED is a `binary` light logged
"'esp_light': brightness not supported" on each state change. Only the RGB
setter was guarded, by the per-board `board_has_rgb` substitution.

Both setters are now guarded by what the light itself reports:

    led->get_traits().supports_color_capability(...)

- `board_has_rgb` removed from 21 board files: its only two readers were the
  two lines in board_options_led_control.yaml
- the runtime test reproduces the flag exactly on every board - the 15 boards
  declaring "true" all drive an addressable strip (esp32_rmt_led_strip, or
  spi_led_strip on T-Connect), the 6 declaring "false" all drive a binary
  light - so RGB rendering is unchanged and only the warning disappears
- a monochromatic LED now gets brightness without RGB, which a single boolean
  could not express

Also migrated 16 `rgb_order: GRB` to `channel_colors: GRB`, deprecated in
ESPHome and removed in 2027.3.0. Same value, no behaviour change.
2026-11-08 23:08:33 +01:00
Sleeper85 e78df61e6f CRLF to LF conversion 2026-11-08 23:08:33 +01:00
Sleeper85 415f12d04f Enforce LF line endings for YAML files
A CRLF file rewritten by a Windows contributor shows up as a whole-file
diff, which hides the real change and conflicts on every rebase.
.gitattributes was itself listed in .gitignore, so it could never be
committed and protected nothing.
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
Sleeper85 b7bb2e93ea Moved Auto CCL Current Taper section 2026-11-08 23:08:33 +01:00
Sleeper85 e4b8aacc0a Fixed 6h reboot on networks that filter the ESP32 outbound traffic
http_request runs on the loop task, which has a 4s budget before the
5s task WDT panics. A dropped connect() blocks for 4.5s (the ESPHome
default timeout) and a filtered port 53 blocks for a fixed 7s, which
timeout does not cover.

- timeout 3s and watchdog_timeout 60s cover the two blocking paths
- a failure counter stops the service after 3 network-level failures,
  instead of freezing the loop 14s every 6h forever
- the POST is now skipped when the GET failed

Reproduced and measured on OPNsense.
See Design_decisions.md.
2026-11-08 23:08:33 +01:00
Sleeper85 9f90436849 Multi-inverter support, division of CCL/DCL by the number of inverters/chargers 2026-11-08 23:08:33 +01:00
Sleeper85 96ddd2a075 Fixed Combiner stall detector false positive and dashboards
The detector compared var_to_combine_bms/shunt_number with its value on
the previous round, but samples it before the STEP 2 reset - so in a
healthy setup the sampled value is identical every round and was read as
a stall ("Shunt id 2 of 1 declared").

Replaced by an exact completeness test: a chain is complete once its
number is past the number of declared devices. Threshold raised to 5
rounds to absorb interval phase offsets at boot.
2026-11-08 23:08:33 +01:00