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.
This commit is contained in:
Sleeper85 committed 2026-11-08 23:08:34 +01:00
1 parent 281d39ac18
commit 51cf3972ed
8 files changed
+334 -67

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@
* Fixed the CAN bus not stopping when the protocol was set to `Disabled` at runtime : the frame index kept its previous value and the last frame was re-emitted every 100 ms
* Fixed the reported communication bus and protocol being overwritten when a node declares several inverter links : each link now owns its slot, and the telemetry reports every link instead of the last one
* The RS485 baud rate is now applied at runtime with `set_baud_rate()` + `load_settings()` instead of extending the `uart` component : `uart: !extend` only works on a native ESP32 UART, so boards using a UART expander (`wk2168` on the PVbrain2) had to include an internal file to avoid it ; every board now includes the same entry point
* RS485 packages restructured for the upcoming additional protocols : `yambms_rs485_pylon.yaml` is split in two, `yambms_rs485.yaml` becoming the file you include (selects, diagnostics, UART) and `yambms_rs485_pylon.yaml` keeping only the PYLON protocol implementation ; `yambms_rs485_pylon_web_server.yaml` becomes `yambms_rs485_web_server.yaml`. Point your `!include` to the new entry point, see [release note](documents/README/changelog/Changelog_Inverter_brand_and_protocol.md)
* RS485 packages reorganised internally for the additional protocols to come : `yambms_rs485_pylon.yaml` **stays the file you include**, no change there ; its selects/diagnostics/UART machinery move out to a new shared `yambms_rs485.yaml` (replacing the old internal `yambms_rs485_pylon_core.yaml`), which `yambms_rs485_pylon.yaml` includes itself so that a node with several RS485 links on different UARTs can run a different protocol on each ; `yambms_rs485_pylon_web_server.yaml` becomes `yambms_rs485_web_server.yaml` and must now be included alongside the protocol file with its own `rs485_id`, instead of swapping one for the other, see [release note](documents/README/changelog/Changelog_Inverter_brand_and_protocol.md)
* YamBMS 1.8.0 :
* Set esphome `min_version` to `2026.8.0`
@@ -73,21 +73,18 @@ line from your YAML if you had set it.
## RS485 package files
`yambms_rs485_pylon.yaml` is **split in two**, to make room for the additional RS485 protocols to
come. The link itself and the protocol it speaks are now separate files:
`yambms_rs485_pylon.yaml` **stays the file you include** — no change there. Its internals are
reorganised to make room for the additional RS485 protocols to come: the `Inverter brand`/
`Protocol` selects, diagnostics and telemetry move out to a new shared file, `yambms_rs485.yaml`,
which `yambms_rs485_pylon.yaml` includes itself. Each protocol file includes
`yambms_rs485.yaml` this way round, rather than the other way, so that a node with several RS485
links on different UARTs can run a different protocol on each.
| File | Role |
| --- | --- |
| `yambms_rs485.yaml` | **the file you include** — carries the `Inverter brand` and `Protocol` selects and the diagnostics sensors |
| `yambms_rs485_pylon.yaml` | the PYLON protocol implementation, included by the file above |
> [!IMPORTANT]
> The name `yambms_rs485_pylon.yaml` still exists but no longer designates the same thing: it is
> now the protocol implementation, not the file to include. Point your `!include` to
> `yambms_rs485.yaml` instead.
`yambms_rs485_pylon_web_server.yaml` becomes `yambms_rs485_web_server.yaml` in the same way.
`yambms_rs485_pylon_web_server.yaml` becomes `yambms_rs485_web_server.yaml`, and unlike before it
no longer includes the link itself: add it **alongside** `yambms_rs485_pylon.yaml` in your YAML,
with its own `vars: { rs485_id: '1' }` matching the link it decorates, instead of swapping one file
for the other.
`rs485_uart_baud_rate` keeps the same meaning but is now applied at runtime instead of extending
the `uart` component, and defaults to `9600`. Boards using a UART expander — the `wk2168` of the
PVbrain2 — no longer need a separate include: every board now uses `yambms_rs485.yaml`.
PVbrain2 — no longer need a separate include: every board now uses the same entry point.
+4 -2
View File
@@ -1,5 +1,5 @@
# Updated : 2026.09.02
# Version : 2.7.0
# Updated : 2026.09.04
# Version : 2.7.1
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -114,6 +114,7 @@ select:
- "Growatt"
- "LuxPower"
- "MidNite Solar"
- "MPP Solar"
- "Schneider"
- "SMA"
- "Sofar"
@@ -121,6 +122,7 @@ select:
- "SRNE"
- "Studer"
- "Victron"
- "Voltronic"
restore_value: true
initial_option: "Not defined"
optimistic: true
+19 -8
View File
@@ -1,5 +1,5 @@
# Updated : 2026.09.02
# Version : 1.1.0
# Updated : 2026.09.04
# Version : 1.1.1
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -49,7 +49,8 @@ substitutions:
YB_PROTO_CAN_LUXPOWER: "105"
YB_PROTO_CAN_DEYE_PCS: "106"
# RS485 - 2xx
YB_PROTO_RS485_PYLON: "201"
YB_PROTO_RS485_PYLON: "201"
YB_PROTO_RS485_VOLTRONIC_LIB: "202"
globals:
# ---------------------------------------------------------
@@ -82,8 +83,13 @@ globals:
return ${YB_PROTO_NONE};
}
// RS485 currently exposes a single protocol, so every known brand maps to it.
if (bus == "RS485") return ${YB_PROTO_RS485_PYLON};
// RS485: every known brand maps to PYLON, except the Voltronic-derived
// family (Axpert, InfiniSolar, MPP Solar) whose "LIB" battery type is a
// distinct, unrelated protocol - see yambms_rs485_voltronic.yaml.
if (bus == "RS485") {
if (brand == "MPP Solar" || brand == "Voltronic") return ${YB_PROTO_RS485_VOLTRONIC_LIB};
return ${YB_PROTO_RS485_PYLON};
}
return ${YB_PROTO_NONE};
}
@@ -106,8 +112,9 @@ globals:
case ${YB_PROTO_CAN_VICTRON}: return "Victron";
case ${YB_PROTO_CAN_LUXPOWER}: return "LuxPower";
case ${YB_PROTO_CAN_DEYE_PCS}: return "Deye PCS";
case ${YB_PROTO_RS485_PYLON}: return "PYLON";
default: return "None";
case ${YB_PROTO_RS485_PYLON}: return "PYLON";
case ${YB_PROTO_RS485_VOLTRONIC_LIB}: return "LIB";
default: return "None";
}
}
@@ -133,6 +140,7 @@ globals:
if (brand == "Growatt" && proto == ${YB_PROTO_CAN_PYLON_V1}) return "CAN L52";
if (brand == "LuxPower" && proto == ${YB_PROTO_CAN_LUXPOWER}) return "Lithium 6";
if (brand == "MidNite Solar" && proto == ${YB_PROTO_CAN_PYLON_V1}) return "PYLON";
if (brand == "MPP Solar" && proto == ${YB_PROTO_RS485_VOLTRONIC_LIB}) return "LIB";
if (brand == "Schneider" && proto == ${YB_PROTO_CAN_PYLON_V2}) return "Voltage Control Li-Ion";
if (brand == "Sofar" && proto == ${YB_PROTO_CAN_PYLON_V1}) return "Automatic";
if (brand == "Solis" && proto == ${YB_PROTO_CAN_SMA}) return "AoBo";
@@ -140,6 +148,7 @@ globals:
if (brand == "SRNE" && proto == ${YB_PROTO_CAN_PYLON_V2}) return "UZE";
if (brand == "Studer" && proto == ${YB_PROTO_CAN_PYLON_V2}) return "Pylontech";
if (brand == "Victron" && proto == ${YB_PROTO_CAN_VICTRON}) return "CAN-bus BMS LV (500 kbit/s)";
if (brand == "Voltronic" && proto == ${YB_PROTO_RS485_VOLTRONIC_LIB}) return "LIB";
return "See inverter manual";
}
@@ -156,8 +165,10 @@ globals:
[](std::string brand, int proto) -> std::string {
if (brand == "EG4" && proto == ${YB_PROTO_CAN_PYLON_V1}) return "6000XP only.";
if (brand == "Epever" && proto == ${YB_PROTO_RS485_PYLON}) return "Verified on ET-NC and IT-NC inverter-chargers. Other Epever models may only support the Epever BMS Link protocol.";
if (brand == "Epever" && proto == ${YB_PROTO_RS485_PYLON}) return "Verified on ET-NC and IT-NC inverter-chargers. Other Epever models may only support the Epever BMS Link protocol. BPRO 21 defaults to 115200 baud on ET/IT chargers, not the 9600 default - set rs485_uart_baud_rate accordingly.";
if (brand == "Epever") return "Unverified: Epever inverter-chargers are documented on RS485 PYLON.";
if ((brand == "MPP Solar" || brand == "Voltronic") && proto == ${YB_PROTO_RS485_VOLTRONIC_LIB})
return "Unverified: per Voltronic's own documentation, only the charge voltage limit is applied by the inverter firmware - discharge voltage and both current limits are documented as unused.";
if (brand == "Schneider" && proto == ${YB_PROTO_CAN_PYLON_V2}) return "The extended 29-bit ACK is handled automatically.";
if (brand == "Sofar" && proto == ${YB_PROTO_CAN_PYLON_V1}) return "A 120 Ohm resistor may be required on the Sofar side.";
if (brand == "Solis" && proto == ${YB_PROTO_CAN_PYLON_V2}) return "A 3.3V CAN transceiver (SN65HVD230) is required.";
+43 -13
View File
@@ -1,5 +1,5 @@
# Updated : 2026.09.02
# Version : 1.1.0
# Updated : 2026.09.04
# Version : 1.1.1
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -20,13 +20,13 @@
# +----------------------------------------------------------------------------+
# | RS485 inverter link |
# | |
# | Entry point of the RS485 link: it carries the `Inverter brand` and |
# | `Protocol` selects, the diagnostics and the telemetry slot, then includes |
# | the protocol implementation itself. |
# | |
# | The protocol is selected at compile time by the file included below: two |
# | RS485 protocols cannot drive the same bus at the same time. The select is |
# | what enables, disables and reports it. |
# | Shared machinery for an RS485 link: the `Inverter brand` and `Protocol` |
# | selects, the diagnostics and the telemetry slot. Not the file you include |
# | - you never `!include` this one directly. Each protocol implementation |
# | (yambms_rs485_pylon.yaml, yambms_rs485_voltronic.yaml) includes THIS file, |
# | not the other way around, so that a node with several RS485 links on |
# | several UARTs can run a different protocol on each: including this file |
# | directly would hardcode one protocol for every link that does so. |
# +----------------------------------------------------------------------------+
substitutions:
@@ -120,6 +120,7 @@ select:
- "Growatt"
- "LuxPower"
- "MidNite Solar"
- "MPP Solar"
- "Schneider"
- "SMA"
- "Sofar"
@@ -127,6 +128,7 @@ select:
- "SRNE"
- "Studer"
- "Victron"
- "Voltronic"
restore_value: true
initial_option: "Not defined"
optimistic: true
@@ -135,6 +137,12 @@ select:
- script.execute: rs485${rs485_id}_script_resolve_protocol
# Communication protocol. `Automatic` derives it from the inverter brand;
# any other choice takes priority over the brand.
#
# Only "Automatic" and "Disabled" belong here: they are the two options
# common to every protocol. Each protocol implementation file (e.g.
# yambms_rs485_pylon.yaml) appends its own option with `!extend` on this
# id, so the dropdown only ever offers a choice that is actually compiled
# in - selecting an option nothing implements would silently do nothing.
- platform: template
name: "Protocol"
id: rs485${rs485_id}_protocol
@@ -142,7 +150,6 @@ select:
options:
- "Automatic"
- "Disabled"
- "PYLON"
restore_value: true
initial_option: "Automatic"
optimistic: true
@@ -173,6 +180,31 @@ text_sensor:
icon: mdi:information-outline
entity_category: diagnostic
binary_sensor:
# Whether the inverter is actually acknowledging this link, regardless of
# protocol. Declared here (not in a protocol file) because both the on_boot
# initialisation and the resolution script above reference it - every
# protocol implementation must publish to this same id (see e.g. the
# pylontech_rs485 `rs485_status:` option, or the polling-activity interval
# in yambms_rs485_voltronic.yaml).
- platform: template
id: rs485${rs485_id}_status
device_id: rs485_${rs485_id}
name: "Status"
entity_category: diagnostic
trigger_on_initial_state: true
on_state:
then:
- lambda: |-
// A link the user turned off is neither healthy nor faulty: it is not
// expected to communicate, so it must not light the fault LED.
if (id(rs485${rs485_id}_active_protocol) == ${YB_PROTO_DISABLED}) {
id(global_unregister_fault)(${CAT_INV_RS485}, ${rs485_id});
return;
}
// Pass the current state to the update function
id(global_update_fault)(${CAT_INV_RS485}, ${rs485_id}, !x);
script:
# Resolves the protocol actually applied on this link, publishes the three
# diagnostic text sensors and refreshes this link's telemetry slot.
@@ -202,6 +234,7 @@ script:
} else {
source = "manual";
if (choice == "Disabled") proto = ${YB_PROTO_DISABLED};
else if (choice == "LIB") proto = ${YB_PROTO_RS485_VOLTRONIC_LIB};
else if (choice == "PYLON") proto = ${YB_PROTO_RS485_PYLON};
else proto = ${YB_PROTO_NONE};
}
@@ -245,6 +278,3 @@ script:
id(yambms${yambms_id}_var_inverter_protocol_sources)[slot] = source;
ESP_LOGI("rs485", "Inverter link resolved: %s - RS485 - %s (%s)", brand.c_str(), label.c_str(), source.c_str());
packages:
rs485_pylon: !include yambms_rs485_pylon.yaml
+18 -24
View File
@@ -1,5 +1,5 @@
# Updated : 2026.09.02
# Version : 1.5.0
# Updated : 2026.09.04
# Version : 1.5.1
# GitHub : https://github.com/fahmula/esphome-pylontech-rs485
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -17,14 +17,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
# The selects, the diagnostics and the telemetry slot live in the entry point
# `yambms_rs485.yaml`, which includes this file. This file only implements the
# PYLON protocol itself.
# This is the file you include for a PYLON RS485 link: it pulls in the shared
# selects/diagnostics/telemetry machinery from `yambms_rs485.yaml` and adds
# the PYLON protocol itself. Included this way round (rather than the other
# way, as before 1.8.1) so that a node with several RS485 links on several
# UARTs can run PYLON on one and Voltronic LIB on another - see
# yambms_rs485_voltronic.yaml for that alternative entry point.
packages:
rs485_entry: !include yambms_rs485.yaml
external_components:
- source: github://fahmula/esphome-pylontech-rs485@main
refresh: 60min
select:
# Adds the option this file implements to the base Automatic/Disabled list
# declared in yambms_rs485.yaml - see the comment there.
- id: !extend rs485${rs485_id}_protocol
options:
- "PYLON"
globals:
# True while the proxy sensors carry data the component may serve to the
# inverter. Turning the protocol off does not clear them by itself, so they
@@ -147,25 +160,6 @@ binary_sensor:
- platform: template
id: rs485${rs485_id}_proxy_system_fault_protection
internal: true
# --- RS485 Status ---
- platform: template
id: rs485${rs485_id}_status
device_id: rs485_${rs485_id}
name: "Status"
entity_category: diagnostic
trigger_on_initial_state: true
on_state:
then:
- lambda: |-
// A link the user turned off is neither healthy nor faulty: it is not
// expected to communicate, so it must not light the fault LED.
if (id(rs485${rs485_id}_active_protocol) == ${YB_PROTO_DISABLED}) {
id(global_unregister_fault)(${CAT_INV_RS485}, ${rs485_id});
return;
}
// Pass the current state to the update function
id(global_update_fault)(${CAT_INV_RS485}, ${rs485_id}, !x);
interval:
- interval: 100ms
then:
+236
View File
@@ -0,0 +1,236 @@
# Updated : 2026.09.04
# Version : 1.1.0
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
# This YAML is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
# This is the file you include for a Voltronic LIB RS485 link: it pulls in
# the shared selects/diagnostics/telemetry machinery from `yambms_rs485.yaml`
# and adds the Voltronic "LIb" protocol itself - see documents/PRIVATE/
# Voltronic/Voltronic Inverter and BMS 485 communication protocol
# 20201202.docx (Voltronic Power, also referenced by Epever as PRO=26, same
# authors Ellis/Lory/Jenny). Use yambms_rs485_pylon.yaml instead for PYLON -
# never include both on the same UART, see the warning below.
#
# Unlike Pylontech, this is plain Modbus RTU (function 0x03, 9600 8N1) so it
# is implemented with ESPHome's native `modbus_server:` - no external
# component. YamBMS answers as slave address 1 (the doc's "common ID", always
# accepted regardless of the inverter's parallel-pack ID switch position) and
# always reports itself as a single pack: the multi-BMS aggregation already
# happens upstream, the inverter only ever sees one virtual battery.
#
# EXPERIMENTAL - scope deliberately reduced from the full protocol:
# - Per-cell voltages (0x0011-0x0024) and per-sensor status codes
# (0x0040-0x0069) are not exposed. YamBMS does not track voltage/status
# per individual cell beyond min/max, and the inverter's own charge
# behaviour does not depend on them.
# - Per Voltronic's own documentation, only the charge voltage limit
# (0x0070) is applied by the inverter firmware - the discharge voltage
# limit and both current limits (0x0071-0x0073) are marked "not used by
# UPS yet". Auto CVL therefore has an effect through this protocol, but
# Auto CCL Current Taper and Auto Float do not: the inverter follows its
# own locally configured charge curve regardless of what is sent there.
# - Not verified on real hardware yet.
packages:
rs485_entry: !include yambms_rs485.yaml
select:
# Adds the option this file implements to the base Automatic/Disabled list
# declared in yambms_rs485.yaml - see the comment there.
- id: !extend rs485${rs485_id}_protocol
options:
- "LIB"
globals:
# Set by the read_lambda of address 48 (the first register of the
# aggregated-data block, always read by a normal polling cycle), cleared by
# the interval below. Unlike pylontech_rs485's own update_timeout, nothing
# in modbus_server tracks staleness for us, so this link's `Status` binary
# sensor (declared in yambms_rs485.yaml) needs its own liveness check.
- id: rs485${rs485_id}_voltronic_polled
type: bool
restore_value: no
initial_value: "false"
interval:
- interval: ${rs485_update_timeout}
then:
- lambda: |-
bool polled = id(rs485${rs485_id}_voltronic_polled);
id(rs485${rs485_id}_voltronic_polled) = false;
id(rs485${rs485_id}_status).publish_state(polled);
modbus:
- uart_id: ${rs485_uart_id}
id: modbus_rs485_${rs485_id}
role: server
modbus_server:
- modbus_id: modbus_rs485_${rs485_id}
address: 1
registers:
# +--------------------------------------------------------------+
# | 0x0030-0x003F : aggregated pack data |
# +--------------------------------------------------------------+
# Module charge current (0.1A) - only the charging half of the
# signed YamBMS current, zero while discharging or idle. Also marks
# this link as polled for the Status sensor - see the interval above.
- address: 48 # 0x0030
value_type: U_WORD
read_lambda: |-
id(rs485${rs485_id}_voltronic_polled) = true;
float current = id(yambms${yambms_id}_current).state;
return uint16_t(current > 0 ? current * 10 : 0);
# Module discharge current (0.1A) - the discharging half.
- address: 49 # 0x0031
value_type: U_WORD
read_lambda: |-
float current = id(yambms${yambms_id}_current).state;
return uint16_t(current < 0 ? -current * 10 : 0);
# Module voltage (0.1V)
- address: 50 # 0x0032
value_type: U_WORD
read_lambda: |-
return uint16_t(id(yambms${yambms_id}_total_voltage).state * 10);
# SOC (%)
- address: 51 # 0x0033
value_type: U_WORD
read_lambda: |-
return uint16_t(id(yambms${yambms_id}_battery_soc).state);
# Module total capacity (mAh) - 4 bytes, occupies 0x0034-0x0035
- address: 52 # 0x0034
value_type: U_DWORD
read_lambda: |-
return uint32_t(id(yambms${yambms_id}_battery_capacity).state * 1000);
# Pack parallel number - always 1: the multi-BMS aggregation already
# happened upstream, the inverter only ever sees one virtual pack.
- address: 54 # 0x0036
value_type: U_WORD
read_lambda: |-
return uint16_t(1);
# Charge Alarm: bit3 OCC, bit2 CLT, bit1 COV, bit0 CHT
- address: 55 # 0x0037
value_type: U_WORD
read_lambda: |-
uint16_t alarm = id(yambms${yambms_id}_errors_bitmask_alarm).state;
uint16_t reg = 0;
if (alarm & 0x0100) reg |= 0x08; // Charge Over Current -> OCC
if (alarm & 0x0040) reg |= 0x04; // Charge Under Temp -> CLT
if (alarm & 0x0002) reg |= 0x02; // Over Voltage -> COV
if (alarm & 0x0020) reg |= 0x01; // Charge Over Temp -> CHT
return reg;
# Discharge Alarm: bit3 CUV, bit1 DLT, bit0 DHT (bit2 FETHT unavailable)
- address: 56 # 0x0038
value_type: U_WORD
read_lambda: |-
uint16_t alarm = id(yambms${yambms_id}_errors_bitmask_alarm).state;
uint16_t reg = 0;
if (alarm & 0x0004) reg |= 0x08; // Under Voltage -> CUV
if (alarm & 0x0010) reg |= 0x02; // Under Temp -> DLT
if (alarm & 0x0008) reg |= 0x01; // Over Temp -> DHT
return reg;
# Charge Protect - mirrors Charge Alarm: YamBMS does not distinguish
# an alarm tier from a protect tier internally.
- address: 57 # 0x0039
value_type: U_WORD
read_lambda: |-
uint16_t alarm = id(yambms${yambms_id}_errors_bitmask_alarm).state;
uint16_t reg = 0;
if (alarm & 0x0100) reg |= 0x0800; // Charge Over Current -> OCC (bit11)
if (alarm & 0x0002) reg |= 0x0400; // Over Voltage -> OCV (bit10)
if (alarm & 0x0040) reg |= 0x0200; // Charge Under Temp -> CLT (bit9)
if (alarm & 0x0020) reg |= 0x0100; // Charge Over Temp -> CHT (bit8)
return reg;
- address: 58 # 0x003A - Charge Protect 2, reserved
value_type: U_WORD
read_lambda: |-
return uint16_t(0);
# Discharge Protect - mirrors Discharge Alarm.
- address: 59 # 0x003B
value_type: U_WORD
read_lambda: |-
uint16_t alarm = id(yambms${yambms_id}_errors_bitmask_alarm).state;
uint16_t reg = 0;
if (alarm & 0x0080) reg |= 0x0004; // Discharge Over Current -> OCD (bit2)
return reg;
- address: 60 # 0x003C - Discharge Protect 2, reserved
value_type: U_WORD
read_lambda: |-
return uint16_t(0);
- address: 61 # 0x003D - BMS State, reserved
value_type: U_WORD
read_lambda: |-
return uint16_t(0);
# Design capacity (mAh) - 4 bytes, occupies 0x003E-0x003F. Uses the
# installed capacity (nameplate total), not the full-charge capacity
# used above for "Module total capacity" - they can differ with SOH.
- address: 62 # 0x003E
value_type: U_DWORD
read_lambda: |-
return uint32_t(id(yambms${yambms_id}_installed_battery_capacity).state * 1000);
# +--------------------------------------------------------------+
# | 0x0070-0x0077 : charge/discharge information |
# +--------------------------------------------------------------+
# Charge voltage limit (0.1V) - the only one of the four limits
# below that the inverter firmware is documented to actually apply.
- address: 112 # 0x0070
value_type: U_WORD
read_lambda: |-
return uint16_t(id(yambms${yambms_id}_requested_charge_voltage).state * 10);
# Discharge voltage limit (0.1V) - "not used by UPS yet" (doc), sent
# anyway for forward compatibility.
- address: 113 # 0x0071
value_type: U_WORD
read_lambda: |-
return uint16_t(id(yambms${yambms_id}_requested_discharge_voltage).state * 10);
# Charge current limit (0.1A) - "not used by UPS yet" (doc).
- address: 114 # 0x0072
value_type: U_WORD
read_lambda: |-
return uint16_t(id(yambms${yambms_id}_requested_charge_current).state * 10);
# Discharge current limit (0.1A) - "not used by UPS yet" (doc).
- address: 115 # 0x0073
value_type: U_WORD
read_lambda: |-
return uint16_t(id(yambms${yambms_id}_requested_discharge_current).state * 10);
# Charge/discharge status: bit7 charge enable, bit6 discharge enable,
# bit5/4 "charge immediately" hints on low SOC (spec'd thresholds).
- address: 116 # 0x0074
value_type: U_WORD
read_lambda: |-
uint16_t reg = 0;
std::string charging = id(yambms${yambms_id}_charging_instruction).state;
float soc = id(yambms${yambms_id}_battery_soc).state;
if (charging == "Bulk" || charging == "Float") reg |= 0x80;
if (id(yambms${yambms_id}_discharging_instruction).state) reg |= 0x40;
if (soc <= 9) reg |= 0x20;
else if (soc <= 14) reg |= 0x10;
return reg;
# Run Time To Empty (min) - remaining capacity / discharge current,
# left at 0 while not discharging rather than reporting infinity.
- address: 117 # 0x0075
value_type: U_WORD
read_lambda: |-
float current = id(yambms${yambms_id}_current).state;
if (current >= 0) return uint16_t(0);
return uint16_t(id(yambms${yambms_id}_battery_capacity_remaining).state / -current * 60);
# Module remain capacity (mAh) - 4 bytes, occupies 0x0076-0x0077
- address: 118 # 0x0076
value_type: U_DWORD
read_lambda: |-
return uint32_t(id(yambms${yambms_id}_battery_capacity_remaining).state * 1000);
+2 -5
View File
@@ -1,5 +1,5 @@
# Updated : 2026.09.02
# Version : 1.1.3
# Updated : 2026.09.04
# Version : 1.1.4
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -17,9 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
packages:
rs485: !include yambms_rs485.yaml
select:
# YamBMS - Inverter Communication Protocol
- id: !extend rs485${rs485_id}_inverter_brand