Send the protection alarms when all combined BMS are in alarm (#344)
The alarm bitmask was published only when the number of BMS in alarm equalled var_bms_counter, the number of configured BMS. But only combined BMS are counted in alarm, so with one BMS offline or missing a value the alarm could never be raised : the inverter received only the warning bits, and the "Alarm" text sensor showed "Warning". STEP 2 now compares with var_to_combine_bms_counter. An uncombined BMS is offline or has missing data, it does not count as "not in alarm". This matches the rest of the combiner, where charge and discharge are already decided by the combined BMS only. The "Alarm" text sensor no longer compares counters : it is derived from the published alarm and warning bitmasks, so it shows what is sent to the inverter. The comment on the alarm sensor said "bitwise AND", it is an OR.
This commit is contained in:
1 parent
c3affb8a10
commit
0ef4ab355b
3 files changed
+16
-12
No files matched your search
@@ -204,9 +204,11 @@ The Deye inverter sends the ACK (can_id `0x305`) only when it receives the can_i
|
||||
|
||||
## Warning & Alarms
|
||||
|
||||
If all BMS have alarms, the alarms are sent to the `CAN bus` as `Protection Alarms`.
|
||||
If all combined BMS have alarms, the alarms are sent to the `CAN bus` as `Protection Alarms`.
|
||||
|
||||
If at least one BMS has no alarms, the alarms are sent to the CAN bus as `Warning`.
|
||||
If at least one combined BMS has no alarms, the alarms are sent to the CAN bus as `Warning`.
|
||||
|
||||
Only combined BMS are counted. A BMS that is not combined (offline, or with missing data) is ignored, so a single BMS in protection while the others are offline sends `Protection Alarms`.
|
||||
|
||||
Both **text_sensor** `Alarm` and `Warning` show the alarms/warnings currently transmitted to the inverter.
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* The components build with ESPHome 2026.11 at log level `DEBUG`
|
||||
* JK RS485 : removed the `precharging` switch and the `operation status` and `battery type` text sensors, which never received a value ; Home Assistant may keep them as unavailable entities, which you can delete
|
||||
* JK RS485 : the `sniffer_protocol` var is no longer used (JK RS485 1.2 removed `protocol_version`) ; you can remove it from your YAML, keeping it does no harm
|
||||
* Fixed [issue 344](https://github.com/Sleeper85/esphome-yambms/issues/344) : the `Protection Alarms` were never sent to the inverter while a BMS was offline, only `Warning` ; they are now sent when all **combined** BMS are in alarm, an offline BMS no longer counts. The `Alarm` text sensor follows
|
||||
|
||||
* YamBMS 1.8.1 :
|
||||
* Set esphome `min_version` to `2026.10.0`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Updated : 2026.11.11
|
||||
# Updated : 2026.11.14
|
||||
# Version : 1.8.2
|
||||
# GitHub : https://github.com/Sleeper85/esphome-yambms
|
||||
|
||||
@@ -530,11 +530,12 @@ interval:
|
||||
// +-----------------------------------------------+
|
||||
|
||||
// Alarm
|
||||
// Alarm - all BMS are in alarm ?
|
||||
if (id(yambms${yambms_id}_var_errors_bitmask_counter) == id(yambms${yambms_id}_var_bms_counter))
|
||||
// Alarm - all combined BMS are in alarm ?
|
||||
// An uncombined BMS is offline or has missing data, it does not count as "not in alarm".
|
||||
if (id(yambms${yambms_id}_var_errors_bitmask_counter) == id(yambms${yambms_id}_var_to_combine_bms_counter))
|
||||
id(yambms${yambms_id}_errors_bitmask_alarm).publish_state(id(yambms${yambms_id}_var_errors_bitmask));
|
||||
|
||||
// At least one BMS is not in alarm
|
||||
|
||||
// At least one combined BMS is not in alarm
|
||||
else id(yambms${yambms_id}_errors_bitmask_alarm).publish_state(0);
|
||||
|
||||
// Warning
|
||||
@@ -2123,7 +2124,7 @@ sensor:
|
||||
const float delta = 1.0f;
|
||||
${rate_limit_filter}
|
||||
|
||||
# Alarm - errors_bitmask bitwise AND (16bit)
|
||||
# Alarm - errors_bitmask bitwise OR, published only when all combined BMS are in alarm (16bit)
|
||||
- platform: template
|
||||
id: yambms${yambms_id}_errors_bitmask_alarm
|
||||
device_id: yambms_yambms${yambms_id}
|
||||
@@ -2469,13 +2470,13 @@ text_sensor:
|
||||
entity_category: diagnostic
|
||||
icon: mdi:battery-alert
|
||||
lambda: |-
|
||||
// Error Bitmask ?
|
||||
// Shows what is sent to the inverter : alarm bits if all combined BMS are in alarm,
|
||||
// otherwise Warning if at least one is.
|
||||
uint16_t errors_bitmask = id(yambms${yambms_id}_errors_bitmask_alarm).state;
|
||||
int eb_counter = id(yambms${yambms_id}_errors_bitmask_counter).state;
|
||||
|
||||
// At least one BMS in alarm
|
||||
if ((eb_counter > 0) && (eb_counter < id(yambms${yambms_id}_var_bms_counter))) return {"Warning"};
|
||||
// All BMS are in alarm
|
||||
if ((errors_bitmask == 0) && (id(yambms${yambms_id}_errors_bitmask_warning).state > 0)) return {"Warning"};
|
||||
// All combined BMS are in alarm
|
||||
else if (errors_bitmask > 0)
|
||||
{
|
||||
if ((errors_bitmask & 0x0002)) return {"OVP"}; // Over Voltage Protection
|
||||
|
||||
Reference in new issue
Block a user