Files
esphome-yambms/packages/bms/bms_base.yaml
T
2025-04-04 23:22:25 +02:00

67 lines
2.4 KiB
YAML

# Updated : 2025.04.04
# Version : 1.2.2
# 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>.
sensor:
# +--------------------------------------+
# | Total Daily Energy |
# +--------------------------------------+
- platform: total_daily_energy
name: "${name} ${bms_name} Daily Charging Energy"
power_id: bms${bms_id}_charging_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
- platform: total_daily_energy
name: "${name} ${bms_name} Daily Discharging Energy"
power_id: bms${bms_id}_discharging_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
# +--------------------------------------+
# | Battery State of Charge (SOC) |
# +--------------------------------------+
- platform: template
name: ${name} ${bms_name} Battery SoC
id: bms${bms_id}_battery_soc
unit_of_measurement: "%"
device_class: battery
update_interval: ${bms_update_interval}
accuracy_decimals: 0
filters:
- or:
- throttle: 10s
- delta: 1
lambda: |-
float soc = id(bms${bms_id}_state_of_charge).state;
float min_cell_v = id(bms${bms_id}_min_cell_voltage).state;
float cell_low_v = id(bms${bms_id}_cell_uvp).state + 0.2;
if (min_cell_v <= cell_low_v) return 0; // Real 0% => return 0%
else if (soc < 1) return 2; // False 0% => return 2%
else return soc; // Else => return BMS SoC