From 941fcbf9f23e7a0f356cbf13a4f700a9522aa119 Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 26 Jul 2025 16:53:46 -0400 Subject: [PATCH 01/10] feat(rs485): add inverter heartbeat monitoring logic with status sensor --- packages/yambms/yambms_rs485_pylon.yaml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index adb1e86..bd2dcb2 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -25,6 +25,12 @@ uart: - id: !extend ${rs485_uart_id} baud_rate: ${rs485_uart_baud_rate} +globals: + - id: rs485_inverter_ack_ms_previous + type: uint32_t + restore_value: no + initial_value: '0' + select: - platform: template name: "${name} ${rs485_name} Protocol" @@ -37,6 +43,14 @@ select: optimistic: true entity_category: config +switch: + - platform: template + name: "${name} ${rs485_name} Inverter Heartbeat Monitoring" + id: rs485_switch_inverter_heartbeat_monitoring + restore_mode: RESTORE_DEFAULT_OFF + optimistic: true + entity_category: diagnostic + sensor: - platform: template id: yambms_proxy_soc @@ -80,6 +94,14 @@ sensor: - platform: template id: yambms_proxy_max_discharge_i internal: true + - platform: template + id: inverter_heartbeat + name: "${name} ${rs485_name} Inverter Heartbeat" + unit_of_measurement: ms + device_class: duration + accuracy_decimals: 0 + icon: mdi:update + entity_category: diagnostic binary_sensor: # --- Passive Proxy Alarm/Protection Sensors --- @@ -131,6 +153,13 @@ binary_sensor: - platform: template id: yambms_proxy_system_fault_protection internal: true + - platform: template + id: inverter_online + name: "${name} ${rs485_name} Inverter Online" + lambda: |- + // Inverter is online if last update was within timeout period + return (millis() - id(rs485_inverter_ack_ms_previous)) < (${rs485_update_timeout} * 1000); + entity_category: diagnostic interval: - interval: 100ms @@ -179,6 +208,14 @@ interval: id(yambms_proxy_discharge_overcurrent_protection).publish_state((mask & 0x0080) > 0); id(yambms_proxy_system_fault_protection).publish_state((mask & 0x0800) > 0); } + if (id(rs485_switch_inverter_heartbeat_monitoring).state) { + uint32_t now = millis(); + uint32_t interval = now - id(rs485_inverter_ack_ms_previous); + id(rs485_inverter_ack_ms_previous) = now; + id(inverter_heartbeat).publish_state(interval); + ESP_LOGI("rs485", "Inverter heartbeat: %d ms", interval); + } + pylontech_rs485: uart_id: ${rs485_uart_id} From 444c2fbf33a4b8cdcf1a9d96d6020d71294079ec Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 26 Jul 2025 17:05:51 -0400 Subject: [PATCH 02/10] fix(rs485): hardcode inverter online timeout to 5s to avoid substitution errors --- packages/yambms/yambms_rs485_pylon.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index bd2dcb2..8051b43 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -158,7 +158,7 @@ binary_sensor: name: "${name} ${rs485_name} Inverter Online" lambda: |- // Inverter is online if last update was within timeout period - return (millis() - id(rs485_inverter_ack_ms_previous)) < (${rs485_update_timeout} * 1000); + return (millis() - id(rs485_inverter_ack_ms_previous)) < 5000; entity_category: diagnostic interval: From 4b05008e7870302eef1311a858b08ea46fd069b8 Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 26 Jul 2025 17:14:40 -0400 Subject: [PATCH 03/10] Add some comments --- packages/yambms/yambms_rs485_pylon.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index 8051b43..4b8bf50 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -94,6 +94,7 @@ sensor: - platform: template id: yambms_proxy_max_discharge_i internal: true + # --- Inverter Heartbeat --- - platform: template id: inverter_heartbeat name: "${name} ${rs485_name} Inverter Heartbeat" @@ -153,6 +154,7 @@ binary_sensor: - platform: template id: yambms_proxy_system_fault_protection internal: true + # --- Inverter Online Status --- - platform: template id: inverter_online name: "${name} ${rs485_name} Inverter Online" From 3314d57a7d3c8125c9057286f4a42709be5d3b93 Mon Sep 17 00:00:00 2001 From: fahmula Date: Thu, 31 Jul 2025 16:29:22 -0400 Subject: [PATCH 04/10] fix: Improve inverter communication status accuracy Refactor inverter heartbeat and communication status handling to be managed directly by the `pylontech_rs485` component. This provides a more reliable and accurate indication of the inverter's communication state, ensuring the true status is reflected. --- packages/yambms/yambms_rs485_pylon.yaml | 29 +++++++------------------ 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index 4b8bf50..8870a58 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -25,12 +25,6 @@ uart: - id: !extend ${rs485_uart_id} baud_rate: ${rs485_uart_baud_rate} -globals: - - id: rs485_inverter_ack_ms_previous - type: uint32_t - restore_value: no - initial_value: '0' - select: - platform: template name: "${name} ${rs485_name} Protocol" @@ -154,13 +148,10 @@ binary_sensor: - platform: template id: yambms_proxy_system_fault_protection internal: true - # --- Inverter Online Status --- + # --- Inverter Communication Status --- - platform: template - id: inverter_online - name: "${name} ${rs485_name} Inverter Online" - lambda: |- - // Inverter is online if last update was within timeout period - return (millis() - id(rs485_inverter_ack_ms_previous)) < 5000; + id: inverter_com_status + name: "Inverter Communication Status" entity_category: diagnostic interval: @@ -210,14 +201,6 @@ interval: id(yambms_proxy_discharge_overcurrent_protection).publish_state((mask & 0x0080) > 0); id(yambms_proxy_system_fault_protection).publish_state((mask & 0x0800) > 0); } - if (id(rs485_switch_inverter_heartbeat_monitoring).state) { - uint32_t now = millis(); - uint32_t interval = now - id(rs485_inverter_ack_ms_previous); - id(rs485_inverter_ack_ms_previous) = now; - id(inverter_heartbeat).publish_state(interval); - ESP_LOGI("rs485", "Inverter heartbeat: %d ms", interval); - } - pylontech_rs485: uart_id: ${rs485_uart_id} @@ -258,4 +241,8 @@ pylontech_rs485: max_voltage: yambms_proxy_max_charge_v min_voltage: yambms_proxy_min_discharge_v max_charge_current: yambms_proxy_max_charge_i - max_discharge_current: yambms_proxy_max_discharge_i \ No newline at end of file + max_discharge_current: yambms_proxy_max_discharge_i + # --- Inverter Heartbeat & Com Status --- + inverter_heartbeat: inverter_heartbeat + inverter_com_status: inverter_com_status + heartbeat_switch: rs485_switch_inverter_heartbeat_monitoring \ No newline at end of file From 7909210390cfbe965484997e19210400892e6482 Mon Sep 17 00:00:00 2001 From: fahmula Date: Thu, 31 Jul 2025 18:14:25 -0400 Subject: [PATCH 05/10] fix: Remove redundant inverter communication status sensor --- packages/yambms/yambms_rs485_pylon.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index 8870a58..415e848 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -148,12 +148,7 @@ binary_sensor: - platform: template id: yambms_proxy_system_fault_protection internal: true - # --- Inverter Communication Status --- - - platform: template - id: inverter_com_status - name: "Inverter Communication Status" - entity_category: diagnostic - + interval: - interval: 100ms then: From 31e138bf0d9e9d77aebf08a7875440154c3efec9 Mon Sep 17 00:00:00 2001 From: fahmula Date: Thu, 31 Jul 2025 18:52:37 -0400 Subject: [PATCH 06/10] feat: Add inverter communication status sensor Implement a new binary sensor to monitor the inverter communication status. This sensor's state is dependent on the `rs485_switch_inverter_heartbeat_monitoring` switch, only reporting the actual inverter communication status when heartbeat monitoring is enabled. --- packages/yambms/yambms_rs485_pylon.yaml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index 415e848..0b336c2 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -1,5 +1,5 @@ -# Updated : 2025.07.10 -# Version : 1.2.0 +# Updated : 2025.07.31 +# Version : 1.2.1 # GitHub : https://github.com/fahmula/esphome-pylontech-rs485 # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -148,7 +148,17 @@ binary_sensor: - platform: template id: yambms_proxy_system_fault_protection internal: true - + # --- Inverter Communication Status --- + - platform: template + id: ${rs485_id}_status + name: "${name} ${rs485_name} Status" + entity_category: diagnostic + lambda: |- + if (id(rs485_switch_inverter_heartbeat_monitoring).state) { + return id(inverter_com_status).state; + } + return false; + interval: - interval: 100ms then: From 36199a6ecbc197f62784170fa69c16b6632cb208 Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 2 Aug 2025 11:45:48 -0400 Subject: [PATCH 07/10] refactor: Update sensor IDs to use dynamic rs485_id for improved configuration --- packages/yambms/yambms_rs485_pylon.yaml | 212 ++++++++++++------------ 1 file changed, 105 insertions(+), 107 deletions(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index 0b336c2..a336230 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -40,57 +40,57 @@ select: switch: - platform: template name: "${name} ${rs485_name} Inverter Heartbeat Monitoring" - id: rs485_switch_inverter_heartbeat_monitoring + id: ${rs485_id}_switch_inverter_heartbeat_monitoring restore_mode: RESTORE_DEFAULT_OFF optimistic: true entity_category: diagnostic sensor: - platform: template - id: yambms_proxy_soc + id: ${rs485_id}_proxy_soc internal: true - platform: template - id: yambms_proxy_voltage + id: ${rs485_id}_proxy_voltage internal: true - platform: template - id: yambms_proxy_current + id: ${rs485_id}_proxy_current internal: true - platform: template - id: yambms_proxy_temperature + id: ${rs485_id}_proxy_temperature internal: true - platform: template - id: yambms_proxy_soh + id: ${rs485_id}_proxy_soh internal: true - platform: template - id: yambms_proxy_cycle_count + id: ${rs485_id}_proxy_cycle_count internal: true - platform: template - id: yambms_proxy_max_cell_v + id: ${rs485_id}_proxy_max_cell_v internal: true - platform: template - id: yambms_proxy_min_cell_v + id: ${rs485_id}_proxy_min_cell_v internal: true - platform: template - id: yambms_proxy_max_temp + id: ${rs485_id}_proxy_max_temp internal: true - platform: template - id: yambms_proxy_min_temp + id: ${rs485_id}_proxy_min_temp internal: true - platform: template - id: yambms_proxy_max_charge_v + id: ${rs485_id}_proxy_max_charge_v internal: true - platform: template - id: yambms_proxy_min_discharge_v + id: ${rs485_id}_proxy_min_discharge_v internal: true - platform: template - id: yambms_proxy_max_charge_i + id: ${rs485_id}_proxy_max_charge_i internal: true - platform: template - id: yambms_proxy_max_discharge_i + id: ${rs485_id}_proxy_max_discharge_i internal: true # --- Inverter Heartbeat --- - platform: template - id: inverter_heartbeat + id: ${rs485_id}_inverter_heartbeat name: "${name} ${rs485_name} Inverter Heartbeat" unit_of_measurement: ms device_class: duration @@ -101,63 +101,58 @@ sensor: binary_sensor: # --- Passive Proxy Alarm/Protection Sensors --- - platform: template - id: yambms_proxy_total_voltage_high_alarm + id: ${rs485_id}_proxy_total_voltage_high_alarm internal: true - platform: template - id: yambms_proxy_total_voltage_low_alarm + id: ${rs485_id}_proxy_total_voltage_low_alarm internal: true - platform: template - id: yambms_proxy_cell_temp_high_alarm + id: ${rs485_id}_proxy_cell_temp_high_alarm internal: true - platform: template - id: yambms_proxy_cell_temp_low_alarm + id: ${rs485_id}_proxy_cell_temp_low_alarm internal: true - platform: template - id: yambms_proxy_charge_overcurrent_alarm + id: ${rs485_id}_proxy_charge_overcurrent_alarm internal: true - platform: template - id: yambms_proxy_discharge_overcurrent_alarm + id: ${rs485_id}_proxy_discharge_overcurrent_alarm internal: true - platform: template - id: yambms_proxy_cell_imbalance_alarm + id: ${rs485_id}_proxy_cell_imbalance_alarm internal: true - platform: template - id: yambms_proxy_cell_voltage_high_alarm + id: ${rs485_id}_proxy_cell_voltage_high_alarm internal: true - platform: template - id: yambms_proxy_cell_voltage_low_alarm + id: ${rs485_id}_proxy_cell_voltage_low_alarm internal: true - platform: template - id: yambms_proxy_cell_overvoltage_protection + id: ${rs485_id}_proxy_cell_overvoltage_protection internal: true - platform: template - id: yambms_proxy_cell_undervoltage_protection + id: ${rs485_id}_proxy_cell_undervoltage_protection internal: true - platform: template - id: yambms_proxy_cell_overtemp_protection + id: ${rs485_id}_proxy_cell_overtemp_protection internal: true - platform: template - id: yambms_proxy_cell_undertemp_protection + id: ${rs485_id}_proxy_cell_undertemp_protection internal: true - platform: template - id: yambms_proxy_charge_overcurrent_protection + id: ${rs485_id}_proxy_charge_overcurrent_protection internal: true - platform: template - id: yambms_proxy_discharge_overcurrent_protection + id: ${rs485_id}_proxy_discharge_overcurrent_protection internal: true - platform: template - id: yambms_proxy_system_fault_protection + id: ${rs485_id}_proxy_system_fault_protection internal: true - # --- Inverter Communication Status --- + # --- RS485 Status --- - platform: template id: ${rs485_id}_status name: "${name} ${rs485_name} Status" entity_category: diagnostic - lambda: |- - if (id(rs485_switch_inverter_heartbeat_monitoring).state) { - return id(inverter_com_status).state; - } - return false; interval: - interval: 100ms @@ -169,85 +164,88 @@ interval: - lambda: !lambda |- // --- PROTOCOL ENABLED: Pass real data if available --- // The .has_state() check prevents race conditions at startup. - if (id(${yambms_id}_battery_soc).has_state()) id(yambms_proxy_soc).publish_state(id(${yambms_id}_battery_soc).state); - if (id(${yambms_id}_total_voltage).has_state()) id(yambms_proxy_voltage).publish_state(id(${yambms_id}_total_voltage).state); - if (id(${yambms_id}_current).has_state()) id(yambms_proxy_current).publish_state(id(${yambms_id}_current).state); - if (id(${yambms_id}_max_temperature).has_state()) id(yambms_proxy_temperature).publish_state(id(${yambms_id}_max_temperature).state); - if (id(${yambms_id}_battery_soh).has_state()) id(yambms_proxy_soh).publish_state(id(${yambms_id}_battery_soh).state); - if (id(${yambms_id}_charging_cycles).has_state()) id(yambms_proxy_cycle_count).publish_state(id(${yambms_id}_charging_cycles).state); - if (id(${yambms_id}_max_cell_voltage).has_state()) id(yambms_proxy_max_cell_v).publish_state(id(${yambms_id}_max_cell_voltage).state); - if (id(${yambms_id}_min_cell_voltage).has_state()) id(yambms_proxy_min_cell_v).publish_state(id(${yambms_id}_min_cell_voltage).state); - if (id(${yambms_id}_max_temperature).has_state()) id(yambms_proxy_max_temp).publish_state(id(${yambms_id}_max_temperature).state); - if (id(${yambms_id}_min_temperature).has_state()) id(yambms_proxy_min_temp).publish_state(id(${yambms_id}_min_temperature).state); - if (id(${yambms_id}_requested_charge_voltage).has_state()) id(yambms_proxy_max_charge_v).publish_state(id(${yambms_id}_requested_charge_voltage).state); - if (id(${yambms_id}_requested_discharge_voltage).has_state()) id(yambms_proxy_min_discharge_v).publish_state(id(${yambms_id}_requested_discharge_voltage).state); - if (id(${yambms_id}_requested_charge_current).has_state()) id(yambms_proxy_max_charge_i).publish_state(id(${yambms_id}_requested_charge_current).state); - if (id(${yambms_id}_requested_discharge_current).has_state()) id(yambms_proxy_max_discharge_i).publish_state(id(${yambms_id}_requested_discharge_current).state); + // Mirror RS485 status into inverter_com_status + if (id(${rs485_id}_status).has_state()) id(inverter_com_status).publish_state(id(${rs485_id}_status).state); + // Sensor Values + if (id(${yambms_id}_battery_soc).has_state()) id(${rs485_id}_proxy_soc).publish_state(id(${yambms_id}_battery_soc).state); + if (id(${yambms_id}_total_voltage).has_state()) id(${rs485_id}_proxy_voltage).publish_state(id(${yambms_id}_total_voltage).state); + if (id(${yambms_id}_current).has_state()) id(${rs485_id}_proxy_current).publish_state(id(${yambms_id}_current).state); + if (id(${yambms_id}_max_temperature).has_state()) id(${rs485_id}_proxy_temperature).publish_state(id(${yambms_id}_max_temperature).state); + if (id(${yambms_id}_battery_soh).has_state()) id(${rs485_id}_proxy_soh).publish_state(id(${yambms_id}_battery_soh).state); + if (id(${yambms_id}_charging_cycles).has_state()) id(${rs485_id}_proxy_cycle_count).publish_state(id(${yambms_id}_charging_cycles).state); + if (id(${yambms_id}_max_cell_voltage).has_state()) id(${rs485_id}_proxy_max_cell_v).publish_state(id(${yambms_id}_max_cell_voltage).state); + if (id(${yambms_id}_min_cell_voltage).has_state()) id(${rs485_id}_proxy_min_cell_v).publish_state(id(${yambms_id}_min_cell_voltage).state); + if (id(${yambms_id}_max_temperature).has_state()) id(${rs485_id}_proxy_max_temp).publish_state(id(${yambms_id}_max_temperature).state); + if (id(${yambms_id}_min_temperature).has_state()) id(${rs485_id}_proxy_min_temp).publish_state(id(${yambms_id}_min_temperature).state); + if (id(${yambms_id}_requested_charge_voltage).has_state()) id(${rs485_id}_proxy_max_charge_v).publish_state(id(${yambms_id}_requested_charge_voltage).state); + if (id(${yambms_id}_requested_discharge_voltage).has_state()) id(${rs485_id}_proxy_min_discharge_v).publish_state(id(${yambms_id}_requested_discharge_voltage).state); + if (id(${yambms_id}_requested_charge_current).has_state()) id(${rs485_id}_proxy_max_charge_i).publish_state(id(${yambms_id}_requested_charge_current).state); + if (id(${yambms_id}_requested_discharge_current).has_state()) id(${rs485_id}_proxy_max_discharge_i).publish_state(id(${yambms_id}_requested_discharge_current).state); // Binary Sensors (Alarms/Protections) if (id(${yambms_id}_errors_bitmask_warning).has_state()) { uint16_t mask = id(${yambms_id}_errors_bitmask_warning).state; - id(yambms_proxy_total_voltage_high_alarm).publish_state((mask & 0x0002) > 0); - id(yambms_proxy_total_voltage_low_alarm).publish_state((mask & 0x0004) > 0); - id(yambms_proxy_cell_temp_high_alarm).publish_state((mask & 0x0008) > 0); - id(yambms_proxy_cell_temp_low_alarm).publish_state((mask & 0x0010) > 0); - id(yambms_proxy_charge_overcurrent_alarm).publish_state((mask & 0x0100) > 0); - id(yambms_proxy_discharge_overcurrent_alarm).publish_state((mask & 0x0080) > 0); - id(yambms_proxy_cell_imbalance_alarm).publish_state((mask & 0x1000) > 0); - id(yambms_proxy_cell_voltage_high_alarm).publish_state((mask & 0x0002) > 0); - id(yambms_proxy_cell_voltage_low_alarm).publish_state((mask & 0x0004) > 0); + id(${rs485_id}_proxy_total_voltage_high_alarm).publish_state((mask & 0x0002) > 0); + id(${rs485_id}_proxy_total_voltage_low_alarm).publish_state((mask & 0x0004) > 0); + id(${rs485_id}_proxy_cell_temp_high_alarm).publish_state((mask & 0x0008) > 0); + id(${rs485_id}_proxy_cell_temp_low_alarm).publish_state((mask & 0x0010) > 0); + id(${rs485_id}_proxy_charge_overcurrent_alarm).publish_state((mask & 0x0100) > 0); + id(${rs485_id}_proxy_discharge_overcurrent_alarm).publish_state((mask & 0x0080) > 0); + id(${rs485_id}_proxy_cell_imbalance_alarm).publish_state((mask & 0x1000) > 0); + id(${rs485_id}_proxy_cell_voltage_high_alarm).publish_state((mask & 0x0002) > 0); + id(${rs485_id}_proxy_cell_voltage_low_alarm).publish_state((mask & 0x0004) > 0); } if (id(${yambms_id}_errors_bitmask_alarm).has_state()) { uint16_t mask = id(${yambms_id}_errors_bitmask_alarm).state; - id(yambms_proxy_cell_overvoltage_protection).publish_state((mask & 0x0002) > 0); - id(yambms_proxy_cell_undervoltage_protection).publish_state((mask & 0x0004) > 0); - id(yambms_proxy_cell_overtemp_protection).publish_state((mask & 0x0008) > 0); - id(yambms_proxy_cell_undertemp_protection).publish_state((mask & 0x0010) > 0); - id(yambms_proxy_charge_overcurrent_protection).publish_state((mask & 0x0100) > 0); - id(yambms_proxy_discharge_overcurrent_protection).publish_state((mask & 0x0080) > 0); - id(yambms_proxy_system_fault_protection).publish_state((mask & 0x0800) > 0); + id(${rs485_id}_proxy_cell_overvoltage_protection).publish_state((mask & 0x0002) > 0); + id(${rs485_id}_proxy_cell_undervoltage_protection).publish_state((mask & 0x0004) > 0); + id(${rs485_id}_proxy_cell_overtemp_protection).publish_state((mask & 0x0008) > 0); + id(${rs485_id}_proxy_cell_undertemp_protection).publish_state((mask & 0x0010) > 0); + id(${rs485_id}_proxy_charge_overcurrent_protection).publish_state((mask & 0x0100) > 0); + id(${rs485_id}_proxy_discharge_overcurrent_protection).publish_state((mask & 0x0080) > 0); + id(${rs485_id}_proxy_system_fault_protection).publish_state((mask & 0x0800) > 0); } pylontech_rs485: uart_id: ${rs485_uart_id} update_timeout: ${rs485_update_timeout} # --- Link to PROXY sensors --- - state_of_charge: yambms_proxy_soc - voltage: yambms_proxy_voltage - current: yambms_proxy_current - temperature: yambms_proxy_temperature - state_of_health: yambms_proxy_soh - cycle_count: yambms_proxy_cycle_count - max_cell_voltage: yambms_proxy_max_cell_v - min_cell_voltage: yambms_proxy_min_cell_v - max_temperature: yambms_proxy_max_temp - min_temperature: yambms_proxy_min_temp - mosfet_temperature: yambms_proxy_temperature - max_mosfet_temperature: yambms_proxy_max_temp - min_mosfet_temperature: yambms_proxy_min_temp - bms_temperature: yambms_proxy_temperature - max_bms_temperature: yambms_proxy_max_temp - min_bms_temperature: yambms_proxy_min_temp - total_voltage_high_alarm: yambms_proxy_total_voltage_high_alarm - total_voltage_low_alarm: yambms_proxy_total_voltage_low_alarm - cell_voltage_high_alarm: yambms_proxy_cell_voltage_high_alarm - cell_voltage_low_alarm: yambms_proxy_cell_voltage_low_alarm - cell_temp_high_alarm: yambms_proxy_cell_temp_high_alarm - cell_temp_low_alarm: yambms_proxy_cell_temp_low_alarm - charge_overcurrent_alarm: yambms_proxy_charge_overcurrent_alarm - discharge_overcurrent_alarm: yambms_proxy_discharge_overcurrent_alarm - cell_imbalance_alarm: yambms_proxy_cell_imbalance_alarm - cell_overvoltage_protection: yambms_proxy_cell_overvoltage_protection - cell_undervoltage_protection: yambms_proxy_cell_undervoltage_protection - cell_overtemp_protection: yambms_proxy_cell_overtemp_protection - cell_undertemp_protection: yambms_proxy_cell_undertemp_protection - charge_overcurrent_protection: yambms_proxy_charge_overcurrent_protection - discharge_overcurrent_protection: yambms_proxy_discharge_overcurrent_protection - system_fault_protection: yambms_proxy_system_fault_protection - max_voltage: yambms_proxy_max_charge_v - min_voltage: yambms_proxy_min_discharge_v - max_charge_current: yambms_proxy_max_charge_i - max_discharge_current: yambms_proxy_max_discharge_i + state_of_charge: ${rs485_id}_proxy_soc + voltage: ${rs485_id}_proxy_voltage + current: ${rs485_id}_proxy_current + temperature: ${rs485_id}_proxy_temperature + state_of_health: ${rs485_id}_proxy_soh + cycle_count: ${rs485_id}_proxy_cycle_count + max_cell_voltage: ${rs485_id}_proxy_max_cell_v + min_cell_voltage: ${rs485_id}_proxy_min_cell_v + max_temperature: ${rs485_id}_proxy_max_temp + min_temperature: ${rs485_id}_proxy_min_temp + mosfet_temperature: ${rs485_id}_proxy_temperature + max_mosfet_temperature: ${rs485_id}_proxy_max_temp + min_mosfet_temperature: ${rs485_id}_proxy_min_temp + bms_temperature: ${rs485_id}_proxy_temperature + max_bms_temperature: ${rs485_id}_proxy_max_temp + min_bms_temperature: ${rs485_id}_proxy_min_temp + total_voltage_high_alarm: ${rs485_id}_proxy_total_voltage_high_alarm + total_voltage_low_alarm: ${rs485_id}_proxy_total_voltage_low_alarm + cell_voltage_high_alarm: ${rs485_id}_proxy_cell_voltage_high_alarm + cell_voltage_low_alarm: ${rs485_id}_proxy_cell_voltage_low_alarm + cell_temp_high_alarm: ${rs485_id}_proxy_cell_temp_high_alarm + cell_temp_low_alarm: ${rs485_id}_proxy_cell_temp_low_alarm + charge_overcurrent_alarm: ${rs485_id}_proxy_charge_overcurrent_alarm + discharge_overcurrent_alarm: ${rs485_id}_proxy_discharge_overcurrent_alarm + cell_imbalance_alarm: ${rs485_id}_proxy_cell_imbalance_alarm + cell_overvoltage_protection: ${rs485_id}_proxy_cell_overvoltage_protection + cell_undervoltage_protection: ${rs485_id}_proxy_cell_undervoltage_protection + cell_overtemp_protection: ${rs485_id}_proxy_cell_overtemp_protection + cell_undertemp_protection: ${rs485_id}_proxy_cell_undertemp_protection + charge_overcurrent_protection: ${rs485_id}_proxy_charge_overcurrent_protection + discharge_overcurrent_protection: ${rs485_id}_proxy_discharge_overcurrent_protection + system_fault_protection: ${rs485_id}_proxy_system_fault_protection + max_voltage: ${rs485_id}_proxy_max_charge_v + min_voltage: ${rs485_id}_proxy_min_discharge_v + max_charge_current: ${rs485_id}_proxy_max_charge_i + max_discharge_current: ${rs485_id}_proxy_max_discharge_i # --- Inverter Heartbeat & Com Status --- - inverter_heartbeat: inverter_heartbeat - inverter_com_status: inverter_com_status - heartbeat_switch: rs485_switch_inverter_heartbeat_monitoring \ No newline at end of file + inverter_heartbeat: ${rs485_id}_inverter_heartbeat + rs485_status: ${rs485_id}_status + heartbeat_switch: ${rs485_id}_switch_inverter_heartbeat_monitoring From 76cab805a7e47d6bda5b1505fd946742234799fe Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 2 Aug 2025 13:13:21 -0400 Subject: [PATCH 08/10] chore: Update version and date in YAML file to reflect latest changes --- packages/yambms/yambms_rs485_pylon.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index a336230..911cf72 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -1,5 +1,5 @@ -# Updated : 2025.07.31 -# Version : 1.2.1 +# Updated : 2025.08.02 +# Version : 1.2.2 # GitHub : https://github.com/fahmula/esphome-pylontech-rs485 # YamBMS ( Yet another multi-BMS Merging Solution ) From ea62827a93482884df4c1f247b308c1bea144c3e Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 2 Aug 2025 15:56:06 -0400 Subject: [PATCH 09/10] feat: Add requested_force_charge to Pylontech RS485 Introduces a new configuration option requested_force_charge to the Pylontech RS485 integration, allowing for external control of the force charge request. --- packages/yambms/yambms_rs485_pylon.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index 911cf72..c9140d6 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -245,6 +245,7 @@ pylontech_rs485: min_voltage: ${rs485_id}_proxy_min_discharge_v max_charge_current: ${rs485_id}_proxy_max_charge_i max_discharge_current: ${rs485_id}_proxy_max_discharge_i + requested_force_charge: ${yambms_id}_requested_force_charge # --- Inverter Heartbeat & Com Status --- inverter_heartbeat: ${rs485_id}_inverter_heartbeat rs485_status: ${rs485_id}_status From e228d14d7659ad581e92bc07045fe996c656b914 Mon Sep 17 00:00:00 2001 From: fahmula Date: Sat, 2 Aug 2025 16:07:56 -0400 Subject: [PATCH 10/10] chore: Update version to 1.3.0 in YAML file --- packages/yambms/yambms_rs485_pylon.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yambms/yambms_rs485_pylon.yaml b/packages/yambms/yambms_rs485_pylon.yaml index c9140d6..66e2b28 100644 --- a/packages/yambms/yambms_rs485_pylon.yaml +++ b/packages/yambms/yambms_rs485_pylon.yaml @@ -1,5 +1,5 @@ # Updated : 2025.08.02 -# Version : 1.2.2 +# Version : 1.3.0 # GitHub : https://github.com/fahmula/esphome-pylontech-rs485 # YamBMS ( Yet another multi-BMS Merging Solution )