diff --git a/documents/README/YamBMS_behavior.md b/documents/README/YamBMS_behavior.md index 257577d..c345cd1 100644 --- a/documents/README/YamBMS_behavior.md +++ b/documents/README/YamBMS_behavior.md @@ -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. diff --git a/documents/README/changelog/Changelog.md b/documents/README/changelog/Changelog.md index 2296577..9fbd997 100644 --- a/documents/README/changelog/Changelog.md +++ b/documents/README/changelog/Changelog.md @@ -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` diff --git a/packages/yambms/yambms_core.yaml b/packages/yambms/yambms_core.yaml index 9269b8b..34faa0d 100644 --- a/packages/yambms/yambms_core.yaml +++ b/packages/yambms/yambms_core.yaml @@ -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