84 lines
3.3 KiB
YAML
84 lines
3.3 KiB
YAML
# Updated : 2026.06.29
|
|
# Version : 1.1.9
|
|
# 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>.
|
|
|
|
|
|
|
|
# +--------------------------------------------------------------------------------+
|
|
# | Import this package into your main YAML once for each BMS to enable this logic
|
|
# +--------------------------------------------------------------------------------+
|
|
#
|
|
# - path: packages/bms/bms_options_charging_logic.yaml
|
|
# vars:
|
|
# bms_id: '1' # must be a number
|
|
# - path: packages/bms/bms_options_charging_logic.yaml
|
|
# vars:
|
|
# bms_id: '2' # must be a number
|
|
# - path: packages/bms/bms_options_charging_logic.yaml
|
|
# vars:
|
|
# bms_id: '3' # must be a number
|
|
#
|
|
# +--------------------------------------------------------------------------------+
|
|
|
|
|
|
|
|
substitutions:
|
|
bms_cutoff_timer: '50s' # time during which the end of charge conditions must be respected (cut-off + cells not equalizing)
|
|
|
|
script:
|
|
- id: bms${bms_id}_script_cutoff_timer
|
|
then:
|
|
- delay: ${bms_cutoff_timer}
|
|
- switch.turn_off: bms${bms_id}_charge_switch
|
|
- lambda: ESP_LOGD("yambms_debug", "BMS ${bms_id} charge_switch Turn OFF");
|
|
|
|
interval:
|
|
- interval: ${yambms_update_interval}
|
|
then:
|
|
- lambda: |-
|
|
id(yambms${yambms_id}_var_bms_charging_logic) = true;
|
|
|
|
// Charge switch `Turn ON` conditions (Charge switch OFF and ReBulk V.)
|
|
if (!id(bms${bms_id}_charge_switch).state && (id(yambms${yambms_id}_var_charge_status) == "EOC" || id(yambms${yambms_id}_var_charge_status) == "Float"))
|
|
{
|
|
id(bms${bms_id}_charge_switch).turn_on();
|
|
ESP_LOGD("yambms_debug", "BMS ${bms_id} charge_switch Turn ON");
|
|
}
|
|
// Charge switch `Turn OFF` conditions
|
|
else if (id(yambms${yambms_id}_var_charge_status) == "Cut-Off")
|
|
{
|
|
// The cells are equalizing
|
|
if (id(bms${bms_id}_equalizing).state)
|
|
{
|
|
// Stop cut-off timer
|
|
if (id(bms${bms_id}_script_cutoff_timer).is_running()) id(bms${bms_id}_script_cutoff_timer).stop();
|
|
}
|
|
// The cells are not equalizing and Cut-Off timer not running
|
|
else if (!id(bms${bms_id}_script_cutoff_timer).is_running())
|
|
{
|
|
// Start cut-off timer
|
|
// If the conditions continue to be respected the `Charge switch` will be turned OFF
|
|
id(bms${bms_id}_script_cutoff_timer).execute();
|
|
}
|
|
}
|
|
// Cut-off timer is running ?
|
|
else if (id(bms${bms_id}_script_cutoff_timer).is_running())
|
|
{
|
|
id(bms${bms_id}_script_cutoff_timer).stop(); // Stop cut-off timer
|
|
}
|