Files
esphome-yambms/packages/balancer/balancer_modbus_server.yaml

66 lines
2.3 KiB
YAML

# Updated : 2026.07.31
# Version : 1.1.5
# 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>.
globals:
# External balancer online
- id: bms${bms_id}_var_ext_balancer_online
type: bool
restore_value: no
initial_value: "false"
# External balancer equalizing
- id: bms${bms_id}_var_ext_balancer_equalizing
type: bool
restore_value: no
initial_value: "false"
# External balancer trigger voltage (V)
- id: bms${bms_id}_var_ext_balancer_trigger_voltage
type: float
restore_value: no
initial_value: '0.0'
modbus:
- id: !extend modbus_server_${modbus_id}
send_wait_time: !remove # Invalid option for server role (ESPHome PR #11969)
turnaround_time: !remove # Invalid option for server role (ESPHome PR #11969)
modbus_server:
- modbus_id: modbus_server_${modbus_id}
address: 10${bms_id} # max 255 (8bit)
registers:
# online_status (1/0)
- address: 1
value_type: U_WORD
read_lambda: |-
return uint16_t(id(balancer${bms_id}_online_status).state);
# equalizing (1/0)
- address: 2
value_type: U_WORD
read_lambda: |-
return uint16_t(id(balancer${bms_id}_equalizing).state);
# balance_trigger_voltage (mV)
- address: 3
value_type: U_WORD
read_lambda: |-
return uint16_t(id(balancer${bms_id}_balance_trigger_voltage).state * 1000);
# balance_starting_voltage (mV)
- address: 4
value_type: U_WORD
read_lambda: |-
return uint16_t(id(balancer${bms_id}_balance_starting_voltage).state * 1000);