Improved PACE BMS modbus (esphome >= 2026.7.0)
This commit is contained in:
1 parent
f078e3635c
commit
9b2787ecca
2 files changed
+24
-21
No files matched your search
@@ -1,5 +1,5 @@
|
||||
# Updated : 2025.07.24
|
||||
# Version : 1.1.1
|
||||
# Updated : 2026.08.04
|
||||
# Version : 1.1.2
|
||||
# GitHub : https://github.com/Sleeper85/esphome-yambms
|
||||
|
||||
# YamBMS ( Yet another multi-BMS Merging Solution )
|
||||
@@ -23,10 +23,10 @@ substitutions:
|
||||
bms_protocol: "RS485"
|
||||
# Modbus
|
||||
pace_modbus_id: modbus_pace
|
||||
pace_modbus_send_wait_time: 250ms # time in milliseconds before the next ModBUS command is sent if an answer from a previous command is pending
|
||||
pace_modbus_send_wait_time: 250ms # Timeout: max time to wait for the FIRST byte of a response
|
||||
pace_modbus_turnaround_time: '0ms' # Pause after a completed response before the next command.
|
||||
# Modbus Controller
|
||||
pace_modbus_update_interval: '5s' # frequency with which BMS modbus servers are queried
|
||||
pace_modbus_command_throttle: '0ms' # minimum time in between 2 requests to the device
|
||||
pace_modbus_update_interval: '5s' # Frequency with which BMS modbus servers are queried
|
||||
|
||||
uart:
|
||||
- id: !extend ${pace_modbus_uart_id}
|
||||
@@ -37,3 +37,4 @@ modbus:
|
||||
id: ${pace_modbus_id}
|
||||
role: client
|
||||
send_wait_time: ${pace_modbus_send_wait_time}
|
||||
turnaround_time: ${pace_modbus_turnaround_time}
|
||||
@@ -1,5 +1,5 @@
|
||||
# Updated : 2026.02.05
|
||||
# Version : 1.1.8
|
||||
# Updated : 2026.08.04
|
||||
# Version : 1.1.9
|
||||
# GitHub : https://github.com/syssi/esphome-pace-bms
|
||||
|
||||
# YamBMS ( Yet another multi-BMS Merging Solution )
|
||||
@@ -29,8 +29,9 @@ modbus_controller:
|
||||
- id: modbus_controller_bms${bms_id}
|
||||
address: ${bms_id}
|
||||
modbus_id: ${pace_modbus_id}
|
||||
command_throttle: ${pace_modbus_command_throttle}
|
||||
update_interval: ${pace_modbus_update_interval}
|
||||
max_cmd_retries: 2
|
||||
offline_skip_updates: 5 # Server re-polled every 30s with an update_interval of 5s
|
||||
on_online:
|
||||
then:
|
||||
- logger.log: "Pace BMS ${bms_id} back online !"
|
||||
@@ -314,28 +315,27 @@ sensor:
|
||||
accuracy_decimals: 2
|
||||
filters:
|
||||
- multiply: 0.01
|
||||
on_value:
|
||||
then:
|
||||
- component.update: bms${bms_id}_power
|
||||
|
||||
- platform: modbus_controller
|
||||
modbus_controller_id: modbus_controller_bms${bms_id}
|
||||
# Power calculated from current × total_voltage
|
||||
- platform: template
|
||||
id: bms${bms_id}_power
|
||||
device_id: bms_${bms_id}
|
||||
name: "power"
|
||||
address: 0
|
||||
register_type: holding
|
||||
value_type: U_WORD
|
||||
register_count: 2
|
||||
response_size: 4
|
||||
unit_of_measurement: "W"
|
||||
device_class: power
|
||||
state_class: measurement
|
||||
accuracy_decimals: 2
|
||||
update_interval: never
|
||||
lambda: |-
|
||||
if (data.size() < 4) {
|
||||
const float current = id(bms${bms_id}_current).state;
|
||||
const float voltage = id(bms${bms_id}_total_voltage).state;
|
||||
if (std::isnan(current) || std::isnan(voltage)) {
|
||||
return NAN;
|
||||
}
|
||||
float current = (int16_t)(data[0] << 8 | data[1] << 0);
|
||||
float total_voltage = (uint16_t)(data[2] << 8 | data[3] << 0);
|
||||
return current * total_voltage * 0.0001f;
|
||||
return current * voltage;
|
||||
|
||||
# 2 State of charge 2 byte R uint8 % (0-100%)
|
||||
- platform: modbus_controller
|
||||
@@ -420,6 +420,7 @@ sensor:
|
||||
unit_of_measurement: ""
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
register_count: 2
|
||||
|
||||
# 8 Reserved
|
||||
|
||||
@@ -470,6 +471,7 @@ sensor:
|
||||
unit_of_measurement: ""
|
||||
state_class: measurement
|
||||
accuracy_decimals: 0
|
||||
register_count: 3
|
||||
|
||||
# 13 Reserved
|
||||
# 14 Reserved
|
||||
@@ -897,7 +899,7 @@ sensor:
|
||||
|
||||
# Charging Power
|
||||
- platform: template
|
||||
name: ${name} ${bms_name} Charging Power
|
||||
name: "charging power"
|
||||
id: bms${bms_id}_charging_power
|
||||
device_id: bms_${bms_id}
|
||||
update_interval: ${bms_update_interval}
|
||||
@@ -912,7 +914,7 @@ sensor:
|
||||
|
||||
# Discharging Power
|
||||
- platform: template
|
||||
name: ${name} ${bms_name} Discharging Power
|
||||
name: "discharging power"
|
||||
id: bms${bms_id}_discharging_power
|
||||
device_id: bms_${bms_id}
|
||||
update_interval: ${bms_update_interval}
|
||||
|
||||
Reference in new issue
Block a user