Add Ecoworthy BMS integration for YamBMS (#199)

This commit is contained in:
Andrew Rankin authored and GitHub committed 2026-02-15 22:49:43 +01:00
1 parent e5d903005c
commit 500d7fa8f6
12 files changed
+2114

No files matched your search

+360
View File
@@ -0,0 +1,360 @@
# Updated : 2026.02.05
# Version : 1.7.0
# 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>.
######################## YamBMS Remote Packages Version ########################
# You can compile this YAML directly without the `packages` folder.
# The packages will be automatically downloaded from GitHub.
# Don't forget to configure your WiFi credentials in the secrets.yaml
################################################################################
# If needed, configure a static IP here
# wifi:
# manual_ip:
# static_ip: 192.168.0.85
# gateway: 192.168.0.1
# subnet: 255.255.255.0
# dns1: 8.8.8.8
# dns2: 8.8.4.4
logger:
level: INFO # VERBOSE / DEBUG / INFO / WARN
# baud_rate: 115200 # Send logs to the `hardware_uart` USB output (this consumes a UART interface)
# hardware_uart: UART0 # UART0 / USB_SERIAL_JTAG
ota:
- platform: esphome
# Uncomment:
# API: to monitor entities via Home Assistant
# MQTT: to monitor entities via another system
# Neither: to monitor entities only via `web_server` or nothing
api:
reboot_timeout: 0s
# mqtt:
# broker: !secret mqtt_host
# username: !secret mqtt_username
# password: !secret mqtt_password
# id: mqtt_client
# +--------------------------------------+
# | Global Settings |
# +--------------------------------------+
substitutions:
# Name
friendly_name : 'YamBMS' # Prefix added in front of the `entity name`, also used to classify them.
hostname: 'yambms' # Name of your ESP32 registered on the IP network (DNS name, must be unique).
name: '' # This name can be added as a second prefix, both for the `entity display name` and the `entity id`, you can leave it blank.
# +--------------------------------------+
# | YamBMS Settings |
# +--------------------------------------+
# Please read the cut-off charging logic README to understand how the YamBMS works
yambms_id: 'yambms1'
yambms_name: 'YamBMS 1'
yambms_update_interval: '1s'
# Input numbers can be displayed as a slider or an input box, options are 'slider' or 'box'.
yambms_input_number_mode: 'slider'
# Please check and fill in the options below correctly according to your battery chemistry and number of cells in series.
# These parameters are important and used for charging logic.
# Battery Chemistry
yambms_battery_chemistry: '1' # 1-LFP | 2-Li-ion | 3-LTO
# Number of cells in series
yambms_cell_count: '16'
# Bulk / Absorption Voltage : corresponds to the Bulk voltage that will be used to charge the battery. (LFP : 55.2V = 3.45V/Cell for 16S battery)
yambms_bulk_v: '55.2'
# Float Voltage : corresponds to the voltage at which the battery would be maintained at the end of charge. (LFP : 53.6V = 3.35V/Cell for 16S battery)
yambms_float_v: '53.6'
# Rebulk voltage, voltage from which a new Bulk charge can start. (LFP : 52.8V = 3.3V/Cell for 16S battery)
yambms_rebulk_v: '52.8'
# Maximum time in minutes that the cut-off step can last before charging is complete
# If your cells are properly balanced this step ends at the fastest after the `cut-off timer`
# This timer can be deactivated with a switch
yambms_eoc_timer: '30'
# Time in seconds during which the end of charge conditions must be respected (cut-off + cells not equalizing)
yambms_cutoff_timer: '60'
# Max. charge current : corresponds to the maximum charge current which may be requested by YamBMS.
# The current requested will be proportional to the BMS count without ever exceeding this value.
yambms_max_requested_charge_current: '300' # in Ampere
# Max. discharge current : corresponds to the maximum discharge current which may be requested by YamBMS.
# The current requested will be proportional to the BMS count without ever exceeding this value.
yambms_max_requested_discharge_current: '300' # in Ampere
# +-------------------------------------------------------------------------
# | Temperature-based current limitation
# | Can be disabled via the switch "Temperature-based current limitation"
# | This factor is applied to the battery capacity (Ah), not the current
# | maximum charge/discharge current. For example : 280Ah x 0.5 = 140A
# +-------------------------------------------------------------------------
# Temperature °C -> Charge Rate (0.0C to 1.0C)
yambms_charging_rate_table: |
{
{ -0.1, 0.00 },
{ 0.0, 0.05 },
{ 5.0, 0.12 },
{ 10.0, 0.30 },
{ 20.0, 0.50 },
{ 25.0, 0.50 },
{ 45.0, 0.50 },
{ 50.0, 0.50 },
{ 55.0, 0.50 },
{ 60.0, 0.00 }
}
# Temperature °C -> Discharge Rate (0.0C to 1.0C)
yambms_discharging_rate_table: |
{
{-30.0, 0.00 },
{-20.0, 0.50 },
{-10.0, 0.50 },
{ -5.0, 0.50 },
{ 0.0, 0.50 },
{ 5.0, 0.50 },
{ 45.0, 0.50 },
{ 50.0, 0.50 },
{ 55.0, 0.50 },
{ 60.0, 0.00 }
}
# +--------------------------------------+
# | Shunt Settings |
# +--------------------------------------+
shunt_update_interval: '3s' # frequency at which Shunt data is refreshed
# +--------------------------------------+
# | BMS Settings |
# +--------------------------------------+
bms_update_interval: '3s' # frequency at which BMS data is refreshed, going below '3s' can cause problems
# +--------------------------------------+
# | Health & LED Assignment Logs |
# +--------------------------------------+
enable_led_logging: 'false' # Set to true to see if an led is assigned to a component correctly, logged every 60 seconds
enable_health_logging: 'false' # Set to true to see if component health for all component instances, logged every 60 seconds
# +--------------------------------------+
# | Packages |
# +--------------------------------------+
# PLEASE READ : https://github.com/Sleeper85/esphome-yambms/blob/main/documents/README/YamBMS_RP_YAML.md
packages:
remote_packages:
url: https://github.com/Sleeper85/esphome-yambms
ref: main
refresh: 60min
files:
# +------------------------------------------------------------------------------+
# | >>> UNCOMMENT YOUR BOARD
# | >>> ONLY ONE BOARD !
# +------------------------------------------------------------------------------+
- path: 'packages/board/board_ESP32_Generic.yaml'
# - path: 'packages/board/board_ESP32_Atom-Lite.yaml'
# - path: 'packages/board/board_ESP32_DevKit-V1.yaml'
# - path: 'packages/board/board_ESP32_EVB.yaml'
# - path: 'packages/board/board_ESP32_iBMS_CAN_RS485_V3.3.yaml'
# - path: 'packages/board/board_ESP32_LilyGo-T-CAN485.yaml'
# - path: 'packages/board/board_ESP32-C3_DevKitM-1.yaml'
# - path: 'packages/board/board_ESP32-C3_ETH01-EVO.yaml'
# - path: 'packages/board/board_ESP32-C3_FlipC3.yaml'
# - path: 'packages/board/board_ESP32-S3_AtomS3-Lite.yaml'
# - path: 'packages/board/board_ESP32-S3_AtomS3.yaml'
# - path: 'packages/board/board_ESP32-S3_AtomS3R.yaml'
# - path: 'packages/board/board_ESP32-S3_DevKitC-1_LED-38.yaml'
# - path: 'packages/board/board_ESP32-S3_DevKitC-1_LED-48.yaml'
# - path: 'packages/board/board_ESP32-S3_LilyGo-T-Connect.yaml'
# - path: 'packages/board/board_ESP32-S3_LilyGo-T-Connect-Pro.yaml'
# - path: 'packages/board/board_ESP32-S3_WS-ETH.yaml'
# - path: 'packages/board/board_ESP32-S3_WS-RS485-CAN.yaml'
# - path: 'packages/board/board_ESP32-S3_WS-Touch-LCD-4.3.yaml'
# - path: 'packages/board/board_ESP32-S3_WS-Touch-LCD-7.yaml'
# - path: 'packages/board/board_ESP32-S3_XIAO.yaml'
# - path: 'packages/board/board_ESP32-S3_YBoard.yaml'
# vars:
# server_status_led_id: 'virtual_status_light' # led used to show status. Default = esp_light, set specific led or set to 'virtual_status_light' to disable
# network_status_led_id: 'virtual_status_light' # led used to show status. Default = esp_light, set specific led or set to 'virtual_status_light' to disable
# +------------------------------------------------------------------------------+
# | >>> Board Display
# | >>> Uncomment the display that corresponds to your board
# +------------------------------------------------------------------------------+
# - path: 'packages/board/board_options_display_128x128.yaml' # AtomS3 / AtomS3R display
# - path: 'packages/board/board_options_display_480x222.yaml' # LilyGo T-Connect Pro display
# vars:
# display_auto_next_page_interval: '5s'
# display_rotation: '0' # 0/90/180/270 rotation angle in degrees
# +------------------------------------------------------------------------------+
# | >>> Board Options
# | >>> Uncomment your interfaces and options
# +------------------------------------------------------------------------------+
# UART 1 (uart_id: uart_esp_1)
- path: 'packages/board/board_options_itf_uart_esp_1.yaml'
# UART 2 (uart_id: uart_esp_2)
# - path: 'packages/board/board_options_itf_uart_esp_2.yaml'
# UART 3 (uart_id: uart_esp_3)
# - path: 'packages/board/board_options_itf_uart_esp_3.yaml'
# UART flow control
# - path: 'packages/board/board_options_itf_uart_flow_control.yaml'
# vars:
# uart_id: 'uart_esp_1'
# uart_flow_control_pin: ${talk_pin}
# CAN transceiver - ESP32_CAN (TJA105x, SN65HVD230, M5Stack CAN base/unit)
- path: 'packages/board/board_options_itf_canbus_esp32_can.yaml'
vars:
# to bms = canbus_bms_1
# to inverter = canbus_inverter_1
canbus_node_id: 'canbus_inverter_1'
# CAN transceiver - MCP2515
# - path: 'packages/board/board_options_itf_canbus_mcp2515.yaml'
# vars:
# # to bms = canbus_bms_1
# # to inverter = canbus_inverter_1
# canbus_node_id: 'canbus_inverter_1'
# PSRAM octal 80Mhz
# - path: 'packages/board/board_options_PSRAM_octal_80Mhz.yaml'
# Web Server
# - path: 'packages/yambms/yambms_web_server.yaml'
# WiFi AP @ 192.168.4.1
# - path: 'packages/board/board_options_wifi_ap.yaml'
# Captive Portal @ 192.168.4.1
# - path: 'packages/board/board_options_captive_portal.yaml'
# +------------------------------------------------------------------------------+
# | >>> BMS / Balancer / Shunt
# +------------------------------------------------------------------------------+
# You don't have to import a shunt but you must import at least one BMS.
# You can mix different BMS models, the only condition is that the `bms_id` are numbered in order starting from 1 !
# >>> Copy your BMS / Balancer / Shunt packages here
# >>> You can find examples at this address :
# >>> https://github.com/Sleeper85/esphome-yambms/tree/main/examples/single-node/
# Ecoworthy Modbus - Include this ONCE per RS485 bus
- path: 'packages/bms/bms_combine_Ecoworthy_RS485_modbus.yaml'
vars:
ecoworthy_modbus_uart_id: 'uart_esp_1'
ecoworthy_modbus_baud_rate: '9600'
# BMS 1
- path: 'packages/bms/bms_combine_Ecoworthy_RS485.yaml'
vars:
bms_id: '1' # must be a number
bms_name: 'Ecoworthy-BMS 1'
bms_address: '0x01' # BMS 1 modbus address (usually 0x01 for master)
bms_max_charge_current: '100' # A. Max charge current
bms_max_discharge_current: '100' # A. Max discharge current
bms_cell_ovp: '3.650' # V. Cell over-voltage protection
bms_cell_uvp: '2.500' # V. Cell under-voltage protection
bms_balance_trigger_voltage: '0.030' # V. Balance trigger voltage
bms_status_led_id: 'esp_light' # led used to show status. Default = esp_light, comment out to disable
# BMS 2
- path: 'packages/bms/bms_combine_Ecoworthy_RS485.yaml'
vars:
bms_id: '2' # must be a number
bms_name: 'Ecoworthy-BMS 2'
bms_address: '0x02' # BMS 2 modbus address
bms_max_charge_current: '100' # A. Max charge current
bms_max_discharge_current: '100' # A. Max discharge current
bms_cell_ovp: '3.650' # V. Cell over-voltage protection
bms_cell_uvp: '2.500' # V. Cell under-voltage protection
bms_balance_trigger_voltage: '0.030' # V. Balance trigger voltage
bms_status_led_id: 'esp_light' # led used to show status. Default = esp_light, comment out to disable
# +------------------------------------------------------------------------------+
# | >>> YamBMS
# +------------------------------------------------------------------------------+
- path: 'packages/yambms/yambms.yaml'
# +------------------------------------------------------------------------------+
# | >>> CAN bus to Inverter
# +------------------------------------------------------------------------------+
- path: 'packages/yambms/yambms_canbus.yaml' # yambms_canbus_web_server.yaml
vars:
canbus_id: '1' # Must be a number
canbus_name: 'CANBUS 1'
canbus_node_id: 'canbus_inverter_1' # CAN bus node to which your inverter is connected
canbus_status_led_id: 'esp_light' # led used to show status. Default = esp_light, comment out to disable
# The CANBUS link will be considered down if no response from the inverter (ID 0x305) for 5s
# The Deye inverter sends the ACK (can_id 0x305) only when it receives the can_id 0x356
canbus_link_timer: '5s'
# +------------------------------------------------------------------------------+
# | >>> RS485 bus to Inverter
# +------------------------------------------------------------------------------+
# - path: 'packages/yambms/yambms_rs485_pylon.yaml' # yambms_rs485_pylon_web_server.yaml
# vars:
# rs485_id: '1' # Must be a number
# rs485_name: 'RS485 1'
# rs485_uart_id: 'uart_esp_3' # UART interface to which your inverter is connected
# rs485_uart_baud_rate: '9600'
# rs485_update_timeout: '5s'
# rs485_status_led_id: 'esp_light' # led used to show status. Default = esp_light, comment out to disable
# +------------------------------------------------------------------------------+
# | >>> DEBUG ( logger level must be DEBUG )
# +------------------------------------------------------------------------------+
- path: packages/base/device_debug_ESP32.yaml
# - path: packages/base/device_debug_ESP32_PSRAM.yaml
vars:
debug_name: 'Debug'
debug_update_interval: '5s'
# Size of your PSRAM in bits
# 8Mb='8388608' | 6Mb='6291456' | 4Mb='4194304' | 2Mb='2097152' | NoPSRAM='0'
debug_psram_size: '8388608'
# +------------------------------------------------------------------------------+
# | >>> Config and Custom Local Packages
# +------------------------------------------------------------------------------+
# Local Packages intended for creating custom codes
# or sharing settings between several main.yaml
# yambms_config: !include yambms_config.yaml
# yambms_custom: !include yambms_custom.yaml
@@ -0,0 +1,114 @@
# Updated : 2026.02.15
# Version : 1.1.1
# 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>.
############################ Local Packages Example ############################
# This is not a working YAML but just code ready to copy into
# your main YAML below the `packages:` section.
################################################################################
# Example A : Primary + secondary batteries (one BMS polls multiple batteries)
#
# The primary BMS component reads data for all batteries on the RS485 bus.
# Secondary batteries are exposed as separate YamBMS BMS entries using
# bms_combine_Ecoworthy_RS485_secondary.yaml.
#
# Set bms_battery_count on the primary to the total number of batteries.
################################################################################
packages:
# Ecoworthy Modbus - Include this ONCE per RS485 bus
ecoworthy_modbus: !include
file: packages/bms/bms_combine_Ecoworthy_RS485_modbus.yaml
vars:
ecoworthy_modbus_uart_id: 'uart_esp_1'
ecoworthy_modbus_baud_rate: '9600'
# Primary battery (BMS 1) - polls all batteries on the RS485 bus
bms1: !include
file: packages/bms/bms_combine_Ecoworthy_RS485.yaml
vars:
bms_id: '1' # must be a number
bms_name: 'Ecoworthy-BMS 1'
bms_address: '0x01' # BMS 1 modbus address (usually 0x01 for primary)
bms_battery_count: '3' # total batteries polled (1=primary only, 2+=primary+secondaries)
bms_cell_max_cycles: '6000.0'
bms_status_led_id: 'esp_light' # led used to show status. Default = esp_light, comment out to disable
# Secondary battery 2 (BMS 2) - data polled by primary
bms2: !include
file: packages/bms/bms_combine_Ecoworthy_RS485_secondary.yaml
vars:
bms_id: '2' # must be a number
bms_name: 'Ecoworthy-BMS 2'
parent_ecoworthy_bms_id: 'ecoworthy_bms1' # references the primary component
secondary_battery_number: '2'
bms_cell_max_cycles: '6000.0'
bms_status_led_id: 'esp_light'
# Secondary battery 3 (BMS 3) - data polled by primary
bms3: !include
file: packages/bms/bms_combine_Ecoworthy_RS485_secondary.yaml
vars:
bms_id: '3' # must be a number
bms_name: 'Ecoworthy-BMS 3'
parent_ecoworthy_bms_id: 'ecoworthy_bms1' # references the primary component
secondary_battery_number: '3'
bms_cell_max_cycles: '6000.0'
bms_status_led_id: 'esp_light'
################################################################################
# Example B : Multiple independent primaries (each BMS has its own address)
#
# Use this when each Ecoworthy BMS is independently addressed on the bus
# and you don't need the primary/secondary polling pattern.
# Protection thresholds (cell OVP/UVP) are read from BMS config registers.
################################################################################
# # Ecoworthy Modbus - Include this ONCE per RS485 bus
# ecoworthy_modbus: !include
# file: packages/bms/bms_combine_Ecoworthy_RS485_modbus.yaml
# vars:
# ecoworthy_modbus_uart_id: 'uart_esp_1'
# ecoworthy_modbus_baud_rate: '9600'
#
# # Ecoworthy BMS 1
# bms1: !include
# file: packages/bms/bms_combine_Ecoworthy_RS485.yaml
# vars:
# bms_id: '1' # must be a number
# bms_name: 'Ecoworthy-BMS 1'
# bms_address: '0x01' # BMS 1 modbus address (usually 0x01 for primary)
# bms_cell_max_cycles: '6000.0'
# bms_status_led_id: 'esp_light'
#
# # Ecoworthy BMS 2
# bms2: !include
# file: packages/bms/bms_combine_Ecoworthy_RS485.yaml
# vars:
# bms_id: '2' # must be a number
# bms_name: 'Ecoworthy-BMS 2'
# bms_address: '0x02' # BMS 2 modbus address
# bms_cell_max_cycles: '6000.0'
# bms_status_led_id: 'esp_light'
@@ -0,0 +1,107 @@
# Updated : 2026.02.15
# Version : 1.1.1
# 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>.
############################ Remote Packages Example ###########################
# This is not a working YAML but just code ready to copy into
# your main YAML below the `packages:` section.
# packages:
# remote_packages:
# url: https://github.com/Sleeper85/esphome-yambms
# ref: main
# refresh: 60s
# files:
################################################################################
# Example A : Primary + secondary batteries (one BMS polls multiple batteries)
#
# The primary BMS component reads data for all batteries on the RS485 bus.
# Secondary batteries are exposed as separate YamBMS BMS entries using
# bms_combine_Ecoworthy_RS485_secondary.yaml.
#
# Set bms_battery_count on the primary to the total number of batteries.
################################################################################
# Ecoworthy Modbus - Include this ONCE per RS485 bus
- path: 'packages/bms/bms_combine_Ecoworthy_RS485_modbus.yaml'
vars:
ecoworthy_modbus_uart_id: 'uart_esp_1'
ecoworthy_modbus_baud_rate: '9600'
# Primary battery (BMS 1) - polls all batteries on the RS485 bus
- path: 'packages/bms/bms_combine_Ecoworthy_RS485.yaml'
vars:
bms_id: '1' # must be a number
bms_name: 'Ecoworthy-BMS 1'
bms_address: '0x01' # BMS 1 modbus address (usually 0x01 for primary)
bms_battery_count: '3' # total batteries polled (1=primary only, 2+=primary+secondaries)
bms_cell_max_cycles: '6000.0'
bms_status_led_id: 'esp_light' # led used to show status. Default = esp_light, comment out to disable
# Secondary battery 2 (BMS 2) - data polled by primary
- path: 'packages/bms/bms_combine_Ecoworthy_RS485_secondary.yaml'
vars:
bms_id: '2' # must be a number
bms_name: 'Ecoworthy-BMS 2'
parent_ecoworthy_bms_id: 'ecoworthy_bms1' # references the primary component
secondary_battery_number: '2'
bms_cell_max_cycles: '6000.0'
bms_status_led_id: 'esp_light'
# Secondary battery 3 (BMS 3) - data polled by primary
- path: 'packages/bms/bms_combine_Ecoworthy_RS485_secondary.yaml'
vars:
bms_id: '3' # must be a number
bms_name: 'Ecoworthy-BMS 3'
parent_ecoworthy_bms_id: 'ecoworthy_bms1' # references the primary component
secondary_battery_number: '3'
bms_cell_max_cycles: '6000.0'
bms_status_led_id: 'esp_light'
################################################################################
# Example B : Multiple independent primaries (each BMS has its own address)
#
# Use this when each Ecoworthy BMS is independently addressed on the bus
# and you don't need the primary/secondary polling pattern.
# Protection thresholds (cell OVP/UVP) are read from BMS config registers.
################################################################################
# # Ecoworthy Modbus - Include this ONCE per RS485 bus
# - path: 'packages/bms/bms_combine_Ecoworthy_RS485_modbus.yaml'
# vars:
# ecoworthy_modbus_uart_id: 'uart_esp_1'
# ecoworthy_modbus_baud_rate: '9600'
# # Ecoworthy BMS 1
# - path: 'packages/bms/bms_combine_Ecoworthy_RS485.yaml'
# vars:
# bms_id: '1' # must be a number
# bms_name: 'Ecoworthy-BMS 1'
# bms_address: '0x01' # BMS 1 modbus address (usually 0x01 for primary)
# bms_cell_max_cycles: '6000.0'
# bms_status_led_id: 'esp_light'
# # Ecoworthy BMS 2
# - path: 'packages/bms/bms_combine_Ecoworthy_RS485.yaml'
# vars:
# bms_id: '2' # must be a number
# bms_name: 'Ecoworthy-BMS 2'
# bms_address: '0x02' # BMS 2 modbus address
# bms_cell_max_cycles: '6000.0'
# bms_status_led_id: 'esp_light'
@@ -0,0 +1,40 @@
# Updated : 2026.02.15
# Version : 1.0.1
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +--------------------------------------+
# | Ecoworthy BMS Combine Package |
# +--------------------------------------+
# This package is for the YamBMS client (single-node setup).
# It combines BMS data from Ecoworthy BMS via RS485 with YamBMS.
#
# Required substitutions:
# bms_id: The BMS ID number
# bms_name: Display name for the BMS
# bms_address: Modbus address of the BMS (0x01-0x0F)
#
# Optional substitutions (have defaults):
# ecoworthy_modbus_id: The ecoworthy_modbus component ID (default: modbus_ecoworthy)
substitutions:
bms_model: "Ecoworthy"
bms_protocol: "RS485"
packages:
bms_combine: !include bms_combine.yaml
bms_sensors: !include bms_sensors_Ecoworthy_RS485_full.yaml
@@ -0,0 +1,45 @@
# Updated : 2026.02.05
# Version : 1.0.1
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +--------------------------------------+
# | Ecoworthy Modbus Setup |
# +--------------------------------------+
# This package sets up the ecoworthy_modbus component for RS485 communication.
# Include this ONCE per RS485 bus, then include the BMS package for each BMS.
#
# Required substitutions:
# ecoworthy_modbus_uart_id: UART ID for RS485 (e.g., 'uart_esp_1')
# ecoworthy_modbus_baud_rate: Baud rate (default: 9600)
# ecoworthy_modbus_id: ID for the modbus component (e.g., 'modbus_ecoworthy')
substitutions:
ecoworthy_modbus_id: modbus_ecoworthy
ecoworthy_modbus_baud_rate: '9600'
external_components:
- source: github://RAR/esphome-ecoworthy-bms@v1.0.0
refresh: 0s
uart:
- id: !extend ${ecoworthy_modbus_uart_id}
baud_rate: ${ecoworthy_modbus_baud_rate}
ecoworthy_modbus:
- id: ${ecoworthy_modbus_id}
uart_id: ${ecoworthy_modbus_uart_id}
@@ -0,0 +1,47 @@
# Updated : 2026.02.08
# Version : 1.0.0
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +--------------------------------------+
# | Ecoworthy BMS Secondary Combine Pkg |
# +--------------------------------------+
# This package is for secondary batteries in a single-node setup.
# It combines secondary battery data from an Ecoworthy BMS with YamBMS.
#
# The primary component must be configured with battery_count >= secondary_battery_number
#
# Required substitutions:
# bms_id: The YamBMS BMS ID number for this secondary
# bms_name: Display name for this secondary BMS
# parent_ecoworthy_bms_id: ID of the parent ecoworthy_bms component (e.g., 'ecoworthy_bms1')
# secondary_battery_number: The secondary battery number (2, 3, 4, etc.)
#
# Optional substitutions (have defaults):
# bms_max_charge_current: Max charge current in A (default: 100)
# bms_max_discharge_current: Max discharge current in A (default: 100)
# bms_cell_ovp: Cell over-voltage protection in V (default: 3.650)
# bms_cell_uvp: Cell under-voltage protection in V (default: 2.500)
# bms_balance_trigger_voltage: Balance trigger voltage in V (default: 0.030)
substitutions:
bms_model: "Ecoworthy Secondary"
bms_protocol: "RS485"
packages:
bms_combine: !include bms_combine.yaml
bms_sensors: !include bms_sensors_Ecoworthy_RS485_secondary.yaml
@@ -0,0 +1,152 @@
# Updated : 2026.02.02
# Version : 1.0.0
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +--------------------------------------+
# | Ecoworthy Errors Bitmask |
# +--------------------------------------+
# Maps Ecoworthy fault_bitmask (32-bit) and alarm_bitmask (32-bit) to
# +--------------------------------------+
# | YamBMS Errors Bitmask (16bit) |
# +--------------------------------------+
# Ecoworthy Fault Bits (from ecoworthy_bms.cpp):
# Bit 0: Cell OV Bit 12: MOS HT
# Bit 1: Cell UV Bit 13: Ambient HT
# Bit 2: Pack OV Bit 14: Ambient LT
# Bit 3: Pack UV Bit 15: Cell V Diff
# Bit 4: Charge OC Slow Bit 16: Temp Diff
# Bit 5: Charge OC Fast Bit 17: SOC Low
# Bit 6: Discharge OC Slow Bit 18: Short Circuit
# Bit 7: Discharge OC Fast Bit 19: Cell Offline
# Bit 8: Charge HT Bit 20: Temp Sensor Fail
# Bit 9: Charge LT Bit 21: Charge MOS Fault
# Bit 10: Discharge HT Bit 22: Discharge MOS Fault
# Bit 11: Discharge LT Bit 23: AFE Comm Error
# YamBMS Error Bits:
# Bit 0 General alarm 0x0001
# Bit 1 Battery high voltage alarm 0x0002
# Bit 2 Battery low voltage alarm 0x0004
# Bit 3 Battery high temperature alarm 0x0008
# Bit 4 Battery low temperature alarm 0x0010
# Bit 5 Battery high temperature charge alarm 0x0020
# Bit 6 Battery low temperature charge alarm 0x0040
# Bit 7 Battery high discharge current alarm 0x0080
# Bit 8 Battery high charge current alarm 0x0100
# Bit 9 Contactor alarm 0x0200
# Bit 10 Short circuit alarm 0x0400
# Bit 11 BMS internal alarm 0x0800
# Bit 12 Cell imbalance alarm 0x1000
# Bit 13 Reserved 0x2000
# Bit 14 Reserved 0x4000
# Bit 15 Reserved 0x8000
sensor:
- platform: template
id: bms${bms_id}_yambms_errors_bitmask
device_id: bms_${bms_id}
name: "YamBMS Errors Bitmask"
update_interval: ${bms_update_interval}
accuracy_decimals: 0
icon: mdi:alert-circle-outline
filters:
- or:
- throttle: 10s
- delta: 1
lambda: |-
uint16_t yambms_errors = 0;
// Get fault and alarm bitmasks
uint32_t fault = 0;
uint32_t alarm = 0;
if (!std::isnan(id(bms${bms_id}_fault_bitmask).state)) {
fault = static_cast<uint32_t>(id(bms${bms_id}_fault_bitmask).state);
}
if (!std::isnan(id(bms${bms_id}_alarm_bitmask).state)) {
alarm = static_cast<uint32_t>(id(bms${bms_id}_alarm_bitmask).state);
}
// If any fault or alarm, set general alarm (bit 0)
if (fault != 0 || alarm != 0) {
yambms_errors |= 0x0001;
}
// High voltage alarm (bit 1): Cell OV (bit 0) or Pack OV (bit 2)
if ((fault & 0x05) || (alarm & 0x05)) {
yambms_errors |= 0x0002;
}
// Low voltage alarm (bit 2): Cell UV (bit 1) or Pack UV (bit 3)
if ((fault & 0x0A) || (alarm & 0x0A)) {
yambms_errors |= 0x0004;
}
// High temperature alarm (bit 3): Discharge HT (bit 10), MOS HT (bit 12), Ambient HT (bit 13)
if ((fault & 0x3400) || (alarm & 0x0C00)) {
yambms_errors |= 0x0008;
}
// Low temperature alarm (bit 4): Discharge LT (bit 11), Ambient LT (bit 14)
if ((fault & 0x4800) || (alarm & 0x1000)) {
yambms_errors |= 0x0010;
}
// High temperature charge alarm (bit 5): Charge HT (bit 8)
if ((fault & 0x100) || (alarm & 0x40)) {
yambms_errors |= 0x0020;
}
// Low temperature charge alarm (bit 6): Charge LT (bit 9)
if ((fault & 0x200) || (alarm & 0x80)) {
yambms_errors |= 0x0040;
}
// High discharge current alarm (bit 7): Discharge OC Slow/Fast (bits 6-7)
if ((fault & 0xC0) || (alarm & 0x20)) {
yambms_errors |= 0x0080;
}
// High charge current alarm (bit 8): Charge OC Slow/Fast (bits 4-5)
if ((fault & 0x30) || (alarm & 0x10)) {
yambms_errors |= 0x0100;
}
// Contactor/MOS alarm (bit 9): Charge MOS Fault (bit 21), Discharge MOS Fault (bit 22)
if (fault & 0x600000) {
yambms_errors |= 0x0200;
}
// Short circuit alarm (bit 10): Short Circuit (bit 18)
if (fault & 0x40000) {
yambms_errors |= 0x0400;
}
// BMS internal alarm (bit 11): AFE Comm Error (bit 23), Cell Offline (bit 19),
// Temp Sensor Fail (bit 20), EEP Fault (alarm bit 16), RTC Abnormal (alarm bit 17)
if ((fault & 0xB80000) || (alarm & 0x30000)) {
yambms_errors |= 0x0800;
}
// Cell imbalance alarm (bit 12): Cell V Diff (bit 15), Temp Diff (bit 16)
if ((fault & 0x18000) || (alarm & 0x6000)) {
yambms_errors |= 0x1000;
}
return yambms_errors;
@@ -0,0 +1,139 @@
# Updated : 2026.02.03
# Version : 1.0.0
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +--------------------------------------+
# | Ecoworthy SECONDARY Errors Bitmask |
# +--------------------------------------+
# Maps Ecoworthy fault_bitmask (32-bit) and alarm_bitmask (32-bit) to
# YamBMS Errors Bitmask (16bit)
#
# This is identical to the primary version - secondary batteries expose
# the same fault/alarm bitmask format via Pack Status polling.
# YamBMS Error Bits:
# Bit 0 General alarm 0x0001
# Bit 1 Battery high voltage alarm 0x0002
# Bit 2 Battery low voltage alarm 0x0004
# Bit 3 Battery high temperature alarm 0x0008
# Bit 4 Battery low temperature alarm 0x0010
# Bit 5 Battery high temperature charge alarm 0x0020
# Bit 6 Battery low temperature charge alarm 0x0040
# Bit 7 Battery high discharge current alarm 0x0080
# Bit 8 Battery high charge current alarm 0x0100
# Bit 9 Contactor alarm 0x0200
# Bit 10 Short circuit alarm 0x0400
# Bit 11 BMS internal alarm 0x0800
# Bit 12 Cell imbalance alarm 0x1000
# Bit 13 Reserved 0x2000
# Bit 14 Reserved 0x4000
# Bit 15 Reserved 0x8000
sensor:
- platform: template
id: bms${bms_id}_yambms_errors_bitmask
device_id: bms_${bms_id}
name: "YamBMS Errors Bitmask"
update_interval: ${bms_update_interval}
accuracy_decimals: 0
icon: mdi:alert-circle-outline
filters:
- or:
- throttle: 10s
- delta: 1
lambda: |-
uint16_t yambms_errors = 0;
// Get fault and alarm bitmasks
uint32_t fault = 0;
uint32_t alarm = 0;
if (!std::isnan(id(bms${bms_id}_fault_bitmask).state)) {
fault = static_cast<uint32_t>(id(bms${bms_id}_fault_bitmask).state);
}
if (!std::isnan(id(bms${bms_id}_alarm_bitmask).state)) {
alarm = static_cast<uint32_t>(id(bms${bms_id}_alarm_bitmask).state);
}
// If any fault or alarm, set general alarm (bit 0)
if (fault != 0 || alarm != 0) {
yambms_errors |= 0x0001;
}
// High voltage alarm (bit 1): Cell OV (bit 0) or Pack OV (bit 2)
if ((fault & 0x05) || (alarm & 0x05)) {
yambms_errors |= 0x0002;
}
// Low voltage alarm (bit 2): Cell UV (bit 1) or Pack UV (bit 3)
if ((fault & 0x0A) || (alarm & 0x0A)) {
yambms_errors |= 0x0004;
}
// High temperature alarm (bit 3): Discharge HT (bit 10), MOS HT (bit 12), Ambient HT (bit 13)
if ((fault & 0x3400) || (alarm & 0x0C00)) {
yambms_errors |= 0x0008;
}
// Low temperature alarm (bit 4): Discharge LT (bit 11), Ambient LT (bit 14)
if ((fault & 0x4800) || (alarm & 0x1000)) {
yambms_errors |= 0x0010;
}
// High temperature charge alarm (bit 5): Charge HT (bit 8)
if ((fault & 0x100) || (alarm & 0x40)) {
yambms_errors |= 0x0020;
}
// Low temperature charge alarm (bit 6): Charge LT (bit 9)
if ((fault & 0x200) || (alarm & 0x80)) {
yambms_errors |= 0x0040;
}
// High discharge current alarm (bit 7): Discharge OC Slow/Fast (bits 6-7)
if ((fault & 0xC0) || (alarm & 0x20)) {
yambms_errors |= 0x0080;
}
// High charge current alarm (bit 8): Charge OC Slow/Fast (bits 4-5)
if ((fault & 0x30) || (alarm & 0x10)) {
yambms_errors |= 0x0100;
}
// Contactor/MOS alarm (bit 9): Charge MOS Fault (bit 21), Discharge MOS Fault (bit 22)
if (fault & 0x600000) {
yambms_errors |= 0x0200;
}
// Short circuit alarm (bit 10): Short Circuit (bit 18)
if (fault & 0x40000) {
yambms_errors |= 0x0400;
}
// BMS internal alarm (bit 11): AFE Comm Error (bit 23), Cell Offline (bit 19),
// Temp Sensor Fail (bit 20), EEP Fault (alarm bit 16), RTC Abnormal (alarm bit 17)
if ((fault & 0xB80000) || (alarm & 0x30000)) {
yambms_errors |= 0x0800;
}
// Cell imbalance alarm (bit 12): Cell V Diff (bit 15), Temp Diff (bit 16)
if ((fault & 0x18000) || (alarm & 0x6000)) {
yambms_errors |= 0x1000;
}
return yambms_errors;
@@ -0,0 +1,26 @@
# Updated : 2026.02.15
# Version : 1.0.0
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
substitutions:
bms_model: "Ecoworthy RS485"
bms_protocol: "Multi-node"
packages:
bms_sensors: !include bms_sensors_Ecoworthy_RS485_full.yaml
bms_combine: !include bms_modbus_server.yaml
@@ -0,0 +1,26 @@
# Updated : 2026.02.15
# Version : 1.0.0
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
substitutions:
bms_model: "Ecoworthy Secondary"
bms_protocol: "Multi-node"
packages:
bms_sensors: !include bms_sensors_Ecoworthy_RS485_secondary.yaml
bms_combine: !include bms_modbus_server.yaml
@@ -0,0 +1,636 @@
# Updated : 2026.02.05
# Version : 1.1.1
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +--------------------------------------+
# | Ecoworthy BMS RS485 Sensor Package |
# +--------------------------------------+
# This package integrates the Ecoworthy BMS component with YamBMS.
# This is the PRIMARY package - use bms_sensors_Ecoworthy_RS485_secondary.yaml
# for secondary batteries polled through this primary.
#
# Required substitutions:
# bms_id: The BMS ID number
# bms_name: Display name for the BMS
# bms_address: Modbus address of the BMS (0x01-0x0F)
# ecoworthy_modbus_id: The ecoworthy_modbus component ID
# bms_update_interval: Update interval (e.g., '3s')
#
# Optional substitutions:
# bms_battery_count: Number of batteries to poll (1=primary only, 2+=primary+secondaries)
#
# Note: Protection thresholds (cell OVP/UVP, pack OVP/UVP) and balance settings
# are now read directly from BMS config registers
substitutions:
bms_battery_count: '1'
packages:
bms_base: !include bms_base.yaml
bms_temperature_sensor: !include bms_temperature_sensor_4.yaml
bms_errors_bitmask: !include bms_errors_bitmask_Ecoworthy.yaml
led_assign: !include bms_base_led_assign.yaml
# +--------------------------------------+
# | Component settings |
# +--------------------------------------+
external_components:
- source: github://RAR/esphome-ecoworthy-bms@v1.0.0
refresh: 0s
ecoworthy_bms:
- id: ecoworthy_bms${bms_id}
address: ${bms_address}
ecoworthy_modbus_id: ${ecoworthy_modbus_id}
update_interval: ${bms_update_interval}
battery_count: ${bms_battery_count}
# +--------------------------------------+
# | Component entities |
# +--------------------------------------+
binary_sensor:
# online_status
- platform: ecoworthy_bms
ecoworthy_bms_id: ecoworthy_bms${bms_id}
online_status:
id: bms${bms_id}_online_status
device_id: bms_${bms_id}
name: "online status"
trigger_on_initial_state: true
on_state:
then:
- lambda: |-
// Pass the current state to the update function
id(global_update_fault)(${CAT_BMS}, ${bms_id}, !x);
balancing:
id: bms${bms_id}_bms_equalizing
device_id: bms_${bms_id}
name: "balancing"
# MOS status and charging/discharging state from component
- platform: ecoworthy_bms
ecoworthy_bms_id: ecoworthy_bms${bms_id}
# charging = actively charging right now (current flowing in)
charging:
device_id: bms_${bms_id}
name: "charging active"
# discharging = actively discharging right now (current flowing out)
discharging:
device_id: bms_${bms_id}
name: "discharging active"
# charging_switch = charging is allowed/permitted (MOS on)
charging_switch:
id: bms${bms_id}_charge_mos_internal
device_id: bms_${bms_id}
internal: true
# discharging_switch = discharging is allowed/permitted (MOS on)
discharging_switch:
id: bms${bms_id}_discharge_mos_internal
device_id: bms_${bms_id}
internal: true
# bms_switch_charging - YamBMS uses this to check if charging is ALLOWED (MOS on)
- platform: template
id: bms${bms_id}_charging_allowed
device_id: bms_${bms_id}
name: "charging"
lambda: |-
return id(bms${bms_id}_charge_mos_internal).state;
# bms_switch_discharging - YamBMS uses this to check if discharging is ALLOWED (MOS on)
- platform: template
id: bms${bms_id}_discharging_allowed
device_id: bms_${bms_id}
name: "discharging"
lambda: |-
return id(bms${bms_id}_discharge_mos_internal).state;
switch:
- platform: ecoworthy_bms
ecoworthy_bms_id: ecoworthy_bms${bms_id}
charging:
id: bms${bms_id}_charge_switch
device_id: bms_${bms_id}
name: "Charge switch"
discharging:
id: bms${bms_id}_discharge_switch
device_id: bms_${bms_id}
name: "Discharge switch"
sensor:
- platform: ecoworthy_bms
ecoworthy_bms_id: ecoworthy_bms${bms_id}
total_voltage:
id: bms${bms_id}_total_voltage
device_id: bms_${bms_id}
name: "total voltage"
current:
id: bms${bms_id}_current
device_id: bms_${bms_id}
name: "current"
power:
id: bms${bms_id}_power
device_id: bms_${bms_id}
name: "power"
charging_power:
id: bms${bms_id}_charging_power
device_id: bms_${bms_id}
name: "charging power"
discharging_power:
id: bms${bms_id}_discharging_power
device_id: bms_${bms_id}
name: "discharging power"
remaining_capacity:
id: bms${bms_id}_capacity_remaining_ah
device_id: bms_${bms_id}
name: "remaining capacity"
full_capacity:
id: bms${bms_id}_battery_capacity
device_id: bms_${bms_id}
name: "total capacity"
rated_capacity:
device_id: bms_${bms_id}
name: "rated capacity"
state_of_charge:
id: bms${bms_id}_state_of_charge
device_id: bms_${bms_id}
name: "state of charge"
state_of_health:
id: bms${bms_id}_battery_soh
device_id: bms_${bms_id}
name: "state of health"
cycle_count:
id: bms${bms_id}_charging_cycles_raw
device_id: bms_${bms_id}
name: "cycle"
min_cell_voltage:
id: bms${bms_id}_min_cell_voltage
device_id: bms_${bms_id}
name: "min cell voltage"
max_cell_voltage:
id: bms${bms_id}_max_cell_voltage
device_id: bms_${bms_id}
name: "max cell voltage"
delta_cell_voltage:
id: bms${bms_id}_delta_cell_voltage
device_id: bms_${bms_id}
name: "delta cell voltage"
average_cell_voltage:
id: bms${bms_id}_cell_average_voltage
device_id: bms_${bms_id}
name: "cell average voltage"
min_voltage_cell:
id: bms${bms_id}_min_voltage_cell
device_id: bms_${bms_id}
name: "min voltage cell"
max_voltage_cell:
id: bms${bms_id}_max_voltage_cell
device_id: bms_${bms_id}
name: "max voltage cell"
cell_voltage_1:
id: bms${bms_id}_cell_voltage_1
device_id: bms_${bms_id}
name: "cell voltage 01"
cell_voltage_2:
id: bms${bms_id}_cell_voltage_2
device_id: bms_${bms_id}
name: "cell voltage 02"
cell_voltage_3:
id: bms${bms_id}_cell_voltage_3
device_id: bms_${bms_id}
name: "cell voltage 03"
cell_voltage_4:
id: bms${bms_id}_cell_voltage_4
device_id: bms_${bms_id}
name: "cell voltage 04"
cell_voltage_5:
id: bms${bms_id}_cell_voltage_5
device_id: bms_${bms_id}
name: "cell voltage 05"
cell_voltage_6:
id: bms${bms_id}_cell_voltage_6
device_id: bms_${bms_id}
name: "cell voltage 06"
cell_voltage_7:
id: bms${bms_id}_cell_voltage_7
device_id: bms_${bms_id}
name: "cell voltage 07"
cell_voltage_8:
id: bms${bms_id}_cell_voltage_8
device_id: bms_${bms_id}
name: "cell voltage 08"
cell_voltage_9:
id: bms${bms_id}_cell_voltage_9
device_id: bms_${bms_id}
name: "cell voltage 09"
cell_voltage_10:
id: bms${bms_id}_cell_voltage_10
device_id: bms_${bms_id}
name: "cell voltage 10"
cell_voltage_11:
id: bms${bms_id}_cell_voltage_11
device_id: bms_${bms_id}
name: "cell voltage 11"
cell_voltage_12:
id: bms${bms_id}_cell_voltage_12
device_id: bms_${bms_id}
name: "cell voltage 12"
cell_voltage_13:
id: bms${bms_id}_cell_voltage_13
device_id: bms_${bms_id}
name: "cell voltage 13"
cell_voltage_14:
id: bms${bms_id}_cell_voltage_14
device_id: bms_${bms_id}
name: "cell voltage 14"
cell_voltage_15:
id: bms${bms_id}_cell_voltage_15
device_id: bms_${bms_id}
name: "cell voltage 15"
cell_voltage_16:
id: bms${bms_id}_cell_voltage_16
device_id: bms_${bms_id}
name: "cell voltage 16"
temperature_sensor_1:
id: bms${bms_id}_temperature_sensor_1
device_id: bms_${bms_id}
name: "cell temperature 1"
temperature_sensor_2:
id: bms${bms_id}_temperature_sensor_2
device_id: bms_${bms_id}
name: "cell temperature 2"
temperature_sensor_3:
id: bms${bms_id}_temperature_sensor_3
device_id: bms_${bms_id}
name: "cell temperature 3"
temperature_sensor_4:
id: bms${bms_id}_temperature_sensor_4
device_id: bms_${bms_id}
name: "cell temperature 4"
power_tube_temperature:
device_id: bms_${bms_id}
name: "mosfet temperature"
ambient_temperature:
device_id: bms_${bms_id}
name: "ambient temperature"
# min_temperature and max_temperature are provided by bms_temperature_sensor_4.yaml
avg_temperature:
device_id: bms_${bms_id}
name: "average temperature"
charge_voltage_limit:
device_id: bms_${bms_id}
name: "charge voltage limit"
charge_current_limit:
device_id: bms_${bms_id}
name: "total pack max charging current"
discharge_voltage_limit:
device_id: bms_${bms_id}
name: "discharge voltage limit"
discharge_current_limit:
device_id: bms_${bms_id}
name: "total pack max discharge current"
# Individual battery limits from 0x45 (primary only, not aggregated)
individual_charge_current_limit:
device_id: bms_${bms_id}
name: "individual max charging current"
individual_discharge_current_limit:
device_id: bms_${bms_id}
name: "individual max discharge current"
# Configured (static) limits from BMS config - used by YamBMS combine logic
# These never go to 0 when the battery is full, unlike the dynamic limits
configured_ccl:
id: bms${bms_id}_max_charge_current
device_id: bms_${bms_id}
name: "max charging current"
configured_dcl:
id: bms${bms_id}_max_discharge_current
device_id: bms_${bms_id}
name: "max discharge current"
fault_bitmask:
id: bms${bms_id}_fault_bitmask
device_id: bms_${bms_id}
name: "fault bitmask"
internal: true
alarm_bitmask:
id: bms${bms_id}_alarm_bitmask
device_id: bms_${bms_id}
name: "alarm bitmask"
internal: true
mosfet_status_bitmask:
id: bms${bms_id}_mosfet_bitmask
device_id: bms_${bms_id}
name: "mosfet status bitmask"
balancing_bitmask:
id: bms${bms_id}_balancing_bitmask
device_id: bms_${bms_id}
name: "balancing bitmask"
# Balance trigger voltage from BMS config (used by balancer template sensor)
balance_voltage:
id: bms${bms_id}_bms_balance_trigger_voltage
internal: true
# Balance difference threshold from BMS config
balance_difference:
device_id: bms_${bms_id}
name: "balance difference"
filters:
- throttle: 60s
# Cell protection thresholds from BMS config (rarely change)
cell_ovp_trigger:
id: bms${bms_id}_cell_ovp
device_id: bms_${bms_id}
name: "cell ovp"
filters:
- throttle: 60s
cell_ovp_release:
device_id: bms_${bms_id}
name: "cell ovp release"
filters:
- throttle: 60s
cell_uvp_trigger:
id: bms${bms_id}_cell_uvp
device_id: bms_${bms_id}
name: "cell uvp"
filters:
- throttle: 60s
cell_uvp_release:
device_id: bms_${bms_id}
name: "cell uvp release"
filters:
- throttle: 60s
# Pack protection thresholds from BMS config (rarely change)
pack_ovp_trigger:
device_id: bms_${bms_id}
name: "pack ovp"
filters:
- throttle: 60s
pack_ovp_release:
device_id: bms_${bms_id}
name: "pack ovp release"
filters:
- throttle: 60s
pack_uvp_trigger:
device_id: bms_${bms_id}
name: "pack uvp"
filters:
- throttle: 60s
pack_uvp_release:
device_id: bms_${bms_id}
name: "pack uvp release"
filters:
- throttle: 60s
# Temperature protection thresholds from BMS config (rarely change)
charge_ot_trigger:
device_id: bms_${bms_id}
name: "charge ot trigger"
filters:
- throttle: 60s
charge_ot_release:
device_id: bms_${bms_id}
name: "charge ot release"
filters:
- throttle: 60s
charge_ot_delay:
device_id: bms_${bms_id}
name: "charge ot delay"
filters:
- throttle: 60s
charge_ut_trigger:
device_id: bms_${bms_id}
name: "charge ut trigger"
filters:
- throttle: 60s
charge_ut_release:
device_id: bms_${bms_id}
name: "charge ut release"
filters:
- throttle: 60s
charge_ut_delay:
device_id: bms_${bms_id}
name: "charge ut delay"
filters:
- throttle: 60s
discharge_ot_trigger:
device_id: bms_${bms_id}
name: "discharge ot trigger"
filters:
- throttle: 60s
discharge_ot_release:
device_id: bms_${bms_id}
name: "discharge ot release"
filters:
- throttle: 60s
discharge_ot_delay:
device_id: bms_${bms_id}
name: "discharge ot delay"
filters:
- throttle: 60s
discharge_ut_trigger:
device_id: bms_${bms_id}
name: "discharge ut trigger"
filters:
- throttle: 60s
discharge_ut_release:
device_id: bms_${bms_id}
name: "discharge ut release"
filters:
- throttle: 60s
discharge_ut_delay:
device_id: bms_${bms_id}
name: "discharge ut delay"
filters:
- throttle: 60s
# Current protection thresholds from BMS config (rarely change)
charge_oc_alarm:
device_id: bms_${bms_id}
name: "charge oc alarm"
filters:
- throttle: 60s
charge_oc_alarm_delay:
device_id: bms_${bms_id}
name: "charge oc alarm delay"
filters:
- throttle: 60s
charge_oc_trigger:
device_id: bms_${bms_id}
name: "charge oc trigger"
filters:
- throttle: 60s
charge_oc_delay:
device_id: bms_${bms_id}
name: "charge oc delay"
filters:
- throttle: 60s
charge_oc_recover_delay:
device_id: bms_${bms_id}
name: "charge oc recover delay"
filters:
- throttle: 60s
charge_oc2_trigger:
device_id: bms_${bms_id}
name: "charge oc2 trigger"
filters:
- throttle: 60s
charge_oc2_delay:
device_id: bms_${bms_id}
name: "charge oc2 delay"
filters:
- throttle: 60s
discharge_oc_alarm:
device_id: bms_${bms_id}
name: "discharge oc alarm"
filters:
- throttle: 60s
discharge_oc_alarm_delay:
device_id: bms_${bms_id}
name: "discharge oc alarm delay"
filters:
- throttle: 60s
discharge_oc_trigger:
device_id: bms_${bms_id}
name: "discharge oc trigger"
filters:
- throttle: 60s
discharge_oc_delay:
device_id: bms_${bms_id}
name: "discharge oc delay"
filters:
- throttle: 60s
discharge_oc_recover_delay:
device_id: bms_${bms_id}
name: "discharge oc recover delay"
filters:
- throttle: 60s
discharge_oc2_trigger:
device_id: bms_${bms_id}
name: "discharge oc2 trigger"
filters:
- throttle: 60s
discharge_oc2_delay:
device_id: bms_${bms_id}
name: "discharge oc2 delay"
filters:
- throttle: 60s
# Misc config sensors
heater_start_temp:
device_id: bms_${bms_id}
name: "heater start temp"
filters:
- throttle: 60s
heater_stop_temp:
device_id: bms_${bms_id}
name: "heater stop temp"
filters:
- throttle: 60s
full_charge_voltage:
device_id: bms_${bms_id}
name: "full charge voltage"
filters:
- throttle: 60s
full_charge_current:
device_id: bms_${bms_id}
name: "full charge current"
filters:
- throttle: 60s
sleep_voltage:
device_id: bms_${bms_id}
name: "sleep voltage"
filters:
- throttle: 60s
sleep_delay:
device_id: bms_${bms_id}
name: "sleep delay"
filters:
- throttle: 60s
shunt_resistance:
device_id: bms_${bms_id}
name: "shunt resistance"
filters:
- throttle: 60s
# Charging cycle capacity - Calculated from charging cycles and battery capacity
- platform: template
id: bms${bms_id}_cycle_capacity_raw
device_id: bms_${bms_id}
name: "charging cycle capacity"
update_interval: ${bms_update_interval}
unit_of_measurement: Ah
state_class: total
icon: mdi:car-battery
accuracy_decimals: 0
internal: true
filters:
- or:
- throttle: 10s
- delta: 1
lambda: return id(bms${bms_id}_charging_cycles_raw).state * id(bms${bms_id}_battery_capacity).state;
text_sensor:
- platform: ecoworthy_bms
ecoworthy_bms_id: ecoworthy_bms${bms_id}
operation_status:
id: bms${bms_id}_status
device_id: bms_${bms_id}
name: "status"
fault:
id: bms${bms_id}_fault_text
device_id: bms_${bms_id}
name: "fault"
internal: true
alarm:
id: bms${bms_id}_alarm_text
device_id: bms_${bms_id}
name: "alarm"
internal: true
# Product info
manufacturer:
device_id: bms_${bms_id}
name: "manufacturer"
bms_model:
device_id: bms_${bms_id}
name: "bms model"
bms_serial_number:
device_id: bms_${bms_id}
name: "bms serial number"
pack_serial_number:
device_id: bms_${bms_id}
name: "pack serial number"
firmware_version:
device_id: bms_${bms_id}
name: "firmware version"
hardware_version:
device_id: bms_${bms_id}
name: "hardware version"
# Config text sensors
balance_mode:
device_id: bms_${bms_id}
name: "balance mode"
can_protocol:
device_id: bms_${bms_id}
name: "can protocol"
rs485_protocol:
device_id: bms_${bms_id}
name: "rs485 protocol"
button:
- platform: ecoworthy_bms
ecoworthy_bms_id: ecoworthy_bms${bms_id}
trip:
device_id: bms_${bms_id}
name: "trip breaker"
@@ -0,0 +1,422 @@
# Updated : 2026.02.15
# Version : 1.1.1
# GitHub : https://github.com/RAR/esphome-ecoworthy-bms
# 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>.
# +---------------------------------------+
# | Ecoworthy BMS RS485 SECONDARY Package |
# +---------------------------------------+
# This package provides YamBMS sensors for a SECONDARY battery polled
# through a primary Ecoworthy BMS component.
#
# The primary component must be configured with battery_count >= secondary_battery_number
#
# Required substitutions:
# bms_id: The YamBMS BMS ID number for this secondary
# bms_name: Display name for this secondary BMS
# parent_ecoworthy_bms_id: ID of the parent ecoworthy_bms component (e.g., 'ecoworthy_bms9')
# secondary_battery_number: The secondary battery number (2, 3, 4, etc.)
#
# Optional substitutions:
# bms_max_charge_current: Max charge current in A (default: 100)
# bms_max_discharge_current: Max discharge current in A (default: 100)
# bms_cell_ovp: Cell over-voltage protection in V (default: 3.650)
# bms_cell_uvp: Cell under-voltage protection in V (default: 2.500)
# bms_balance_trigger_voltage: Balance trigger voltage in V (default: 0.030)
#
# Note: Secondary batteries only have access to Pack Status data (not config blocks).
# balance_trigger_voltage must be set via substitution for secondaries.
substitutions:
bms_balance_trigger_voltage: '0.030'
bms_cell_ovp: '3.650'
bms_cell_uvp: '2.500'
bms_max_charge_current: '100'
bms_max_discharge_current: '100'
packages:
bms_base: !include bms_base.yaml
bms_temperature_sensor: !include bms_temperature_sensor_4.yaml
bms_errors_bitmask: !include bms_errors_bitmask_Ecoworthy_secondary.yaml
# +--------------------------------------+
# | Component entities |
# +--------------------------------------+
# Note: No ecoworthy_bms component created here - we reference the parent's secondary sensors
binary_sensor:
# Secondary battery binary sensors from parent component
- platform: ecoworthy_bms
ecoworthy_bms_id: ${parent_ecoworthy_bms_id}
batteries:
${secondary_battery_number}:
online_status:
id: bms${bms_id}_online_status
device_id: bms_${bms_id}
name: "online status"
trigger_on_initial_state: true
on_state:
then:
- lambda: |-
// Pass the current state to the update function
id(global_update_fault)(${CAT_BMS}, ${bms_id}, !x);
balancing:
id: bms${bms_id}_bms_equalizing
device_id: bms_${bms_id}
name: "balancing"
charging:
device_id: bms_${bms_id}
name: "charging active"
discharging:
device_id: bms_${bms_id}
name: "discharging active"
charging_switch:
id: bms${bms_id}_charge_mos_internal
device_id: bms_${bms_id}
internal: true
discharging_switch:
id: bms${bms_id}_discharge_mos_internal
device_id: bms_${bms_id}
internal: true
# bms_switch_charging - YamBMS uses this to check if charging is ALLOWED (MOS on)
- platform: template
id: bms${bms_id}_charging_allowed
device_id: bms_${bms_id}
name: "charging"
lambda: |-
return id(bms${bms_id}_charge_mos_internal).state;
# bms_switch_discharging - YamBMS uses this to check if discharging is ALLOWED (MOS on)
- platform: template
id: bms${bms_id}_discharging_allowed
device_id: bms_${bms_id}
name: "discharging"
lambda: |-
return id(bms${bms_id}_discharge_mos_internal).state;
sensor:
# Secondary battery sensors from parent component
- platform: ecoworthy_bms
ecoworthy_bms_id: ${parent_ecoworthy_bms_id}
batteries:
${secondary_battery_number}:
total_voltage:
id: bms${bms_id}_total_voltage
device_id: bms_${bms_id}
name: "total voltage"
current:
id: bms${bms_id}_current
device_id: bms_${bms_id}
name: "current"
power:
id: bms${bms_id}_power
device_id: bms_${bms_id}
name: "power"
charging_power:
id: bms${bms_id}_charging_power
device_id: bms_${bms_id}
name: "charging power"
discharging_power:
id: bms${bms_id}_discharging_power
device_id: bms_${bms_id}
name: "discharging power"
remaining_capacity:
id: bms${bms_id}_capacity_remaining_ah
device_id: bms_${bms_id}
name: "remaining capacity"
full_capacity:
id: bms${bms_id}_battery_capacity
device_id: bms_${bms_id}
name: "total capacity"
rated_capacity:
device_id: bms_${bms_id}
name: "rated capacity"
state_of_charge:
id: bms${bms_id}_state_of_charge
device_id: bms_${bms_id}
name: "state of charge"
state_of_health:
id: bms${bms_id}_battery_soh
device_id: bms_${bms_id}
name: "state of health"
cycle_count:
id: bms${bms_id}_charging_cycles_raw
device_id: bms_${bms_id}
name: "cycle"
min_cell_voltage:
id: bms${bms_id}_min_cell_voltage
device_id: bms_${bms_id}
name: "min cell voltage"
max_cell_voltage:
id: bms${bms_id}_max_cell_voltage
device_id: bms_${bms_id}
name: "max cell voltage"
delta_cell_voltage:
id: bms${bms_id}_delta_cell_voltage
device_id: bms_${bms_id}
name: "delta cell voltage"
average_cell_voltage:
id: bms${bms_id}_cell_average_voltage
device_id: bms_${bms_id}
name: "cell average voltage"
min_voltage_cell:
id: bms${bms_id}_min_voltage_cell
device_id: bms_${bms_id}
name: "min voltage cell"
max_voltage_cell:
id: bms${bms_id}_max_voltage_cell
device_id: bms_${bms_id}
name: "max voltage cell"
cell_voltage_1:
id: bms${bms_id}_cell_voltage_1
device_id: bms_${bms_id}
name: "cell voltage 01"
cell_voltage_2:
id: bms${bms_id}_cell_voltage_2
device_id: bms_${bms_id}
name: "cell voltage 02"
cell_voltage_3:
id: bms${bms_id}_cell_voltage_3
device_id: bms_${bms_id}
name: "cell voltage 03"
cell_voltage_4:
id: bms${bms_id}_cell_voltage_4
device_id: bms_${bms_id}
name: "cell voltage 04"
cell_voltage_5:
id: bms${bms_id}_cell_voltage_5
device_id: bms_${bms_id}
name: "cell voltage 05"
cell_voltage_6:
id: bms${bms_id}_cell_voltage_6
device_id: bms_${bms_id}
name: "cell voltage 06"
cell_voltage_7:
id: bms${bms_id}_cell_voltage_7
device_id: bms_${bms_id}
name: "cell voltage 07"
cell_voltage_8:
id: bms${bms_id}_cell_voltage_8
device_id: bms_${bms_id}
name: "cell voltage 08"
cell_voltage_9:
id: bms${bms_id}_cell_voltage_9
device_id: bms_${bms_id}
name: "cell voltage 09"
cell_voltage_10:
id: bms${bms_id}_cell_voltage_10
device_id: bms_${bms_id}
name: "cell voltage 10"
cell_voltage_11:
id: bms${bms_id}_cell_voltage_11
device_id: bms_${bms_id}
name: "cell voltage 11"
cell_voltage_12:
id: bms${bms_id}_cell_voltage_12
device_id: bms_${bms_id}
name: "cell voltage 12"
cell_voltage_13:
id: bms${bms_id}_cell_voltage_13
device_id: bms_${bms_id}
name: "cell voltage 13"
cell_voltage_14:
id: bms${bms_id}_cell_voltage_14
device_id: bms_${bms_id}
name: "cell voltage 14"
cell_voltage_15:
id: bms${bms_id}_cell_voltage_15
device_id: bms_${bms_id}
name: "cell voltage 15"
cell_voltage_16:
id: bms${bms_id}_cell_voltage_16
device_id: bms_${bms_id}
name: "cell voltage 16"
temperature_sensor_1:
id: bms${bms_id}_temperature_sensor_1
device_id: bms_${bms_id}
name: "cell temperature 1"
temperature_sensor_2:
id: bms${bms_id}_temperature_sensor_2
device_id: bms_${bms_id}
name: "cell temperature 2"
temperature_sensor_3:
id: bms${bms_id}_temperature_sensor_3
device_id: bms_${bms_id}
name: "cell temperature 3"
temperature_sensor_4:
id: bms${bms_id}_temperature_sensor_4
device_id: bms_${bms_id}
name: "cell temperature 4"
power_tube_temperature:
device_id: bms_${bms_id}
name: "mosfet temperature"
ambient_temperature:
device_id: bms_${bms_id}
name: "ambient temperature"
# min_temperature and max_temperature are provided by bms_temperature_sensor_4.yaml
avg_temperature:
device_id: bms_${bms_id}
name: "average temperature"
charge_voltage_limit:
device_id: bms_${bms_id}
name: "charge voltage limit"
charge_current_limit:
device_id: bms_${bms_id}
name: "dynamic max charging current"
discharge_voltage_limit:
device_id: bms_${bms_id}
name: "discharge voltage limit"
discharge_current_limit:
device_id: bms_${bms_id}
name: "dynamic max discharge current"
fault_bitmask:
id: bms${bms_id}_fault_bitmask
device_id: bms_${bms_id}
name: "fault bitmask"
internal: true
alarm_bitmask:
id: bms${bms_id}_alarm_bitmask
device_id: bms_${bms_id}
name: "alarm bitmask"
internal: true
mosfet_status_bitmask:
id: bms${bms_id}_mosfet_bitmask
device_id: bms_${bms_id}
name: "mosfet status bitmask"
balancing_bitmask:
id: bms${bms_id}_balancing_bitmask
device_id: bms_${bms_id}
name: "balancing bitmask"
# Required sensors - balance trigger voltage (configurable via substitution)
- platform: template
id: bms${bms_id}_bms_balance_trigger_voltage
device_id: bms_${bms_id}
name: "balance trigger voltage"
update_interval: ${bms_update_interval}
accuracy_decimals: 3
unit_of_measurement: "V"
state_class: measurement
device_class: 'voltage'
filters:
- or:
- throttle: 10s
- delta: 0.001
lambda: return ${bms_balance_trigger_voltage};
# Cell OVP (configurable via substitution)
- platform: template
id: bms${bms_id}_cell_ovp
device_id: bms_${bms_id}
name: "cell ovp"
update_interval: ${bms_update_interval}
accuracy_decimals: 3
unit_of_measurement: "V"
state_class: measurement
device_class: 'voltage'
filters:
- or:
- throttle: 10s
- delta: 0.001
lambda: return ${bms_cell_ovp};
# Cell UVP (configurable via substitution)
- platform: template
id: bms${bms_id}_cell_uvp
device_id: bms_${bms_id}
name: "cell uvp"
update_interval: ${bms_update_interval}
accuracy_decimals: 3
unit_of_measurement: "V"
state_class: measurement
device_class: 'voltage'
filters:
- or:
- throttle: 10s
- delta: 0.001
lambda: return ${bms_cell_uvp};
# Max charge current (static, configurable via substitution)
- platform: template
id: bms${bms_id}_max_charge_current
device_id: bms_${bms_id}
name: "max charging current"
update_interval: ${bms_update_interval}
accuracy_decimals: 0
unit_of_measurement: "A"
state_class: measurement
device_class: 'current'
filters:
- or:
- throttle: 10s
- delta: 1
lambda: return ${bms_max_charge_current};
# Max discharge current (static, configurable via substitution)
- platform: template
id: bms${bms_id}_max_discharge_current
device_id: bms_${bms_id}
name: "max discharge current"
update_interval: ${bms_update_interval}
accuracy_decimals: 0
unit_of_measurement: "A"
state_class: measurement
device_class: 'current'
filters:
- or:
- throttle: 10s
- delta: 1
lambda: return ${bms_max_discharge_current};
# Charging cycle capacity - Calculated from charging cycles and battery capacity
- platform: template
id: bms${bms_id}_cycle_capacity_raw
device_id: bms_${bms_id}
name: "charging cycle capacity"
update_interval: ${bms_update_interval}
unit_of_measurement: Ah
state_class: total
icon: mdi:car-battery
accuracy_decimals: 0
internal: true
filters:
- or:
- throttle: 10s
- delta: 1
lambda: return id(bms${bms_id}_charging_cycles_raw).state * id(bms${bms_id}_battery_capacity).state;
text_sensor:
# Secondary battery text sensors from parent component
- platform: ecoworthy_bms
ecoworthy_bms_id: ${parent_ecoworthy_bms_id}
batteries:
${secondary_battery_number}:
operation_status:
id: bms${bms_id}_status
device_id: bms_${bms_id}
name: "status"
fault:
id: bms${bms_id}_fault_text
device_id: bms_${bms_id}
name: "fault"
internal: true
alarm:
id: bms${bms_id}_alarm_text
device_id: bms_${bms_id}
name: "alarm"
internal: true