diff --git a/README.md b/README.md index 0e80d07..d463c7e 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,36 @@ ![Image](images/YamBMS_packaged_version.png "YamBMS packaged version") +### Single-node + +You install `YamBMS` on a single ESP32 connected to your BMS and your inverter. + +* Max 2x BMS BLE +* Max 3X BMS UART +* several RS485 BMS on the same bus + +### Multi-node + +Each BMS/Shunt turns into a `modbus server` with its own address. + +> [!IMPORTANT] +> The max number of `UART` BMS/Shunt per ESP32 is `2` (unless you use a UART expander) because you need to keep the last `UART` for the `RS485` network. +> The max number of `BLE` BMS/Shunt per ESP32 is `2`, ESP32-S3 / AtomS3 can supervise `3` BLE devices. + +YamBMS installs on `node1` as a `modbus client` to collect information from all your BMS. +The `node1` is also connected to your inverter via the `CAN bus`. + +The BMS/Shunt are connected to other ESP32 nodes connected on a dedicated RS485 bus for YamBMS. Each BMS/Shunt becomes a `modbus server`. + +The theoretical limit is `256` modbus server (BMS/Shunt) per `RS485 bus` but in reality this will depend on the capabilities of `node1` (YamBMS) which will have to combine all the BMS/Shunt together. + +[You can find more information about creating your YAML in this How To.](documents/README/YamBMS_main_YAML_HowTo.md) + +> [!TIP] +> If you have a lot of `BMS/Shunt` to combine, using an `ESP32-S3` or `AtomS3` for `node1` is recommended. + +![Image](images/YamBMS_multi-node_RS485_modbus.png "YamBMS multi-node RS485 modbus") + ## Home Assistant ![Image](images/YamBMS_HA_Dashboard.png "YamBMS HA Dashboard") @@ -85,6 +115,15 @@ rx_pin: 22 # to CAN board CRX (with 4.7K resistor except for SN65HVD230) ## Changelog +* YamBMS 1.5.2 : + * Added shunt `Online Status` binary_sensor + * Shunt combine condition based on the new binary_sensor `Online Status` + * Logger `baud_rate: 0` by default (frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus") + * Changed names of `bms` and `shunt` YAMLs for modbus `multi-node` solution + * Added shared configuration file to simplify main YAML (centralization of parameters) + * Simplification (fewer options) when importing `BMS / Shunt` YAMLs + * New `multi-node` solution using `RS485 modbus` to communicate information to YamBMS + * New board `espBerry` with `2-CH-CAN HAT` * YamBMS 1.5.1 : * The conditions for `combining` BMS and the `charging` and `discharging` instructions no longer have any relation with the `errors_bitmask` sensor, the new system relies on the three **binary_sensor** `online status`, `charging allowed` and `discharging allowed` being linked to the status of alarms and switches. * The BMS combination procedure has been completely rewritten. diff --git a/documents/README/BMS_JK-B_UART_solution.md b/documents/README/BMS_JK-B_UART_solution.md index ec62851..694e1d3 100644 --- a/documents/README/BMS_JK-B_UART_solution.md +++ b/documents/README/BMS_JK-B_UART_solution.md @@ -19,34 +19,7 @@ ## Galvanic isolation of the `UART-TTL` connection > [!CAUTION] -> `V1` and `V2` must be isolated and cannot come from the same source. `V1` (JK GPS port side) can be powered by the `3V3` of the ESP32 via a `DC-DC isolator` (**B0303S = 3V3-to-3V3**), `V2` (ESP32 side) is powered directly by the `3V3` of the ESP32. - -``` -┌────────────┐ | ┌──────────┐ ┌───────────┐ -│ | └─3V3--V1>│ |TX-------AI>│ ISOLATOR │>BO-------RX>| | -│ │<----GND---->│ │<----GND---->| | -└────────────┘ └──────────┘ └───────────┘ -``` - -Here are some components available on the market allowing you to set up galvanic isolation. The `UART-TTL isolator 2` seems a little better isolated with more space below the chip. - -* [UART-TTL isolator 1](https://a.aliexpress.com/_EuXszn7) -* [UART-TTL isolator 2](https://a.aliexpress.com/_EItDRvX) -* [DC-DC isolator](https://a.aliexpress.com/_EIsPAoh) - -![Image](../../images/UART-TTL_isolator_1.png "UART-TTL isolator example") - -| [UART-TTL isolator](https://a.aliexpress.com/_EItDRvX) | [DC-DC isolator](https://a.aliexpress.com/_EIsPAoh) | -| --- | --- | -| | | - -### Another solution would be the use of M5Stack's isolated RS485 unit. - -| [M5Stack RS485 unit (isolated)](https://docs.m5stack.com/en/unit/iso485) | -| --- | -| | +> [Please read this page about setting up galvanic isolation of the `UART-TTL` connection.](Galvanic_isolation.md) ### Atom S3 (ESP32-S3) @@ -143,10 +116,10 @@ The `GPS` port sometimes called `RS485` is not an `RS485` port but `3V3 UART-TTL │ O O O O │ │GND RX TX VBAT│ └────────────────┘ - │ │ │ | VBAT is full battery volatge eg 51.2V (possible to use it via an isolated DC-DC converter) - │ │ └──── to TTL-isolator AI (input) - │ └──────── to TTL-isolator AO (output) - └──────────── to TTL-isolator GND + │ │ │ └ VBAT is full battery volatge eg 51.2V (possible to use it via an isolated DC-DC converter) + │ │ └──── TX to TTL-isolator AI (input) + │ └──────── RX to TTL-isolator AO (output) + └──────────── GND to TTL-isolator GND ``` The UART-TTL (labeled as `GPS`) socket of the BMS can be attached to any UART pins of the ESP.
diff --git a/documents/README/Galvanic_isolation.md b/documents/README/Galvanic_isolation.md new file mode 100644 index 0000000..71c7a65 --- /dev/null +++ b/documents/README/Galvanic_isolation.md @@ -0,0 +1,39 @@ +# YamBMS - Galvanic isolation + +[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Badge Version](https://img.shields.io/github/v/release/Sleeper85/esphome-yambms?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/Sleeper85/esphome-yambms/releases/latest) +![GitHub stars](https://img.shields.io/github/stars/Sleeper85/esphome-yambms) +![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) +![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) + +## Galvanic isolation of the `UART-TTL` connection + +> [!CAUTION] +> `V1` and `V2` (3V3 or 5V) must be isolated and cannot come from the same source. `V1` can be powered by the device or the `3V3` of the ESP32 via a `DC-DC isolator` (**B0303S = 3V3-to-3V3**), `V2` (ESP32 side) is powered directly by the `3V3` of the ESP32. + +``` +┌─────────────┐ ┌──────────┐ ┌───────────┐ +│ | 3V3/5V--V1>│ |TX-------AI>│ ISOLATOR │>BO-------RX>| | +│ │<----GND---->│ │<----GND---->| | +└─────────────┘ └──────────┘ └───────────┘ +``` + +Here are some components available on the market allowing you to set up galvanic isolation. The `UART-TTL isolator 2` seems a little better isolated with more space below the chip. + +* [UART-TTL isolator 1](https://a.aliexpress.com/_EuXszn7) +* [UART-TTL isolator 2](https://a.aliexpress.com/_EItDRvX) +* [DC-DC isolator](https://a.aliexpress.com/_EIsPAoh) + +![Image](../../images/UART-TTL_isolator_1.png "UART-TTL isolator example") + +| [UART-TTL isolator](https://a.aliexpress.com/_EItDRvX) | [DC-DC isolator](https://a.aliexpress.com/_EIsPAoh) | +| --- | --- | +| | | + +### Another solution would be the use of M5Stack's isolated RS485 unit. + +| [M5Stack RS485 unit (isolated)](https://docs.m5stack.com/en/unit/iso485) | +| --- | +| | diff --git a/documents/README/Installation_procedure.md b/documents/README/Installation_procedure.md index 96a1272..65307d6 100644 --- a/documents/README/Installation_procedure.md +++ b/documents/README/Installation_procedure.md @@ -8,20 +8,37 @@ ## Installation procedure -1. **Install ESPHome on your computer**
+### 1. Install ESPHome on your computer + Before you can flash your ESP32 you need to install the [ESPHome 2024.6.0 or higher](https://github.com/esphome/esphome/releases) command line application.
[Follow these instructions for installation on Windows, Mac or Linux.](https://esphome.io/guides/installing_esphome) -2. **Download all YAML files to your computer**
+> [!TIP] +> If you are using Windows install the `setuptools` package in addition to `wheel` and `esphome`. + +```bash +pip3 install setuptools +pip3 install wheel +pip3 install esphome +``` + +### 2. Download all YAML files to your computer + You can do this from the command line or in your preferred method. +You need to gather the following three points in the same folder. If you are compiling from your HA server use the `Samba Share` add-on so that you can copy the `packages` folder to the `esphome` folder on the HA server. + + 1) the `packages` folder + 2) your `secrets.yaml` + 3) your [custom](YamBMS_main_YAML_HowTo.md) `main.yaml` + ```bash # Clone this external component git clone https://github.com/Sleeper85/esphome-yambms.git cd esphome-yambms ``` -3. **Enter your WiFi credentials in the secrets.yaml files** +### 3. Enter your WiFi credentials in the secrets.yaml files ```yaml wifi_ssid: YourSSID @@ -29,7 +46,8 @@ wifi_password: YourPassword domain : .local ``` -4. **Install the YamBMS application into your ESP32**
+### 4. Install the YamBMS application into your ESP32 + Choose the main YAML that best suits your needs like for example `multi-bms_JK-ALL_BLE.yaml`.
Validate the configuration, create a binary, upload it, and start logs.
**The only YAML that needs to be checked and configured is the main one like for example `multi-bms_JK-ALL_BLE.yaml` but you can modify other YAMLs if you want.
@@ -49,10 +67,11 @@ esphome run multi-bms_JK-PB_RS485_mode2.yaml esphome run multi-bms_JK-ALL_BLE.yaml --device 192.168.x.x ``` -5. **Optional but recommended: add the ESP32 in your Home Assistant server**
+### 5. Optional but recommended, add the ESP32 in your Home Assistant server + In Home Assistant under **" Settings > Devices and services > Add Intergration "** select ESPHome add device `yambms` if found or supply ip address of ESP32. -## ESPHome other bash command +## Other ESPHome command-line ```bash # clean files before compiling again @@ -87,4 +106,4 @@ uart: rx_pin: ${rx_pin} debug: direction: BOTH -``` \ No newline at end of file +``` diff --git a/documents/README/Schematic_and_setup_instructions.md b/documents/README/Schematic_and_setup_instructions.md index 0a99c07..6225056 100644 --- a/documents/README/Schematic_and_setup_instructions.md +++ b/documents/README/Schematic_and_setup_instructions.md @@ -8,6 +8,8 @@ ## Contents -1) [JK-B BMS UART (GPS port) solution](BMS_JK-B_UART_solution.md) -2) [JK-B BMS RS485 (Display port) solution](BMS_JK-B_RS485_DISPLAY_solution.md) -3) [JK-PB BMS RS485 solution](BMS_JK-PB_RS485_solution.md) \ No newline at end of file +1) [Galvanic isolation](Galvanic_isolation.md) +2) [JK-B BMS UART (GPS port) solution](BMS_JK-B_UART_solution.md) +3) [JK-B BMS RS485 (Display port) solution](BMS_JK-B_RS485_DISPLAY_solution.md) +4) [JK-PB BMS RS485 solution](BMS_JK-PB_RS485_solution.md) +5) [Victron SmartShunt How To](Shunt_Victron_SmartShunt_HowTo.md) diff --git a/documents/README/Shunt_Victron_SmartShunt_HowTo.md b/documents/README/Shunt_Victron_SmartShunt_HowTo.md new file mode 100644 index 0000000..74eb8f5 --- /dev/null +++ b/documents/README/Shunt_Victron_SmartShunt_HowTo.md @@ -0,0 +1,56 @@ +# Victron SmartShunt How To + +[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Badge Version](https://img.shields.io/github/v/release/Sleeper85/esphome-yambms?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/Sleeper85/esphome-yambms/releases/latest) +![GitHub stars](https://img.shields.io/github/stars/Sleeper85/esphome-yambms) +![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) +![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) + +## UART : Schematic + +> [!CAUTION] +> [Please read this page about setting up galvanic isolation of the `UART-TTL` connection.](Galvanic_isolation.md) + +> [!TIP] +> If you are unsure about to pin order please measure the voltage between GND and VCC (5V). If you measure a positive voltage you know the position of VCC and GND! + +``` +┌─────────────────┐ ┌──────────┐ ┌───────────┐ +│ 5V o│<----5V---V1>│ || | +│ Victron RX o│<---------AO<│ UART-TTL │---------AI>│ ISOLATOR │>BO-------RX>| | +│ GND o│<----GND---->│ │<----GND---->| | +└─────────────────┘ └──────────┘ └───────────┘ + +# UART-TTL VE.Direct port (JST-PH 2.0mm pinch) +┌─── ─────── ────┐ +│ │ +│ O O O O │ +│GND RX TX VCC │ +└────────────────┘ + │ │ │ └ 5V + │ │ └──── TX to TTL-isolator AI (input) + │ └──────── RX to TTL-isolator AO (output) + └──────────── GND to TTL-isolator GND + +``` + +## Bluetooth : How to retrieve MAC address and encryption key + +To connect to your Victron device with BLE component you must have two information : + +- `mac_address` - Bluetooth mac address of device. +- `encryption_key` - AES encryption key. + +Use [VictronConnect App v5.93](https://www.victronenergy.com/live/victronconnect:beta) (or later) released on 2023-08-25. + +![VictronConnect App Settings page](../../images/Victron_SmartShunt_App_01_Settings.png) +![VictronConnect App Product info page](../../images/Victron_SmartShunt_App_02_ProductInfo.png) +![VictronConnect App Instant readout encryption data](../../images/Victron_SmartShunt_App_03_EncryptionData.png) + +1. Open `Settings` of Device. +2. Open `Product Info` page. +3. Ensure `Instant readout via Bluetooth` is enabled. +4. Bottom of page press `SHOW` for Instant readout details Encryption data. + +When connected to the device via VictronConnect App no Instant readout (Bluetooth advertising) data is generated. diff --git a/documents/README/Supported_devices.md b/documents/README/Supported_devices.md index bed2ec8..ed4eb57 100644 --- a/documents/README/Supported_devices.md +++ b/documents/README/Supported_devices.md @@ -35,11 +35,11 @@ **Note: some inverters only accept a CAN bus at 3.3V in this case please choose the SN65HVD230 chip.** -| TJA1050 | TJA1051 | SN65HVD230 | +| TJA1050 (5V) | TJA1051 (5V) | SN65HVD230 (3V3) | | --- | --- | --- | | | | | -| [M5Stack Atomic CAN Base (isolated)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | [M5Stack CAN Unit (isolated)](https://docs.m5stack.com/en/unit/can) | MCP2515 | +| [M5Stack Atomic CAN Base (isolated)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | [M5Stack CAN Unit (isolated)](https://docs.m5stack.com/en/unit/can) | MCP2515 (5V) | | --- | --- | --- | | | | | @@ -88,6 +88,7 @@ The following are confirmed and known to work: | LuxPower | LXP-LB-US 10K | Working | [@Henny101](https://diysolarforum.com/members/henny101.67026/) | Lithium 6 | JK-PB (2) | RS485 | ESP32-S3 DevKitC-1 | Automatic | LuxPower | SN65HVD230 | [Isolated RS485 (high speed dual)](https://a.aliexpress.com/_EueIZT5) | yes | --- | | EG4 | 6000XP | Working | [@ChrisG](https://diysolarforum.com/members/chrisg.483/) | Lithium 2 | JK-B (2) | BLE | ESP32 DevKit V1 / ESP32-S3 DevKitC-1 | PYLON | PYLON 1.2 | MCP2515 | --- | yes | --- | | EG4 | 6000XP (2) | Working | [@SGB](https://diysolarforum.com/members/scrotpusgobblebottom.100804/) | Lithium 6 | JK-B (1) JK-PB (1) | BLE | Atom S3 (display) | Automatic | LuxPower | [Atomic CAN base (SKU:A103)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | --- | yes | --- | +| EG4 | 18kPV | Working | [@Maintman](https://diysolarforum.com/members/maintman.19007/) | Lithium 6 | JK-B | BLE | ESP32 DevKit V1 | Automatic | LuxPower | MCP2515 | --- | yes | Connected via Bluetooth to Victron SmartShunt. | | Victron | MultiPlus-II 48/10000/140 | Working | [@cali-clim](https://diysolarforum.com/members/cali-clim.54284/) | CAN-bus BMS LV (500 kbit/s) | JK-PB (2) | RS485 | Atom S3 (display) | Automatic | Victron | [Atomic CAN base (SKU:A103)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | [Isolated RS485 Unit (SKU:U094)](https://docs.m5stack.com/en/unit/iso485) | yes | --- | | Victron | Multiplus 24/1200/25-16 | Working | [@dmsims](https://diysolarforum.com/members/dmsims.23417/) | CAN-bus BMS LV (500 kbit/s) | JK-B (1) | BLE | Atom S3 Lite | Automatic | Victron | [Atomic CAN base (SKU:A103)](https://docs.m5stack.com/en/atom/Atomic%20CAN%20Base) | --- | no | Plugged into Cerbo Can port (must use supplied Victron terminator in the other port) | | MidNite Solar | MN15-12KW-AIO | Working | [@goldserve](https://diysolarforum.com/members/goldserve.52541/) | PYLON | JK-B | BLE | ESP32-S3 | Automatic | PYLON 1.2 | MCP2515 | --- | no | Stable with Victron Smartshunt, MQTT, BLE, Neopixel LED, Display also working. | diff --git a/documents/README/Supported_devices_Build_your_own_PCB.md b/documents/README/Supported_devices_Build_your_own_PCB.md index 36c1e15..9fc793e 100644 --- a/documents/README/Supported_devices_Build_your_own_PCB.md +++ b/documents/README/Supported_devices_Build_your_own_PCB.md @@ -26,10 +26,9 @@ It would be possible to add one or more [WK2168 4x UART expander](https://esphom > [!CAUTION] > The `GND` of the `JK-B GPS port` is directly connected with the `B-` of your battery. Even if your BMS is in protection or stopped you can measure the `full voltage` between this `GND` and `B+`. This therefore presents a risk of `bypass` of the BMS `P-` and can be dangerous if the GND of your ESP32 is connected to the GND of your inverter or a measurement shunt for example. > I therefore strongly advise you to achieve [galvanic isolation](BMS_JK-B_UART_solution.md#galvanic-isolation-of-the-uart-ttl-connection) between your ESP32 and the `UART-TTL` of the `JK-B GPS port`. -> This example does not implement galvanic isolation which could cause problems. -This is an example of an ESP32 DevKit V1 30 pin board powered by the BMS. +This is an example of an `ESP32 DevKit V1` 30 pin board powered by the `JK-B` BMS. **This example uses an RS485 board for the `multi-node` solution which is not mandatory.** ![Image](../../images/PCB_ESP32_JK-BMS-CAN_powered_by_JK-BMS.png "PCB ESP32 JK-BMS-CAN powered by JK-BMS") -![Image](../../images/PCB_ESP32_JK-BMS-CAN_Prototype.jpg "PCB ESP32 JK-BMS-CAN powered by JK-BMS") +![Image](../../images/PCB_ESP32_JK-BMS-CAN_Prototype.png "PCB ESP32 JK-BMS-CAN powered by JK-BMS") diff --git a/documents/README/Victron_SmartShunt_HowTo.md b/documents/README/Victron_SmartShunt_HowTo.md deleted file mode 100644 index 5ff6035..0000000 --- a/documents/README/Victron_SmartShunt_HowTo.md +++ /dev/null @@ -1,27 +0,0 @@ -# Victron SmartShunt How To - -[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0) -[![Badge Version](https://img.shields.io/github/v/release/Sleeper85/esphome-yambms?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/Sleeper85/esphome-yambms/releases/latest) -![GitHub stars](https://img.shields.io/github/stars/Sleeper85/esphome-yambms) -![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) -![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) - -## How to retrieve MAC address and encryption key - -To connect to your Victron device with BLE component you must have two information : - -- `mac_address` - Bluetooth mac address of device. -- `encryption_key` - AES encryption key. - -Use [VictronConnect App v5.93](https://www.victronenergy.com/live/victronconnect:beta) (or later) released on 2023-08-25. - -![VictronConnect App Settings page](../../images/Victron_SmartShunt_App_01_Settings.png) -![VictronConnect App Product info page](../../images/Victron_SmartShunt_App_02_ProductInfo.png) -![VictronConnect App Instant readout encryption data](../../images/Victron_SmartShunt_App_03_EncryptionData.png) - -1. Open "Settings" of Device. -2. Open "Product Info" page. -3. Ensure `Instant readout via Bluetooth` is enabled. -4. Bottom of page press `SHOW` for Instant readout details Encryption data. - -When connected to the device via VictronConnect App no Instant readout (Bluetooth advertising) data is generated. diff --git a/documents/README/YamBMS_behavior.md b/documents/README/YamBMS_behavior.md index d17dd28..94aeeef 100644 --- a/documents/README/YamBMS_behavior.md +++ b/documents/README/YamBMS_behavior.md @@ -23,9 +23,12 @@ The various counters above allow you to see what state your system is in. Combine condition : 1) the `Combine` switch is enabled -2) the `Voltage` supplied by the shunt is `> 0V` +2) Shunt `Online Status` is `ON` (the shunt `Voltage` is `> 0V`) -If one of these two conditions is not respected, the shunt is automatically decombined. +If one of these two conditions is not respected, the shunt is automatically uncombined. + +> [!IMPORTANT] +> In RS485 modbus `multi-node`, if a server does not respond (cable or hardware failure) the `Online Status` of the shunt will be set to `OFF` and it will be uncombined. As soon as you import a `Shunt` and it can be combined (see condition) the values ​​`Voltage`, `Current`, `Power` and `SoC` of the shunt(s) will take precedence over the BMS values. @@ -39,7 +42,10 @@ Combine condition : 2) BMS `Online Status` is `ON` (to detect a loss of connection with the BMS e.g. cable, BMS OFF or dead) 3) BMS `Charging` or `Discharging` is allowed (based on `binary_sensor`, related to the state of `switches/alarms`) -If one of these three conditions is not met, the BMS is automatically decombined. +If one of these three conditions is not met, the BMS is automatically uncombined. + +> [!IMPORTANT] +> In RS485 modbus `multi-node`, if a server does not respond (cable or hardware failure) the `Online Status` of the BMS will be set to `OFF` and it will be uncombined. From YamBMS `1.5.1` : diff --git a/documents/README/YamBMS_main_YAML_HowTo.md b/documents/README/YamBMS_main_YAML_HowTo.md index 456d9f6..62d1c61 100644 --- a/documents/README/YamBMS_main_YAML_HowTo.md +++ b/documents/README/YamBMS_main_YAML_HowTo.md @@ -6,7 +6,6 @@ ![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) ![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) - > [!IMPORTANT] > BMS monitoring with `Bluetooth` as well as the `Web server` are RAM-intensive components. > Please note that enabling these components will take up a lot of memory and may decrease the stability of your ESP32. @@ -154,51 +153,154 @@ This board has an `Ethernet` port and can be powered from `POE` (optional). device_board: !include packages/board/board_esp32-c3-eth01-evo.yaml ``` -## BMS - -The example YAMLs are just examples, you can mix different BMS models without problems. - -There are other `bms.yaml` not mentioned here, see in the [bms](../../packages/bms/) folder. - -The `full` / `standard` versions contain all available sensors while the `minimal` version contains the basic sensors without the voltages of each cell and other superfluous sensors. - -### Multi-BMS example +## YamBMS single-node example ```YAML + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + + shunt1: !include + file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml + vars: + shunt_id: '1' # must be a number + shunt_name: 'Shunt 1' + # other settings + # ... + bms1: !include - file: packages/bms/bms_model.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' # other settings # ... bms2: !include - file: packages/bms/bms_model.yaml + file: packages/bms/bms_combine_JBD_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # BMS vars bms_id: '2' # must be a number bms_name: 'BMS 2' # other settings # ... +``` + +## YamBMS multi-node RS485 modbus example + +> [!IMPORTANT] +> The BMS/Shunt IDs of the `modbus client` must match exactly with the BMS/Shunt IDs of the `modbus server` as in the example below. + +### YamBMS modbus client `node1` + +```YAML + # Config : this YAMLs contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + config_multinode_modbus: !include packages/config/config_multi-node_modbus.yaml + + modbus: !include + file: packages/base/device_modbus.yaml + vars: + modbus_role: 'client' # client / server + modbus_uart_id: 'uart_esp_1' # RS485 board + + shunt1: !include + file: packages/shunt/shunt_combine_modbus_client.yaml # a Shunt connected to a node of the RS485 bus + vars: + shunt_id: '1' # must be a number, also represents the modbus server number (200 + shunt_id) ! + shunt_name: 'Shunt 1' + + bms1: !include + file: packages/bms/bms_combine_modbus_client.yaml # a BMS connected to a node of the RS485 bus + vars: + bms_id: '1' # must be a number, also represents the modbus server number ! + bms_name: 'BMS 1' + + bms2: !include + file: packages/bms/bms_combine_modbus_client.yaml # a BMS connected to a node of the RS485 bus + vars: + bms_id: '2' # must be a number, also represents the modbus server number ! + bms_name: 'BMS 2' + + bms3: !include + file: packages/bms/bms_combine_modbus_client.yaml # a BMS connected to a node of the RS485 bus + vars: + bms_id: '3' # must be a number, also represents the modbus server number ! + bms_name: 'BMS 3' +``` + +### ESP32 modbus server `node2` + +```YAML + # Config : this YAMLs contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + config_multinode_modbus: !include packages/config/config_multi-node_modbus.yaml + + modbus: !include + file: packages/base/device_modbus.yaml + vars: + modbus_role: 'server' # client / server + modbus_uart_id: 'uart_esp_1' # RS485 board + + shunt1: !include + file: packages/shunt/shunt_modbus_Victron_SmartShunt_UART.yaml + vars: + shunt_id: '1' # must be a number, also represents the modbus server number (200 + shunt_id) ! + shunt_name: 'Shunt 1' + # other settings + # ... + + bms1: !include + file: packages/bms/bms_modbus_JK-B_UART_full.yaml + vars: + bms_id: '1' # must be a number, also represents the modbus server number ! + bms_name: 'BMS 1' + # other settings + # ... +``` + +### ESP32 modbus server `node3` + +```YAML + # Config : this YAMLs contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + config_multinode_modbus: !include packages/config/config_multi-node_modbus.yaml + + modbus: !include + file: packages/base/device_modbus.yaml + vars: + modbus_role: 'server' # client / server + modbus_uart_id: 'uart_esp_1' # RS485 board + + bms2: !include + file: packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml + vars: + bms_id: '2' # must be a number, also represents the modbus server number ! + bms_name: 'BMS 2' + # other settings + # ... bms3: !include - file: packages/bms/bms_model.yaml + file: packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # BMS vars - bms_id: '3' # must be a number + bms_id: '3' # must be a number, also represents the modbus server number ! bms_name: 'BMS 3' # other settings # ... ``` +## BMS + +> [!IMPORTANT] +> You must number your `BMS` in order starting with the number `1`. + +> [!TIP] +> YAML files whose name starts with `bms_combine` are to be used on the main `YamBMS` node connected to your inverter, those whose name starts with `bms_modbus` are to be used on the other nodes connected to the `RS485` bus. + +The example YAMLs are just examples, you can mix different BMS models without problems. + +There are other `bms.yaml` not mentioned here, see in the [bms](../../packages/bms/) folder. + +The `full` / `standard` versions contain all available sensors while the `minimal` version contains the basic sensors without the voltages of each cell and other superfluous sensors. + ### [JK-ALL (BLE)](https://github.com/syssi/esphome-jk-bms) > [!IMPORTANT] @@ -208,33 +310,25 @@ The `full` / `standard` versions contain all available sensors while the `minima ```YAML bms1: !include - file: packages/bms/bms_JK-ALL_BLE_standard.yaml + file: packages/bms/bms_combine_JK-ALL_BLE_standard.yaml # bms_modbus_JK-ALL_BLE_standard.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_ble_protocol_version: JK02_32S # JK02_24S < hardware version 11.0 >= JK02_32S - bms_ble_mac_address: C8:47:8C:10:7E:AA + bms_ble_protocol_version: 'JK02_32S' # JK02_24S < hardware version 11.0 >= JK02_32S + bms_ble_mac_address: 'C8:47:8C:10:7E:AA' # Your MAC address ``` ### [JK-B (UART)](https://github.com/syssi/esphome-jk-bms) +[How to make the UART connection with the ESP32.](BMS_JK-B_UART_solution.md) + ```YAML bms1: !include - file: packages/bms/bms_JK-B_UART_full.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml # bms_modbus_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_1 + bms_uart_id: 'uart_esp_1' ``` ### [JK-B (RS485 DISPLAY)](https://github.com/syssi/esphome-jk-bms) @@ -244,18 +338,15 @@ The `full` / `standard` versions contain all available sensors while the `minima > The missing information has been added in the code by fixed values. > e.g. it's not possible to know if the BMS is `online` or if the BMS is `equalizing` the cells. +[How to make the RS485 connection with the ESP32.](BMS_JK-B_RS485_DISPLAY_solution.md) + ```YAML bms1: !include - file: packages/bms/bms_JK-B_RS485_DISPLAY_full.yaml + file: packages/bms/bms_combine_JK-B_RS485_DISPLAY_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_1 + bms_uart_id: 'uart_esp_1' # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings # LFP values example @@ -270,6 +361,8 @@ The `full` / `standard` versions contain all available sensors while the `minima A single `RS485 bus` allows you to monitor up to `16` BMS. +[How to make the RS485 connection with the ESP32.](BMS_JK-PB_RS485_solution.md) + #### JK-PB sniffer > [!IMPORTANT] @@ -283,7 +376,7 @@ Sniffer without `talk_pin` : ```YAML sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -294,7 +387,7 @@ If your `RS485` board requires a `talk_pin` you must specify which `GPIO` will b ```YAML sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer_talk_pin.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer_talk_pin.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -307,35 +400,26 @@ If your `RS485` board requires a `talk_pin` you must specify which `GPIO` will b ```YAML # Mode2 : configure the DIP switches of your BMS from 0x01 to 0x0F (don't use the 0x00 address, maximum 15 BMS) bms1: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' ``` ### [JBD (UART)](https://github.com/syssi/esphome-jbd-bms) ```YAML bms1: !include - file: packages/bms/bms_JBD_UART_full.yaml + file: packages/bms/bms_combine_JBD_UART_full.yaml # bms_modbus_JBD_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_1 - bms_rx_timeout: 150ms + bms_uart_id: 'uart_esp_1' + bms_rx_timeout: '150ms' # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings # LFP values example @@ -363,22 +447,20 @@ A single `RS485 bus` allows you to monitor up to `16` BMS. ```YAML seplos_modbus1: !include - file: packages/bms/bms_SEPLOS_V1_V2_RS485_modbus.yaml + file: packages/bms/bms_combine_SEPLOS_V1_V2_RS485_modbus.yaml vars: seplos_modbus_id: 'seplos_modbus1' seplos_modbus_uart_id: 'uart_esp_1' - seplos_modbus_baud_rate: '9600' # Please set the baudrate of your Seplos BMS model here. It's sometimes 19200 baud instead of 9600. - seplos_modbus_rx_timeout: 150ms + seplos_modbus_baud_rate: '9600' # 9600 / 19200 ; please set the baudrate of your Seplos BMS model here + seplos_modbus_rx_timeout: '150ms' ``` #### Seplos V1/V2 BMS ```YAML bms1: !include - file: packages/bms/bms_SEPLOS_V1_V2_RS485_bms_full.yaml + file: packages/bms/bms_combine_SEPLOS_V1_V2_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to # Seplos modbus ID seplos_modbus_id: 'seplos_modbus1' # BMS vars @@ -386,8 +468,6 @@ A single `RS485 bus` allows you to monitor up to `16` BMS. bms_name: 'BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch bms_protocol_version: '0x20' # Known protocol versions: 0x20 (Seplos), 0x26 (Boqiang) - bms_update_interval: '3s' # 10s @syssi example - bms_combine_interval: '1s' # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings # LFP values example @@ -400,22 +480,26 @@ A single `RS485 bus` allows you to monitor up to `16` BMS. ## Shunt +> [!IMPORTANT] +> You must number your `Shunt` in order starting with the number `1`. + +> [!TIP] +> YAML files whose name starts with `shunt_combine` are to be used on the main `YamBMS` node connected to your inverter, those whose name starts with `shunt_modbus` are to be used on the other nodes connected to the `RS485` bus. + As soon as you import a `Shunt` and it can be combined ([see condition](YamBMS_behavior.md#shunt)) the values ​​`Voltage`, `Current`, `Power` and `SoC` of the shunt(s) will take precedence over the BMS values. + ### [Victron Smartshunt (UART)](https://github.com/KinDR007/VictronMPPT-ESPHOME) +[How to make the UART connection with the ESP32.](Shunt_Victron_SmartShunt_HowTo.md) + ```YAML shunt1: !include - file: packages/shunt/shunt_victron_smartshunt_UART.yaml + file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_modbus_Victron_SmartShunt_UART.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' - shunt_uart_id: uart_esp_1 + shunt_uart_id: 'uart_esp_1' ``` ### [Victron Smartshunt (BLE)](https://github.com/Fabian-Schmidt/esphome-victron_ble) @@ -425,18 +509,15 @@ As soon as you import a `Shunt` and it can be combined ([see condition](YamBMS_b > Crashes are likely to occur if you include too many additional components in your device’s configuration. > I recommend using `UART` or `RS485` if possible. +[How to make the BLE connection with the ESP32.](Shunt_Victron_SmartShunt_HowTo.md) + ```YAML shunt1: !include - file: packages/shunt/shunt_victron_smartshunt_BLE.yaml + file: packages/shunt/shunt_combine_Victron_SmartShunt_BLE.yaml # shunt_modbus_Victron_SmartShunt_BLE.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' - shunt_mac_address: '60:A4:23:91:8F:55' + shunt_mac_address: '60:A4:23:91:8F:55' # Your MAC address shunt_encryption_key: '0df4d0395b7d1a876c0c33ecb9e70dcd' # Your encryption key ``` @@ -444,20 +525,18 @@ As soon as you import a `Shunt` and it can be combined ([see condition](YamBMS_b ```YAML shunt1: !include - file: packages/shunt/shunt_junctek_khf_UART.yaml + file: packages/shunt/shunt_combine_Junctek_KHF_UART.yaml # shunt_modbus_Junctek_KHF_UART.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to send information to - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' - shunt_uart_id: uart_esp_1 + shunt_uart_id: 'uart_esp_1' ``` ## YamBMS +> [!TIP] +> This package is only used with the `YamBMS` main node. + > [!CAUTION] > By default, `YamBMS` is configured with the values ​​for a 16S LFP battery ! @@ -468,8 +547,6 @@ Take the time to configure `YamBMS` correctly according to your battery chemistr file: packages/yambms/yambms.yaml vars: # 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' @@ -497,6 +574,10 @@ Take the time to configure `YamBMS` correctly according to your battery chemistr ## CAN bus +> [!TIP] +> This package is only used with the `YamBMS` main node. +> It's possible to use this package multiple times in order to send information on two different CAN bus. + The CAN bus connected to your inverter via the CAN transceiver `canbus_node1`. You can keep the default configuration. @@ -505,8 +586,6 @@ You can keep the default configuration. canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' diff --git a/documents/README/YamBMS_multi-node_RS485_modbus_solution.md b/documents/README/YamBMS_multi-node_RS485_modbus_solution.md new file mode 100644 index 0000000..d9c4b98 --- /dev/null +++ b/documents/README/YamBMS_multi-node_RS485_modbus_solution.md @@ -0,0 +1,11 @@ +# YamBMS - JK-PB BMS RS485 Solution + +[![Badge License: GPLv3](https://img.shields.io/badge/License-GPLv3-brightgreen.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![Badge Version](https://img.shields.io/github/v/release/Sleeper85/esphome-yambms?include_prereleases&color=yellow&logo=DocuSign&logoColor=white)](https://github.com/Sleeper85/esphome-yambms/releases/latest) +![GitHub stars](https://img.shields.io/github/stars/Sleeper85/esphome-yambms) +![GitHub forks](https://img.shields.io/github/forks/Sleeper85/esphome-yambms) +![GitHub watchers](https://img.shields.io/github/watchers/Sleeper85/esphome-yambms) + +## Titre + +Each shunt/bms turns into a modbus server with its own address. The max number of BMS per ESP32 (UART/BLE) is 2 but you can use one ESP32 per battery if you want. \ No newline at end of file diff --git a/images/PCB_ESP32_JK-BMS-CAN_Prototype.png b/images/PCB_ESP32_JK-BMS-CAN_Prototype.png new file mode 100644 index 0000000..48047ab Binary files /dev/null and b/images/PCB_ESP32_JK-BMS-CAN_Prototype.png differ diff --git a/images/YamBMS_HA_Dashboard.png b/images/YamBMS_HA_Dashboard.png index 4a0827c..e7a05d2 100644 Binary files a/images/YamBMS_HA_Dashboard.png and b/images/YamBMS_HA_Dashboard.png differ diff --git a/images/YamBMS_HA_Dashboard_Black.png b/images/YamBMS_HA_Dashboard_Black.png deleted file mode 100644 index cf6ac29..0000000 Binary files a/images/YamBMS_HA_Dashboard_Black.png and /dev/null differ diff --git a/images/YamBMS_multi-node_RS485_modbus.png b/images/YamBMS_multi-node_RS485_modbus.png new file mode 100644 index 0000000..9edf52e Binary files /dev/null and b/images/YamBMS_multi-node_RS485_modbus.png differ diff --git a/multi-bms_DEMO.yaml b/multi-bms_DEMO.yaml index fbcc9cc..677fff8 100644 --- a/multi-bms_DEMO.yaml +++ b/multi-bms_DEMO.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -79,16 +79,14 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + shunt1: !include - file: packages/shunt/shunt_fake.yaml + file: packages/shunt/shunt_combine_FAKE.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' # Shunt sensors values shunt_voltage: '53.41' # V shunt_current: '37.5' # A @@ -96,15 +94,10 @@ packages: shunt_soc: '86' # % bms1: !include - file: packages/bms/bms_FAKE.yaml + file: packages/bms/bms_combine_FAKE.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' # BMS sensors values bms_battery_capacity: '280' # Ah bms_battery_capacity_remaining: '243' # Ah @@ -128,15 +121,10 @@ packages: bms_charging_cycles: '178' # charging cycles number Used to calculate the SoH bms2: !include - file: packages/bms/bms_FAKE.yaml + file: packages/bms/bms_combine_FAKE.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '2' # must be a number bms_name: 'BMS 2' - bms_update_interval: '3s' - bms_combine_interval: '1s' # BMS sensors values bms_battery_capacity: '280' # Ah bms_battery_capacity_remaining: '238' # Ah @@ -160,15 +148,10 @@ packages: bms_charging_cycles: '226' # charging cycles number Used to calculate the SoH bms3: !include - file: packages/bms/bms_FAKE.yaml + file: packages/bms/bms_combine_FAKE.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '3' # must be a number bms_name: 'BMS 3' - bms_update_interval: '3s' - bms_combine_interval: '1s' # BMS sensors values bms_battery_capacity: '280' # Ah bms_battery_capacity_remaining: '232' # Ah @@ -195,8 +178,6 @@ packages: file: packages/yambms/yambms.yaml vars: # 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' @@ -224,9 +205,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JBD_UART.yaml b/multi-bms_JBD_UART.yaml index 99a78e9..1263374 100644 --- a/multi-bms_JBD_UART.yaml +++ b/multi-bms_JBD_UART.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -79,30 +79,23 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 bms1: !include - file: packages/bms/bms_JBD_UART_full.yaml + file: packages/bms/bms_combine_JBD_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_1 - bms_rx_timeout: 150ms + bms_uart_id: 'uart_esp_1' + bms_rx_timeout: '150ms' # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings # LFP values example @@ -113,17 +106,12 @@ packages: bms_balance_trigger_voltage: '0.010' # V. Used by 'Auto CVL' functions bms2: !include - file: packages/bms/bms_JBD_UART_full.yaml + file: packages/bms/bms_combine_JBD_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '2' # must be a number bms_name: 'BMS 2' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_2 - bms_rx_timeout: 150ms + bms_uart_id: 'uart_esp_2' + bms_rx_timeout: '150ms' # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings # LFP values example @@ -137,8 +125,6 @@ packages: file: packages/yambms/yambms.yaml vars: # 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' @@ -166,9 +152,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-ALL_BLE.yaml b/multi-bms_JK-ALL_BLE.yaml index 77704d3..df37de2 100644 --- a/multi-bms_JK-ALL_BLE.yaml +++ b/multi-bms_JK-ALL_BLE.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -36,6 +36,7 @@ logger: logs: esp32_ble_tracker: INFO esp32_ble_client: INFO + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" ota: platform: esphome @@ -87,50 +88,36 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 bms1: !include - file: packages/bms/bms_JK-ALL_BLE_standard.yaml + file: packages/bms/bms_combine_JK-ALL_BLE_standard.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_ble_protocol_version: JK02_32S # JK02_24S < hardware version 11.0 >= JK02_32S - bms_ble_mac_address: C8:47:8C:10:7E:AA + bms_ble_protocol_version: 'JK02_32S' # JK02_24S < hardware version 11.0 >= JK02_32S + bms_ble_mac_address: 'C8:47:8C:10:7E:AA' bms2: !include - file: packages/bms/bms_JK-ALL_BLE_standard.yaml + file: packages/bms/bms_combine_JK-ALL_BLE_standard.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_ble_protocol_version: JK02_32S # JK02_24S < hardware version 11.0 >= JK02_32S - bms_ble_mac_address: C8:47:8C:EE:16:EA + bms_ble_protocol_version: 'JK02_32S' # JK02_24S < hardware version 11.0 >= JK02_32S + bms_ble_mac_address: 'C8:47:8C:EE:16:EA' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -158,9 +145,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-B_UART.yaml b/multi-bms_JK-B_UART.yaml index b649170..54eeb05 100644 --- a/multi-bms_JK-B_UART.yaml +++ b/multi-bms_JK-B_UART.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -79,48 +79,34 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 bms1: !include - file: packages/bms/bms_JK-B_UART_full.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_1 + bms_uart_id: 'uart_esp_1' bms2: !include - file: packages/bms/bms_JK-B_UART_full.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_2 + bms_uart_id: 'uart_esp_2' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -148,9 +134,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-B_UART_pvbrain2.yaml b/multi-bms_JK-B_UART_pvbrain2.yaml index eaedb2d..4761ab2 100644 --- a/multi-bms_JK-B_UART_pvbrain2.yaml +++ b/multi-bms_JK-B_UART_pvbrain2.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/SeByDocKy/pvbrain2 # GitHub : https://github.com/Sleeper85/esphome-yambms @@ -25,7 +25,7 @@ substitutions: uart0_baudrate: '2400' #WKS {RJ45-UART0} uart1_baudrate: '38400' #JSY193 - uart2_baudrate: '19200' #smartshunt + uart2_baudrate: '19200' #SmartShunt uart3_baudrate: '9600' #SRNE {RJ45-UART3} uart4_baudrate: '115200' #JK-BMS 1 uart5_baudrate: '115200' #JK-BMS 2 @@ -80,6 +80,9 @@ packages: device_base: !include packages/base/device_base.yaml device_board: !include packages/board/board_pvbrain2.yaml + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # BUS # bus_i2c0: !include pvbrain2/base/device_bus_i2c0.yaml # SX1509 and BME280/BMP280 bus_spi1: !include pvbrain2/base/device_bus_spi1.yaml # MCP2515 @@ -102,47 +105,30 @@ packages: # You don't have to import a shunt but you must import at least one BMS. shunt1: !include - file: packages/shunt/shunt_victron_smartshunt_UART_pvbrain2.yaml # shunt_junctek_khf_UART.yaml + file: packages/shunt/shunt_combine_Victron_SmartShunt_UART_expander.yaml # shunt_combine_Junctek_KHF_UART.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' - shunt_uart_id: uart_${uart_hub_bus}_2 + shunt_uart_id: 'uart_${uart_hub_bus}_2' bms1: !include - file: packages/bms/bms_JK-B_UART_full.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_${uart_hub_bus}_4 + bms_uart_id: 'uart_${uart_hub_bus}_4' bms2: !include - file: packages/bms/bms_JK-B_UART_full.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_${uart_hub_bus}_5 + bms_uart_id: 'uart_${uart_hub_bus}_5' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -170,9 +156,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-PB_RS485_mode2.yaml b/multi-bms_JK-PB_RS485_mode2.yaml index 81be61c..9553b82 100644 --- a/multi-bms_JK-PB_RS485_mode2.yaml +++ b/multi-bms_JK-PB_RS485_mode2.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -79,23 +79,21 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 # The sniffer represents the ESP node connected to the JK-BMS PB RS485 bus # If address 0x00 is not detected on the RS485 bus, the sniffer will act directly as a master BMS (mode 2, max 15 BMS) # sniffer1: !include - # file: packages/bms/bms_JK-PB_RS485_sniffer_talk_pin.yaml + # file: packages/bms/bms_combine_JK-PB_RS485_sniffer_talk_pin.yaml # vars: # sniffer_id: 'sniffer1' # sniffer_protocol: 'JK02_32S' @@ -103,7 +101,7 @@ packages: # sniffer_talk_pin: 8 # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10 sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -111,109 +109,79 @@ packages: # Mode2 : configure the DIP switches of your BMS from 0x01 to 0x0F (don't use the 0x00 address, maximum 15 BMS) bms1: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms2: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' bms_rs485_address: '0x02' # BMS 2 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms3: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '3' # must be a number bms_name: 'JK-BMS 3' bms_rs485_address: '0x03' # BMS 3 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms4: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '4' # must be a number bms_name: 'JK-BMS 4' bms_rs485_address: '0x04' # BMS 4 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms5: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '5' # must be a number bms_name: 'JK-BMS 5' bms_rs485_address: '0x05' # BMS 5 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms6: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '6' # must be a number bms_name: 'JK-BMS 6' bms_rs485_address: '0x06' # BMS 6 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms7: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '7' # must be a number bms_name: 'JK-BMS 7' bms_rs485_address: '0x07' # BMS 7 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -241,9 +209,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-PB_RS485_mode2_AtomS3.yaml b/multi-bms_JK-PB_RS485_mode2_AtomS3.yaml index bf1d122..2927168 100644 --- a/multi-bms_JK-PB_RS485_mode2_AtomS3.yaml +++ b/multi-bms_JK-PB_RS485_mode2_AtomS3.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -75,23 +75,21 @@ packages: canbus_id: 'canbus1' display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 # The sniffer represents the ESP node connected to the JK-BMS PB RS485 bus # If address 0x00 is not detected on the RS485 bus, the sniffer will act directly as a master BMS (mode 2, max 15 BMS) # sniffer1: !include - # file: packages/bms/bms_JK-PB_RS485_sniffer_talk_pin.yaml + # file: packages/bms/bms_combine_JK-PB_RS485_sniffer_talk_pin.yaml # vars: # sniffer_id: 'sniffer1' # sniffer_protocol: 'JK02_32S' @@ -99,7 +97,7 @@ packages: # sniffer_talk_pin: 8 # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10 sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -107,39 +105,79 @@ packages: # Mode2 : configure the DIP switches of your BMS from 0x01 to 0x0F (don't use the 0x00 address, maximum 15 BMS) bms1: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms2: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' bms_rs485_address: '0x02' # BMS 2 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + + # bms3: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '3' # must be a number + # bms_name: 'JK-BMS 3' + # bms_rs485_address: '0x03' # BMS 3 DIP switch + + # bms4: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '4' # must be a number + # bms_name: 'JK-BMS 4' + # bms_rs485_address: '0x04' # BMS 4 DIP switch + + # bms5: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '5' # must be a number + # bms_name: 'JK-BMS 5' + # bms_rs485_address: '0x05' # BMS 5 DIP switch + + # bms6: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '6' # must be a number + # bms_name: 'JK-BMS 6' + # bms_rs485_address: '0x06' # BMS 6 DIP switch + + # bms7: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '7' # must be a number + # bms_name: 'JK-BMS 7' + # bms_rs485_address: '0x07' # BMS 7 DIP switch yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -167,9 +205,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-PB_RS485_mode2_ETH01-EVO.yaml b/multi-bms_JK-PB_RS485_mode2_ETH01-EVO.yaml index 8ccc71b..7b25e33 100644 --- a/multi-bms_JK-PB_RS485_mode2_ETH01-EVO.yaml +++ b/multi-bms_JK-PB_RS485_mode2_ETH01-EVO.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.11.26 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -67,23 +67,21 @@ packages: device_base: !include packages/base/device_base_ethernet.yaml device_board: !include packages/board/board_esp32-c3-eth01-evo.yaml + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 # The sniffer represents the ESP node connected to the JK-BMS PB RS485 bus # If address 0x00 is not detected on the RS485 bus, the sniffer will act directly as a master BMS (mode 2, max 15 BMS) sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -91,39 +89,79 @@ packages: # Mode2 : configure the DIP switches of your BMS from 0x01 to 0x0F (don't use the 0x00 address, maximum 15 BMS) bms1: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms2: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' bms_rs485_address: '0x02' # BMS 2 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + + # bms3: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '3' # must be a number + # bms_name: 'JK-BMS 3' + # bms_rs485_address: '0x03' # BMS 3 DIP switch + + # bms4: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '4' # must be a number + # bms_name: 'JK-BMS 4' + # bms_rs485_address: '0x04' # BMS 4 DIP switch + + # bms5: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '5' # must be a number + # bms_name: 'JK-BMS 5' + # bms_rs485_address: '0x05' # BMS 5 DIP switch + + # bms6: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '6' # must be a number + # bms_name: 'JK-BMS 6' + # bms_rs485_address: '0x06' # BMS 6 DIP switch + + # bms7: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '7' # must be a number + # bms_name: 'JK-BMS 7' + # bms_rs485_address: '0x07' # BMS 7 DIP switch yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -151,9 +189,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_JK-PB_RS485_mode2_pvbrain2.yaml b/multi-bms_JK-PB_RS485_mode2_pvbrain2.yaml index 16b3617..318fbe0 100644 --- a/multi-bms_JK-PB_RS485_mode2_pvbrain2.yaml +++ b/multi-bms_JK-PB_RS485_mode2_pvbrain2.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/SeByDocKy/pvbrain2 # GitHub : https://github.com/Sleeper85/esphome-yambms @@ -80,6 +80,9 @@ packages: device_base: !include packages/base/device_base.yaml device_board: !include packages/board/board_pvbrain2.yaml + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # BUS # bus_i2c0: !include pvbrain2/base/device_bus_i2c0.yaml # SX1509 and BME280/BMP280 bus_spi1: !include pvbrain2/base/device_bus_spi1.yaml # MCP2515 @@ -102,22 +105,17 @@ packages: # You don't have to import a shunt but you must import at least one BMS. shunt1: !include - file: packages/shunt/shunt_victron_smartshunt_UART_pvbrain2.yaml # shunt_junctek_khf_UART.yaml + file: packages/shunt/shunt_combine_Victron_SmartShunt_UART_expander.yaml # shunt_combine_Junctek_KHF_UART.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' shunt_uart_id: uart_${uart_hub_bus}_2 # The sniffer represents the ESP node connected to the JK-BMS PB RS485 bus # If address 0x00 is not detected on the RS485 bus, the sniffer will act directly as a master BMS (mode 2, max 15 BMS) sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -125,109 +123,79 @@ packages: # Mode2 : configure the DIP switches of your BMS from 0x01 to 0x0F (don't use the 0x00 address, maximum 15 BMS) bms1: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' bms2: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '2' # must be a number bms_name: 'JK-BMS 2' bms_rs485_address: '0x02' # BMS 2 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' - bms3: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml - vars: - # YamBMS ID - yambms_id: 'yambms1' - # Sniffer ID - sniffer_id: 'sniffer1' - # BMS vars - bms_id: '3' # must be a number - bms_name: 'JK-BMS 3' - bms_rs485_address: '0x03' # BMS 3 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + # bms3: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '3' # must be a number + # bms_name: 'JK-BMS 3' + # bms_rs485_address: '0x03' # BMS 3 DIP switch - bms4: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml - vars: - # YamBMS ID - yambms_id: 'yambms1' - # Sniffer ID - sniffer_id: 'sniffer1' - # BMS vars - bms_id: '4' # must be a number - bms_name: 'JK-BMS 4' - bms_rs485_address: '0x04' # BMS 4 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + # bms4: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '4' # must be a number + # bms_name: 'JK-BMS 4' + # bms_rs485_address: '0x04' # BMS 4 DIP switch - bms5: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml - vars: - # YamBMS ID - yambms_id: 'yambms1' - # Sniffer ID - sniffer_id: 'sniffer1' - # BMS vars - bms_id: '5' # must be a number - bms_name: 'JK-BMS 5' - bms_rs485_address: '0x05' # BMS 5 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + # bms5: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '5' # must be a number + # bms_name: 'JK-BMS 5' + # bms_rs485_address: '0x05' # BMS 5 DIP switch - bms6: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml - vars: - # YamBMS ID - yambms_id: 'yambms1' - # Sniffer ID - sniffer_id: 'sniffer1' - # BMS vars - bms_id: '6' # must be a number - bms_name: 'JK-BMS 6' - bms_rs485_address: '0x06' # BMS 6 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + # bms6: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '6' # must be a number + # bms_name: 'JK-BMS 6' + # bms_rs485_address: '0x06' # BMS 6 DIP switch - bms7: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml - vars: - # YamBMS ID - yambms_id: 'yambms1' - # Sniffer ID - sniffer_id: 'sniffer1' - # BMS vars - bms_id: '7' # must be a number - bms_name: 'JK-BMS 7' - bms_rs485_address: '0x07' # BMS 7 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' + # bms7: !include + # file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml + # vars: + # # Sniffer ID + # sniffer_id: 'sniffer1' + # # BMS vars + # bms_id: '7' # must be a number + # bms_name: 'JK-BMS 7' + # bms_rs485_address: '0x07' # BMS 7 DIP switch yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -255,9 +223,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_SEPLOS_V1_V2_RS485.yaml b/multi-bms_SEPLOS_V1_V2_RS485.yaml index efd1e20..7ab22c8 100644 --- a/multi-bms_SEPLOS_V1_V2_RS485.yaml +++ b/multi-bms_SEPLOS_V1_V2_RS485.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -79,31 +79,27 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 seplos_modbus1: !include - file: packages/bms/bms_SEPLOS_V1_V2_RS485_modbus.yaml + file: packages/bms/bms_combine_SEPLOS_V1_V2_RS485_modbus.yaml vars: seplos_modbus_id: 'seplos_modbus1' seplos_modbus_uart_id: 'uart_esp_1' - seplos_modbus_baud_rate: '9600' # Please set the baudrate of your Seplos BMS model here. It's sometimes 19200 baud instead of 9600. - seplos_modbus_rx_timeout: 150ms + seplos_modbus_baud_rate: '9600' # 9600 / 19200 ; please set the baudrate of your Seplos BMS model here + seplos_modbus_rx_timeout: '150ms' bms1: !include - file: packages/bms/bms_SEPLOS_V1_V2_RS485_bms_full.yaml + file: packages/bms/bms_combine_SEPLOS_V1_V2_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Seplos modbus ID seplos_modbus_id: 'seplos_modbus1' # BMS vars @@ -111,8 +107,6 @@ packages: bms_name: 'BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch bms_protocol_version: '0x20' # Known protocol versions: 0x20 (Seplos), 0x26 (Boqiang) - bms_update_interval: '3s' # 10s @syssi example - bms_combine_interval: '1s' # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings # LFP values example @@ -123,10 +117,8 @@ packages: bms_balance_trigger_voltage: '0.010' # V. Used by 'Auto CVL' functions bms2: !include - file: packages/bms/bms_SEPLOS_V1_V2_RS485_bms_full.yaml + file: packages/bms/bms_combine_SEPLOS_V1_V2_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Seplos modbus ID seplos_modbus_id: 'seplos_modbus1' # BMS vars @@ -134,8 +126,6 @@ packages: bms_name: 'BMS 2' bms_rs485_address: '0x02' # BMS 2 DIP switch bms_protocol_version: '0x20' # Known protocol versions: 0x20 (Seplos), 0x26 (Boqiang) - bms_update_interval: '3s' # 10s @syssi example - bms_combine_interval: '1s' bms_uart_id: uart_esp_2 # Required settings cannot be retrieved from BMS # These values ​​must match your BMS settings @@ -150,8 +140,6 @@ packages: file: packages/yambms/yambms.yaml vars: # 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' @@ -179,9 +167,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-bms_DEMO_AtomS3.yaml b/multi-node_node1_YamBMS_modbus_client.yaml similarity index 55% rename from multi-bms_DEMO_AtomS3.yaml rename to multi-node_node1_YamBMS_modbus_client.yaml index cbda32f..f83bffd 100644 --- a/multi-bms_DEMO_AtomS3.yaml +++ b/multi-node_node1_YamBMS_modbus_client.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -18,7 +18,7 @@ # along with this program. If not, see . substitutions: - name: yambms-demo + name: yambms-node1 # Don't forget to configure your WiFi credentials in the secrets.yaml file # @@ -32,7 +32,7 @@ substitutions: # dns2: 8.8.4.4 logger: - level: DEBUG # DEBUG / INFO / WARN + level: INFO # DEBUG / INFO / WARN ota: platform: esphome @@ -67,6 +67,10 @@ api: packages: device_base: !include packages/base/device_base.yaml + # Board : uncomment your board + # device_board: !include packages/board/board_esp32-devkit-v1.yaml + # device_board: !include packages/board/board_esp32-s3-devkitc-1.yaml + # device_board: !include packages/board/board_atom-s3-lite.yaml device_board: !include file: packages/board/board_atom-s3.yaml # board_atom-s3r.yaml @@ -75,124 +79,86 @@ packages: canbus_id: 'canbus1' display_auto_next_page_interval: '5s' + # Config : this YAMLs contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + config_multinode_modbus: !include packages/config/config_multi-node_modbus.yaml + + modbus: !include + file: packages/base/device_modbus.yaml + vars: + modbus_role: 'client' # client / server + modbus_uart_id: 'uart_esp_1' # RS485 board + shunt1: !include - file: packages/shunt/shunt_fake.yaml + file: packages/shunt/shunt_combine_modbus_client.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # Shunt vars shunt_id: '1' # must be a number shunt_name: 'Shunt 1' - shunt_update_interval: '3s' - shunt_combine_interval: '1s' - # Shunt sensors values - shunt_voltage: '53.41' # V - shunt_current: '37.5' # A - shunt_power: '2003' # W - shunt_soc: '86' # % bms1: !include - file: packages/bms/bms_FAKE.yaml + file: packages/bms/bms_combine_modbus_client.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - # BMS sensors values - bms_battery_capacity: '280' # Ah - bms_battery_capacity_remaining: '243' # Ah - bms_voltage: '53.45' # V - bms_current: '9.2' # A - bms_power: '492' # W - bms_soc: '87' # % - bms_min_cell_voltage: '3.339' # V - bms_min_voltage_cell: '2' # cell number 1~16 - bms_max_cell_voltage: '3.341' # V - bms_max_voltage_cell: '11' # cell number 1~16 - bms_temperature_sensor_1: '21.1' # °C - bms_temperature_sensor_2: '21.3' # °C - bms_temperature_sensor_3: '21.5' # °C - bms_temperature_sensor_4: '21.7' # °C - bms_max_charge_current: '100' # A - bms_max_discharge_current: '100' # A - bms_cell_ovp: '3.650' # V Used by 'Auto CCL' functions - bms_cell_uvp: '2.800' # V Used by 'Auto DCL' functions and to calculate maximum discharge voltage - bms_balance_trigger_voltage: '0.010' # V Used by 'Auto CVL' functions - bms_charging_cycles: '178' # charging cycles number Used to calculate the SoH - + bms2: !include - file: packages/bms/bms_FAKE.yaml + file: packages/bms/bms_combine_modbus_client.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '2' # must be a number bms_name: 'BMS 2' - bms_update_interval: '3s' - bms_combine_interval: '1s' - # BMS sensors values - bms_battery_capacity: '280' # Ah - bms_battery_capacity_remaining: '238' # Ah - bms_voltage: '53.41' # V - bms_current: '11.3' # A - bms_power: '604' # W - bms_soc: '85' # % - bms_min_cell_voltage: '3.337' # V - bms_min_voltage_cell: '14' # cell number 1~16 - bms_max_cell_voltage: '3.339' # V - bms_max_voltage_cell: '3' # cell number 1~16 - bms_temperature_sensor_1: '21.8' # °C - bms_temperature_sensor_2: '21.6' # °C - bms_temperature_sensor_3: '21.4' # °C - bms_temperature_sensor_4: '21.2' # °C - bms_max_charge_current: '100' # A - bms_max_discharge_current: '100' # A - bms_cell_ovp: '3.650' # V Used by 'Auto CCL' functions - bms_cell_uvp: '2.800' # V Used by 'Auto DCL' functions and to calculate maximum discharge voltage - bms_balance_trigger_voltage: '0.010' # V Used by 'Auto CVL' functions - bms_charging_cycles: '226' # charging cycles number Used to calculate the SoH bms3: !include - file: packages/bms/bms_FAKE.yaml + file: packages/bms/bms_combine_modbus_client.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '3' # must be a number bms_name: 'BMS 3' - bms_update_interval: '3s' - bms_combine_interval: '1s' - # BMS sensors values - bms_battery_capacity: '280' # Ah - bms_battery_capacity_remaining: '232' # Ah - bms_voltage: '53.37' # V - bms_current: '15.7' # A - bms_power: '838' # W - bms_soc: '83' # % - bms_min_cell_voltage: '3.334' # V - bms_min_voltage_cell: '7' # cell number 1~16 - bms_max_cell_voltage: '3.336' # V - bms_max_voltage_cell: '9' # cell number 1~16 - bms_temperature_sensor_1: '21.9' # °C - bms_temperature_sensor_2: '22.0' # °C - bms_temperature_sensor_3: '22.1' # °C - bms_temperature_sensor_4: '22.2' # °C - bms_max_charge_current: '100' # A - bms_max_discharge_current: '100' # A - bms_cell_ovp: '3.650' # V Used by 'Auto CCL' functions - bms_cell_uvp: '2.800' # V Used by 'Auto DCL' functions and to calculate maximum discharge voltage - bms_balance_trigger_voltage: '0.010' # V Used by 'Auto CVL' functions - bms_charging_cycles: '194' # charging cycles number Used to calculate the SoH + + # bms4: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '4' # must be a number + # bms_name: 'BMS 4' + + # bms5: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '5' # must be a number + # bms_name: 'BMS 5' + + # bms6: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '6' # must be a number + # bms_name: 'BMS 6' + + # bms7: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '7' # must be a number + # bms_name: 'BMS 7' + + # bms8: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '8' # must be a number + # bms_name: 'BMS 8' + + # bms9: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '9' # must be a number + # bms_name: 'BMS 9' + + # bms10: !include + # file: packages/bms/bms_combine_modbus_client.yaml + # vars: + # bms_id: '10' # must be a number + # bms_name: 'BMS 10' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -220,9 +186,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/multi-node_node2_BMS_modbus_server.yaml b/multi-node_node2_BMS_modbus_server.yaml new file mode 100644 index 0000000..e3c77fe --- /dev/null +++ b/multi-node_node2_BMS_modbus_server.yaml @@ -0,0 +1,118 @@ +# Updated : 2024.12.23 +# Version : 1.5.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 . + +substitutions: + name: yambms-node2 + +# Don't forget to configure your WiFi credentials in the secrets.yaml file +# +# 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 # DEBUG / INFO / WARN + +ota: + platform: esphome + +# Please use the native `api` component instead of the `mqtt` section. +# If you use Home Assistant, the native API is more lightweight. +# If there is no HA server connected to this API, the ESP32 reboots every 15 minutes to try to resolve the problem. +# The "reboot_timeout: 0s" option will keep your ESP32 up and running even if you lose connection to your HA server. +api: + reboot_timeout: 0s + +# If you don't want to use ESPHome's native API you can use MQTT instead. +# In this case don't forget to remove the 'api:' section. +# mqtt: +# broker: !secret mqtt_host +# username: !secret mqtt_username +# password: !secret mqtt_password +# id: mqtt_client + +# Please note that enabling this component will take up a lot of memory and may decrease +# stability and be the cause of reboot depending on the capabilities of the board used. +#web_server: +# port: 80 +# log: false +# ota: false + +# Remove canbus_node1 (not necessary) +canbus: + - id: !remove canbus_node1 + +# +--------------------------------------+ +# | Packages | +# +--------------------------------------+ + +# PLEASE READ : https://github.com/Sleeper85/esphome-yambms/blob/main/documents/README/YamBMS_main_YAML_HowTo.md + +packages: + device_base: !include packages/base/device_base.yaml + # Board : uncomment your board + # device_board: !include packages/board/board_esp32-devkit-v1.yaml + device_board: !include packages/board/board_esp32-s3-devkitc-1.yaml + # device_board: !include packages/board/board_atom-s3-lite.yaml + + # device_board: !include + # file: packages/board/board_atom-s3.yaml # board_atom-s3r.yaml + # vars: + # yambms_id: 'yambms1' + # canbus_id: 'canbus1' + # display_auto_next_page_interval: '5s' + + # Config : this YAMLs contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + config_multinode_modbus: !include packages/config/config_multi-node_modbus.yaml + + modbus: !include + file: packages/base/device_modbus.yaml + vars: + modbus_role: 'server' # client / server + modbus_uart_id: 'uart_esp_1' # RS485 board + + shunt1: !include + file: packages/shunt/shunt_modbus_Victron_SmartShunt_UART.yaml + vars: + shunt_id: '1' # must be a number + shunt_name: 'Shunt 1' + shunt_uart_id: 'uart_esp_2' + + bms1: !include + file: packages/bms/bms_modbus_JK-B_UART_full.yaml + vars: + bms_id: '1' # must be a number + bms_name: 'JK-BMS 1' + bms_uart_id: 'uart_esp_3' + +# +--------------------------------------+ +# | DEBUG ( logger level must be DEBUG ) | +# +--------------------------------------+ + + device_debug: !include + file: packages/base/device_debug_ESP32.yaml + vars: + debug_name: 'Debug' + debug_update_interval: '5s' diff --git a/multi-node_node3_BMS_modbus_server.yaml b/multi-node_node3_BMS_modbus_server.yaml new file mode 100644 index 0000000..8dca260 --- /dev/null +++ b/multi-node_node3_BMS_modbus_server.yaml @@ -0,0 +1,122 @@ +# Updated : 2024.12.23 +# Version : 1.5.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 . + +substitutions: + name: yambms-node2 + +# Don't forget to configure your WiFi credentials in the secrets.yaml file +# +# 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 # DEBUG / INFO / WARN + baud_rate: 0 # avoid modbus reading errors with BLE-supervised BMS + +ota: + platform: esphome + +# Please use the native `api` component instead of the `mqtt` section. +# If you use Home Assistant, the native API is more lightweight. +# If there is no HA server connected to this API, the ESP32 reboots every 15 minutes to try to resolve the problem. +# The "reboot_timeout: 0s" option will keep your ESP32 up and running even if you lose connection to your HA server. +api: + reboot_timeout: 0s + +# If you don't want to use ESPHome's native API you can use MQTT instead. +# In this case don't forget to remove the 'api:' section. +# mqtt: +# broker: !secret mqtt_host +# username: !secret mqtt_username +# password: !secret mqtt_password +# id: mqtt_client + +# Please note that enabling this component will take up a lot of memory and may decrease +# stability and be the cause of reboot depending on the capabilities of the board used. +#web_server: +# port: 80 +# log: false +# ota: false + +# Remove canbus_node1 (not necessary) +canbus: + - id: !remove canbus_node1 + +# +--------------------------------------+ +# | Packages | +# +--------------------------------------+ + +# PLEASE READ : https://github.com/Sleeper85/esphome-yambms/blob/main/documents/README/YamBMS_main_YAML_HowTo.md + +packages: + device_base: !include packages/base/device_base.yaml + # Board : uncomment your board + # device_board: !include packages/board/board_esp32-devkit-v1.yaml + # device_board: !include packages/board/board_esp32-s3-devkitc-1.yaml + device_board: !include packages/board/board_atom-s3-lite.yaml + + # device_board: !include + # file: packages/board/board_atom-s3.yaml # board_atom-s3r.yaml + # vars: + # yambms_id: 'yambms1' + # canbus_id: 'canbus1' + # display_auto_next_page_interval: '5s' + + # Config : this YAMLs contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + config_multinode_modbus: !include packages/config/config_multi-node_modbus.yaml + + modbus: !include + file: packages/base/device_modbus.yaml + vars: + modbus_role: 'server' # client / server + modbus_uart_id: 'uart_esp_1' # RS485 board + modbus_baud_rate: '19200' # 9600 / 19200 / 115200 + + bms2: !include + file: packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml + vars: + bms_id: '2' # must be a number, also represents the modbus server number ! + bms_name: 'JK-BMS 2' + bms_ble_protocol_version: JK02_32S # JK02_24S < hardware version 11.0 >= JK02_32S + bms_ble_mac_address: C8:47:8C:10:7E:AA + + bms3: !include + file: packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml + vars: + bms_id: '3' # must be a number, also represents the modbus server number ! + bms_name: 'JK-BMS 3' + bms_ble_protocol_version: JK02_32S # JK02_24S < hardware version 11.0 >= JK02_32S + bms_ble_mac_address: C8:47:8C:EE:16:EA + +# +--------------------------------------+ +# | DEBUG ( logger level must be DEBUG ) | +# +--------------------------------------+ + + device_debug: !include + file: packages/base/device_debug_ESP32.yaml + vars: + debug_name: 'Debug' + debug_update_interval: '5s' diff --git a/one-bms_JK-ALL_BLE.yaml b/one-bms_JK-ALL_BLE.yaml index 7a307c3..e872cda 100644 --- a/one-bms_JK-ALL_BLE.yaml +++ b/one-bms_JK-ALL_BLE.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -88,37 +88,28 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 bms1: !include - file: packages/bms/bms_JK-ALL_BLE_standard.yaml + file: packages/bms/bms_combine_JK-ALL_BLE_standard.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_ble_protocol_version: JK02_32S # JK02_24S < hardware version 11.0 >= JK02_32S - bms_ble_mac_address: C8:47:80:09:37:ED + bms_ble_protocol_version: 'JK02_32S' # JK02_24S < hardware version 11.0 >= JK02_32S + bms_ble_mac_address: 'C8:47:8C:10:7E:AA' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -146,9 +137,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/one-bms_JK-B_UART.yaml b/one-bms_JK-B_UART.yaml index dfc096d..b0f8214 100644 --- a/one-bms_JK-B_UART.yaml +++ b/one-bms_JK-B_UART.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -80,36 +80,27 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 bms1: !include - file: packages/bms/bms_JK-B_UART_full.yaml + file: packages/bms/bms_combine_JK-B_UART_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' - # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' - bms_update_interval: '3s' - bms_combine_interval: '1s' - bms_uart_id: uart_esp_1 + bms_uart_id: 'uart_esp_1' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -137,9 +128,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' @@ -147,7 +135,6 @@ packages: # 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' - # +--------------------------------------+ # | DEBUG ( logger level must be DEBUG ) | # +--------------------------------------+ diff --git a/one-bms_JK-PB_RS485_mode2.yaml b/one-bms_JK-PB_RS485_mode2.yaml index 9e09935..5835af3 100644 --- a/one-bms_JK-PB_RS485_mode2.yaml +++ b/one-bms_JK-PB_RS485_mode2.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -79,23 +79,21 @@ packages: # canbus_id: 'canbus1' # display_auto_next_page_interval: '5s' + # Config : this YAML contains the settings shared between all ESP32s + config_yambms: !include packages/config/config_yambms.yaml + # shunt1: !include - # file: packages/shunt/shunt_victron_smartshunt_UART.yaml # shunt_junctek_khf_UART.yaml + # file: packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml # shunt_combine_Junctek_KHF_UART.yaml # vars: - # # YamBMS ID - # yambms_id: 'yambms1' - # # Shunt vars # shunt_id: '1' # must be a number # shunt_name: 'Shunt 1' - # shunt_update_interval: '3s' - # shunt_combine_interval: '1s' # shunt_uart_id: uart_esp_0 # The sniffer represents the ESP node connected to the JK-BMS PB RS485 bus # If address 0x00 is not detected on the RS485 bus, the sniffer will act directly as a master BMS (mode 2, max 15 BMS) # sniffer1: !include - # file: packages/bms/bms_JK-PB_RS485_sniffer_talk_pin.yaml + # file: packages/bms/bms_combine_JK-PB_RS485_sniffer_talk_pin.yaml # vars: # sniffer_id: 'sniffer1' # sniffer_protocol: 'JK02_32S' @@ -103,7 +101,7 @@ packages: # sniffer_talk_pin: 8 # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10 sniffer1: !include - file: packages/bms/bms_JK-PB_RS485_sniffer.yaml + file: packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml vars: sniffer_id: 'sniffer1' sniffer_protocol: 'JK02_32S' @@ -111,25 +109,19 @@ packages: # Mode2 : configure the DIP switches of your BMS from 0x01 to 0x0F (don't use the 0x00 address, maximum 15 BMS) bms1: !include - file: packages/bms/bms_JK-PB_RS485_bms_full.yaml + file: packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # Sniffer ID sniffer_id: 'sniffer1' # BMS vars bms_id: '1' # must be a number bms_name: 'JK-BMS 1' bms_rs485_address: '0x01' # BMS 1 DIP switch - bms_update_interval: '3s' # going below '3s' can cause problems - bms_combine_interval: '1s' yambms1: !include file: packages/yambms/yambms.yaml vars: # 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' @@ -157,9 +149,6 @@ packages: canbus1: !include file: packages/yambms/yambms_canbus.yaml vars: - # YamBMS ID - yambms_id: 'yambms1' # YamBMS ID to retrieve information from - # CANBUS vars canbus_id: 'canbus1' canbus_name: 'CANBUS 1' canbus_node_id: 'canbus_node1' diff --git a/packages/base/device_base.yaml b/packages/base/device_base.yaml index 92ff529..e5742aa 100644 --- a/packages/base/device_base.yaml +++ b/packages/base/device_base.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -18,7 +18,7 @@ # along with this program. If not, see . substitutions: - yambms_version: "1.5.1" + yambms_version: "1.5.2" esphome: name: ${name} diff --git a/packages/base/device_base_ethernet.yaml b/packages/base/device_base_ethernet.yaml index 1a5c6a0..4761add 100644 --- a/packages/base/device_base_ethernet.yaml +++ b/packages/base/device_base_ethernet.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -18,7 +18,7 @@ # along with this program. If not, see . substitutions: - yambms_version: "1.5.1" + yambms_version: "1.5.2" esphome: name: ${name} diff --git a/packages/base/device_modbus.yaml b/packages/base/device_modbus.yaml new file mode 100644 index 0000000..96a8283 --- /dev/null +++ b/packages/base/device_modbus.yaml @@ -0,0 +1,31 @@ +# Updated : 2024.12.23 +# 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 . + +esphome: + min_version: 2024.11.3 + +uart: + - id: !extend ${modbus_uart_id} + baud_rate: ${modbus_baud_rate} + +modbus: + - uart_id: ${modbus_uart_id} + id: modbus_${modbus_role} + role: ${modbus_role} + send_wait_time: ${modbus_send_wait_time} diff --git a/packages/base/device_modbus_expander.yaml b/packages/base/device_modbus_expander.yaml new file mode 100644 index 0000000..e34baa7 --- /dev/null +++ b/packages/base/device_modbus_expander.yaml @@ -0,0 +1,27 @@ +# Updated : 2024.12.23 +# 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 . + +esphome: + min_version: 2024.11.3 + +modbus: + - uart_id: ${modbus_uart_id} + id: modbus_${modbus_role} + role: ${modbus_role} + send_wait_time: ${modbus_send_wait_time} diff --git a/packages/bms/bms_combine.yaml b/packages/bms/bms_combine.yaml index 946aa97..c15cdba 100644 --- a/packages/bms/bms_combine.yaml +++ b/packages/bms/bms_combine.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # This YAML is free software: you can redistribute it and/or diff --git a/packages/bms/bms_combine_FAKE.yaml b/packages/bms/bms_combine_FAKE.yaml new file mode 100644 index 0000000..1e14c0d --- /dev/null +++ b/packages/bms/bms_combine_FAKE.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# 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 . + +substitutions: + bms_model: "Fake BMS" + bms_protocol: "DEMO" + +packages: + bms_sensors: !include bms_sensors_FAKE.yaml + bms_combine: !include bms_combine.yaml diff --git a/packages/bms/bms_combine_JBD_UART_full.yaml b/packages/bms/bms_combine_JBD_UART_full.yaml new file mode 100644 index 0000000..bcd3cca --- /dev/null +++ b/packages/bms/bms_combine_JBD_UART_full.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/syssi/esphome-jk-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 . + +substitutions: + bms_model: "JBD" + bms_protocol: "UART" + +packages: + bms_sensors: !include bms_sensors_JBD_UART_full.yaml + bms_combine: !include bms_combine.yaml diff --git a/packages/bms/bms_JK-ALL_BLE_V14_full.yaml b/packages/bms/bms_combine_JK-ALL_BLE_V14_full.yaml similarity index 100% rename from packages/bms/bms_JK-ALL_BLE_V14_full.yaml rename to packages/bms/bms_combine_JK-ALL_BLE_V14_full.yaml diff --git a/packages/bms/bms_JK-ALL_BLE_full.yaml b/packages/bms/bms_combine_JK-ALL_BLE_full.yaml similarity index 100% rename from packages/bms/bms_JK-ALL_BLE_full.yaml rename to packages/bms/bms_combine_JK-ALL_BLE_full.yaml diff --git a/packages/bms/bms_JK-ALL_BLE_minimal.yaml b/packages/bms/bms_combine_JK-ALL_BLE_minimal.yaml similarity index 100% rename from packages/bms/bms_JK-ALL_BLE_minimal.yaml rename to packages/bms/bms_combine_JK-ALL_BLE_minimal.yaml diff --git a/packages/bms/bms_combine_JK-ALL_BLE_standard.yaml b/packages/bms/bms_combine_JK-ALL_BLE_standard.yaml new file mode 100644 index 0000000..74646b8 --- /dev/null +++ b/packages/bms/bms_combine_JK-ALL_BLE_standard.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/syssi/esphome-jk-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 . + +substitutions: + bms_model: "JK" + bms_protocol: "BLE" + +packages: + bms_sensors: !include bms_sensors_JK-ALL_BLE_standard.yaml + bms_combine: !include bms_combine.yaml diff --git a/packages/bms/bms_JK-B_RS485_DISPLAY_full.yaml b/packages/bms/bms_combine_JK-B_RS485_DISPLAY_full.yaml similarity index 100% rename from packages/bms/bms_JK-B_RS485_DISPLAY_full.yaml rename to packages/bms/bms_combine_JK-B_RS485_DISPLAY_full.yaml diff --git a/packages/bms/bms_combine_JK-B_UART_full.yaml b/packages/bms/bms_combine_JK-B_UART_full.yaml new file mode 100644 index 0000000..1334cdd --- /dev/null +++ b/packages/bms/bms_combine_JK-B_UART_full.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/syssi/esphome-jk-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 . + +substitutions: + bms_model: "JK-B" + bms_protocol: "UART" + +packages: + bms_sensors: !include bms_sensors_JK-B_UART_full.yaml + bms_combine: !include bms_combine.yaml diff --git a/packages/bms/bms_JK-B_UART_minimal.yaml b/packages/bms/bms_combine_JK-B_UART_minimal.yaml similarity index 100% rename from packages/bms/bms_JK-B_UART_minimal.yaml rename to packages/bms/bms_combine_JK-B_UART_minimal.yaml diff --git a/packages/bms/bms_JK-PB_RS485_bms_full.yaml b/packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml similarity index 100% rename from packages/bms/bms_JK-PB_RS485_bms_full.yaml rename to packages/bms/bms_combine_JK-PB_RS485_bms_full.yaml diff --git a/packages/bms/bms_JK-PB_RS485_bms_minimal.yaml b/packages/bms/bms_combine_JK-PB_RS485_bms_minimal.yaml similarity index 100% rename from packages/bms/bms_JK-PB_RS485_bms_minimal.yaml rename to packages/bms/bms_combine_JK-PB_RS485_bms_minimal.yaml diff --git a/packages/bms/bms_JK-PB_RS485_sniffer.yaml b/packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml similarity index 100% rename from packages/bms/bms_JK-PB_RS485_sniffer.yaml rename to packages/bms/bms_combine_JK-PB_RS485_sniffer.yaml diff --git a/packages/bms/bms_JK-PB_RS485_sniffer_talk_pin.yaml b/packages/bms/bms_combine_JK-PB_RS485_sniffer_talk_pin.yaml similarity index 100% rename from packages/bms/bms_JK-PB_RS485_sniffer_talk_pin.yaml rename to packages/bms/bms_combine_JK-PB_RS485_sniffer_talk_pin.yaml diff --git a/packages/bms/bms_SEPLOS_V1_V2_RS485_bms_full.yaml b/packages/bms/bms_combine_SEPLOS_V1_V2_RS485_bms_full.yaml similarity index 99% rename from packages/bms/bms_SEPLOS_V1_V2_RS485_bms_full.yaml rename to packages/bms/bms_combine_SEPLOS_V1_V2_RS485_bms_full.yaml index e58803c..0ae2fec 100644 --- a/packages/bms/bms_SEPLOS_V1_V2_RS485_bms_full.yaml +++ b/packages/bms/bms_combine_SEPLOS_V1_V2_RS485_bms_full.yaml @@ -226,7 +226,6 @@ sensor: lambda: return 0; binary_sensor: - # Required sensors cannot be retrieved from BMS # Required sensors cannot be retrieved from BMS # online_status - platform: template diff --git a/packages/bms/bms_SEPLOS_V1_V2_RS485_modbus.yaml b/packages/bms/bms_combine_SEPLOS_V1_V2_RS485_modbus.yaml similarity index 100% rename from packages/bms/bms_SEPLOS_V1_V2_RS485_modbus.yaml rename to packages/bms/bms_combine_SEPLOS_V1_V2_RS485_modbus.yaml diff --git a/packages/bms/bms_combine_modbus_client.yaml b/packages/bms/bms_combine_modbus_client.yaml new file mode 100644 index 0000000..760caf0 --- /dev/null +++ b/packages/bms/bms_combine_modbus_client.yaml @@ -0,0 +1,444 @@ +# Updated : 2024.12.23 +# 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 . + +substitutions: + bms_model: "YamBMS" + bms_protocol: "Modbus" + +packages: + bms_combine: !include bms_combine.yaml + +# +--------------------------------------+ +# | Component settings | +# +--------------------------------------+ + +modbus_controller: + - id: modbus_controller${bms_id} + modbus_id: modbus_client + setup_priority: -10 + address: ${bms_id} + update_interval: ${modbus_update_interval} + command_throttle: ${modbus_command_throttle} + max_cmd_retries: 3 + # offline_skip_updates: 5 + on_online: + then: + - logger.log: "BMS ${bms_id} modbus server back online !" + on_offline: + then: + - logger.log: "BMS ${bms_id} modbus server goes offline !" + - lambda: id(bms${bms_id}_online_status).publish_state(false); + +# +--------------------------------------+ +# | Component entities | +# +--------------------------------------+ + +binary_sensor: + # online_status + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_online_status + name: "${name} ${bms_name} Online Status" + register_type: read + address: 1 + # charging_allowed + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_charging_allowed + name: "${name} ${bms_name} Charging allowed" + register_type: read + address: 2 + # discharging_allowed + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_discharging_allowed + name: "${name} ${bms_name} Discharging allowed" + register_type: read + address: 3 + # equalizing + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_equalizing + name: "${name} ${bms_name} Equalizing state" + register_type: read + address: 4 + +sensor: + # total_voltage + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_total_voltage + name: "${name} ${bms_name} Total Voltage" + register_type: read + address: 5 + value_type: U_DWORD + accuracy_decimals: 2 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # current + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_current + name: "${name} ${bms_name} Current" + register_type: read + address: 7 + value_type: S_DWORD + accuracy_decimals: 2 + unit_of_measurement: A + device_class: current + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # power + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_power + name: "${name} ${bms_name} Power" + register_type: read + address: 9 + value_type: S_DWORD + accuracy_decimals: 2 + unit_of_measurement: W + device_class: power + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # state_of_charge + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_state_of_charge + name: "${name} ${bms_name} SoC" + register_type: read + address: 11 + value_type: U_WORD + accuracy_decimals: 0 + unit_of_measurement: '%' + device_class: battery + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # battery_capacity + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_battery_capacity + name: "${name} ${bms_name} Battery Capacity" + register_type: read + address: 12 + value_type: U_WORD + accuracy_decimals: 0 + unit_of_measurement: Ah + device_class: energy_storage + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # battery_capacity_ah + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_capacity_remaining_ah + name: "${name} ${bms_name} Capacity Remaining" + register_type: read + address: 13 + value_type: U_WORD + accuracy_decimals: 0 + unit_of_measurement: Ah + device_class: energy_storage + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # charging_cycles + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_charging_cycles + name: "${name} ${bms_name} charging cycles" + register_type: read + address: 14 + value_type: U_WORD + accuracy_decimals: 0 + icon: mdi:counter + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # max_charge_current + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_max_charge_current + name: "${name} ${bms_name} Max Charge Current" + register_type: read + address: 15 + value_type: U_WORD + accuracy_decimals: 0 + unit_of_measurement: A + icon: mdi:current-dc + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # max_discharge_current + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_max_discharge_current + name: "${name} ${bms_name} Max Discharge Current" + register_type: read + address: 16 + value_type: U_WORD + accuracy_decimals: 0 + unit_of_measurement: A + icon: mdi:current-dc + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # max_cell_voltage + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_max_cell_voltage + name: "${name} ${bms_name} Max Cell Voltage" + register_type: read + address: 17 + value_type: U_WORD + accuracy_decimals: 3 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.001 + # max_voltage_cell + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_max_voltage_cell + name: "${name} ${bms_name} Max Voltage Cell" + register_type: read + address: 18 + value_type: U_WORD + accuracy_decimals: 0 + icon: mdi:numeric + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # min_cell_voltage + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_min_cell_voltage + name: "${name} ${bms_name} Min Cell Voltage" + register_type: read + address: 19 + value_type: U_WORD + accuracy_decimals: 3 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.001 + # min_voltage_cell + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_min_voltage_cell + name: "${name} ${bms_name} Min Voltage Cell" + register_type: read + address: 20 + value_type: U_WORD + accuracy_decimals: 0 + icon: mdi:numeric + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # min_temperature + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_min_temperature + name: "${name} ${bms_name} Min temperature" + register_type: read + address: 21 + value_type: S_WORD + accuracy_decimals: 1 + unit_of_measurement: °C + device_class: temperature + filters: + - multiply: 0.1 + - or: + - throttle: 10s + - delta: 0.1 + # min_temperature_sensor + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_min_temperature_sensor + name: "${name} ${bms_name} Min temperature sensor" + register_type: read + address: 22 + value_type: U_WORD + accuracy_decimals: 0 + icon: mdi:numeric + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # max_temperature + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_max_temperature + name: "${name} ${bms_name} Max temperature" + register_type: read + address: 23 + value_type: S_WORD + accuracy_decimals: 1 + unit_of_measurement: °C + device_class: temperature + filters: + - multiply: 0.1 + - or: + - throttle: 10s + - delta: 0.1 + # max_temperature_sensor + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_max_temperature_sensor + name: "${name} ${bms_name} Max temperature sensor" + register_type: read + address: 24 + value_type: U_WORD + accuracy_decimals: 0 + icon: mdi:numeric + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # cell_ovp + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_cell_ovp + name: "${name} ${bms_name} Cell OVP" + register_type: read + address: 25 + value_type: U_WORD + accuracy_decimals: 3 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.001 + # cell_uvp + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_cell_uvp + name: "${name} ${bms_name} Cell UVP" + register_type: read + address: 26 + value_type: U_WORD + accuracy_decimals: 3 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.001 + # balance_trigger_voltage + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_balance_trigger_voltage + name: "${name} ${bms_name} Balance Trigger Voltage" + register_type: read + address: 27 + value_type: U_WORD + accuracy_decimals: 3 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.001 + # errors_bitmask (16bits) + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_errors_bitmask + name: "${name} ${bms_name} Errors Bitmask" + register_type: read + address: 28 + value_type: U_WORD + accuracy_decimals: 0 + icon: mdi:alert-circle-outline + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # charging_power + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_charging_power + name: "${name} ${bms_name} Charging Power" + register_type: read + address: 29 + value_type: U_DWORD + accuracy_decimals: 2 + unit_of_measurement: W + device_class: power + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # discharging_power + - platform: modbus_controller + modbus_controller_id: modbus_controller${bms_id} + id: bms${bms_id}_discharging_power + name: "${name} ${bms_name} Discharging Power" + register_type: read + address: 31 + value_type: U_DWORD + accuracy_decimals: 2 + unit_of_measurement: W + device_class: power + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 diff --git a/packages/bms/bms_modbus_FAKE.yaml b/packages/bms/bms_modbus_FAKE.yaml new file mode 100644 index 0000000..8a7f1ee --- /dev/null +++ b/packages/bms/bms_modbus_FAKE.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# 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 . + +substitutions: + bms_model: "Fake BMS" + bms_protocol: "DEMO-Modbus" + +packages: + bms_sensors: !include bms_sensors_FAKE.yaml + bms_combine: !include bms_modbus_server.yaml diff --git a/packages/bms/bms_modbus_JBD_UART_full.yaml b/packages/bms/bms_modbus_JBD_UART_full.yaml new file mode 100644 index 0000000..ff0169b --- /dev/null +++ b/packages/bms/bms_modbus_JBD_UART_full.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/syssi/esphome-jk-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 . + +substitutions: + bms_model: "JBD" + bms_protocol: "UART-Modbus" + +packages: + bms_sensors: !include bms_sensors_JBD_UART_full.yaml + bms_combine: !include bms_modbus_server.yaml diff --git a/packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml b/packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml new file mode 100644 index 0000000..3a44c11 --- /dev/null +++ b/packages/bms/bms_modbus_JK-ALL_BLE_standard.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/syssi/esphome-jk-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 . + +substitutions: + bms_model: "JK" + bms_protocol: "BLE-Modbus" + +packages: + bms_sensors: !include bms_sensors_JK-ALL_BLE_standard.yaml + bms_combine: !include bms_modbus_server.yaml diff --git a/packages/bms/bms_modbus_JK-B_UART_full.yaml b/packages/bms/bms_modbus_JK-B_UART_full.yaml new file mode 100644 index 0000000..c9510f2 --- /dev/null +++ b/packages/bms/bms_modbus_JK-B_UART_full.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/syssi/esphome-jk-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 . + +substitutions: + bms_model: "JK-B" + bms_protocol: "UART-Modbus" + +packages: + bms_sensors: !include bms_sensors_JK-B_UART_full.yaml + bms_combine: !include bms_modbus_server.yaml diff --git a/packages/bms/bms_modbus_server.yaml b/packages/bms/bms_modbus_server.yaml new file mode 100644 index 0000000..12c5584 --- /dev/null +++ b/packages/bms/bms_modbus_server.yaml @@ -0,0 +1,157 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 + +# 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 . + +modbus_controller: + - modbus_id: modbus_server + address: ${bms_id} # max 255 (8bit) + server_registers: + # online_status (1/0) + - address: 1 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_online_status).state); + # charging_allowed (1/0) + - address: 2 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_charging_allowed).state); + # discharging_allowed (1/0) + - address: 3 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_discharging_allowed).state); + # equalizing (1/0) + - address: 4 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_equalizing).state); + # total_voltage (mV) + - address: 5 + value_type: U_DWORD + read_lambda: |- + return uint32_t(id(bms${bms_id}_total_voltage).state * 1000); + # current (mA) [signed] + - address: 7 + value_type: S_DWORD + read_lambda: |- + return int32_t(id(bms${bms_id}_current).state * 1000); + # power (mW) [signed] + - address: 9 + value_type: S_DWORD + read_lambda: |- + return int32_t(id(bms${bms_id}_power).state * 1000); + # soc (%) + - address: 11 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_state_of_charge).state); + # battery_capacity (Ah) + - address: 12 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_battery_capacity).state); + # capacity_remaining_ah (Ah) + - address: 13 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_capacity_remaining_ah).state); + # charging_cycles + - address: 14 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_charging_cycles).state); + # max_charge_current (A) + - address: 15 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_max_charge_current).state); + # max_discharge_current (A) + - address: 16 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_max_discharge_current).state); + # max_cell_voltage (mV) + - address: 17 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_max_cell_voltage).state * 1000); + # max_voltage_cell + - address: 18 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_max_voltage_cell).state); + # min_cell_voltage (mV) + - address: 19 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_min_cell_voltage).state * 1000); + # min_voltage_cell + - address: 20 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_min_voltage_cell).state); + # min_temperature (0.1°C) [signed] + - address: 21 + value_type: S_WORD + read_lambda: |- + return int16_t(id(bms${bms_id}_min_temperature).state * 10); + # min_temperature_sensor + - address: 22 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_min_temperature_sensor).state); + # max_temperature (0.1°C) [signed] + - address: 23 + value_type: S_WORD + read_lambda: |- + return int16_t(id(bms${bms_id}_max_temperature).state * 10); + # max_temperature_sensor + - address: 24 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_max_temperature_sensor).state); + # cell_ovp (mV) + - address: 25 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_cell_ovp).state * 1000); + # cell_uvp (mV) + - address: 26 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_cell_uvp).state * 1000); + # balance_trigger_voltage (mV) + - address: 27 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_balance_trigger_voltage).state * 1000); + # errors_bitmask + - address: 28 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(bms${bms_id}_errors_bitmask).state); + # charging_power (mW) + - address: 29 + value_type: U_DWORD + read_lambda: |- + return uint32_t(id(bms${bms_id}_charging_power).state * 1000); + # discharging_power (mW) + - address: 31 + value_type: U_DWORD + read_lambda: |- + return uint32_t(id(bms${bms_id}_discharging_power).state * 1000); diff --git a/packages/bms/bms_FAKE.yaml b/packages/bms/bms_sensors_FAKE.yaml similarity index 98% rename from packages/bms/bms_FAKE.yaml rename to packages/bms/bms_sensors_FAKE.yaml index 3aa4eb2..e0bd85c 100644 --- a/packages/bms/bms_FAKE.yaml +++ b/packages/bms/bms_sensors_FAKE.yaml @@ -1,4 +1,4 @@ -# Updated : 2024.11.11 +# Updated : 2024.12.23 # Version : 1.1.1 # GitHub : https://github.com/Sleeper85/esphome-yambms @@ -17,12 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -substitutions: - bms_model: "Fake BMS" - bms_protocol: "DEMO" - packages: - bms_combine: !include bms_combine.yaml bms_temperature_sensor: !include bms_temperature_sensor_4.yaml sensor: diff --git a/packages/bms/bms_JBD_UART_full.yaml b/packages/bms/bms_sensors_JBD_UART_full.yaml similarity index 98% rename from packages/bms/bms_JBD_UART_full.yaml rename to packages/bms/bms_sensors_JBD_UART_full.yaml index 8688335..38491fc 100644 --- a/packages/bms/bms_JBD_UART_full.yaml +++ b/packages/bms/bms_sensors_JBD_UART_full.yaml @@ -1,4 +1,4 @@ -# Updated : 2024.11.11 +# Updated : 2024.12.23 # Version : 1.1.1 # GitHub : https://github.com/syssi/esphome-jdb-bms @@ -17,13 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -substitutions: - bms_model: "JBD" - bms_protocol: "UART" - packages: bms_base: !include bms_base.yaml - bms_combine: !include bms_combine.yaml bms_temperature_sensor: !include bms_temperature_sensor_6.yaml # +--------------------------------------+ diff --git a/packages/bms/bms_JK-ALL_BLE_standard.yaml b/packages/bms/bms_sensors_JK-ALL_BLE_standard.yaml similarity index 98% rename from packages/bms/bms_JK-ALL_BLE_standard.yaml rename to packages/bms/bms_sensors_JK-ALL_BLE_standard.yaml index 321a431..4e0ac84 100644 --- a/packages/bms/bms_JK-ALL_BLE_standard.yaml +++ b/packages/bms/bms_sensors_JK-ALL_BLE_standard.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/syssi/esphome-jk-bms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -17,13 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -substitutions: - bms_model: "JK" - bms_protocol: "BLE" - packages: bms_base: !include bms_base.yaml - bms_combine: !include bms_combine.yaml bms_temperature_sensor: !include bms_temperature_sensor_2.yaml ota: @@ -121,6 +116,7 @@ sensor: id: bms${bms_id}_delta_cell_voltage name: "${name} ${bms_name} delta cell voltage" average_cell_voltage: + id: bms${bms_id}_average_cell_voltage name: "${name} ${bms_name} average cell voltage" total_voltage: id: bms${bms_id}_total_voltage diff --git a/packages/bms/bms_JK-B_UART_full.yaml b/packages/bms/bms_sensors_JK-B_UART_full.yaml similarity index 98% rename from packages/bms/bms_JK-B_UART_full.yaml rename to packages/bms/bms_sensors_JK-B_UART_full.yaml index 2c63c85..03fd9d3 100644 --- a/packages/bms/bms_JK-B_UART_full.yaml +++ b/packages/bms/bms_sensors_JK-B_UART_full.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/syssi/esphome-jk-bms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -17,13 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -substitutions: - bms_model: "JK-B" - bms_protocol: "UART" - packages: bms_base: !include bms_base.yaml - bms_combine: !include bms_combine.yaml bms_temperature_sensor: !include bms_temperature_sensor_2.yaml # +--------------------------------------+ diff --git a/packages/board/board_atom-lite.yaml b/packages/board/board_atom-lite.yaml index 63f19a0..0197eba 100644 --- a/packages/board/board_atom-lite.yaml +++ b/packages/board/board_atom-lite.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -49,6 +49,9 @@ wifi: captive_portal: +logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" + uart: # UART 1 - id: uart_esp_1 diff --git a/packages/board/board_atom-matrix.yaml b/packages/board/board_atom-matrix.yaml index cf25209..7e49bd0 100644 --- a/packages/board/board_atom-matrix.yaml +++ b/packages/board/board_atom-matrix.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -49,6 +49,9 @@ wifi: captive_portal: +logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" + uart: # UART 1 - id: uart_esp_1 diff --git a/packages/board/board_atom-s3-lite.yaml b/packages/board/board_atom-s3-lite.yaml index 8933e85..4f92833 100644 --- a/packages/board/board_atom-s3-lite.yaml +++ b/packages/board/board_atom-s3-lite.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -38,7 +38,7 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing on_boot: then: - light.turn_on: @@ -60,6 +60,7 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: USB_SERIAL_JTAG uart: diff --git a/packages/board/board_atom-s3.yaml b/packages/board/board_atom-s3.yaml index 635610b..7f8a168 100644 --- a/packages/board/board_atom-s3.yaml +++ b/packages/board/board_atom-s3.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -39,7 +39,7 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing wifi: id: my_network @@ -53,6 +53,7 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: USB_SERIAL_JTAG uart: diff --git a/packages/board/board_atom-s3r.yaml b/packages/board/board_atom-s3r.yaml index c224fb5..a0dd63d 100644 --- a/packages/board/board_atom-s3r.yaml +++ b/packages/board/board_atom-s3r.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -30,8 +30,8 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) - board_upload.maximum_ram_size: 524288 # Total Size of the internal RAM in bits. It's the same for all ESP32-S3 ( 512KB ) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing + board_upload.maximum_ram_size: 524288 # total size of the internal RAM in bits, it's the same for all ESP32-S3 ( 512KB ) on_boot: then: - output.turn_on: @@ -65,6 +65,7 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: USB_SERIAL_JTAG uart: diff --git a/packages/board/board_display_128x128.yaml b/packages/board/board_display_128x128.yaml index 98f0a6d..42c038a 100644 --- a/packages/board/board_display_128x128.yaml +++ b/packages/board/board_display_128x128.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -80,64 +80,81 @@ display: # Atom S3 display see https://esphome.io/components/display/ili9xxx.html - id: !extend my_display pages: - - id: page1 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue)); - it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar - it.rectangle(0, 100, it.get_width(), it.get_height(), id(my_blue)); // footer bar - it.printf(64, 118, id(roboto_18), id(my_yellow), TextAlign::CENTER, "%s", id(${yambms_id}_charging_status).state.c_str()); - if (id(esp32_online_status).state) { - it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "ESP OK"); - } - else { - it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "ESP KO"); - } - if (id(${canbus_id}_status).state) { + - id: page1 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue)); + it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar + it.rectangle(0, 100, it.get_width(), it.get_height(), id(my_blue)); // footer bar + it.printf(64, 118, id(roboto_18), id(my_yellow), TextAlign::CENTER, "%s", id(${yambms_id}_charging_status).state.c_str()); + // ESP status + if (id(esp32_online_status).state) + { + it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "ESP OK"); + } + else + { + it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "ESP KO"); + } + // CAN status + if (id(${canbus_id}_status).state) + { it.print(0, 5, id(roboto_12), id(my_green), TextAlign::TOP_LEFT, "CAN OK"); - } - else { - it.print(0, 5, id(roboto_12), id(my_red), TextAlign::TOP_LEFT, "CAN KO"); - } - - it.print((128 / 2), (128 / 3) * 1, id(roboto_24), id(my_gray), TextAlign::CENTER,"SoC %"); - it.printf((128 / 2), (128 / 3) * 2 - 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%.1f", id(${yambms_id}_battery_soc).state); - - id: page2 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue)); - it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar - it.rectangle(0, 100, it.get_width(), it.get_height(), id(my_blue)); // footer bar - it.printf(64, 118, id(roboto_18), id(my_yellow), TextAlign::CENTER, "%s", id(${yambms_id}_charging_status).state.c_str()); - if (id(esp32_online_status).state) { - it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "ESP OK"); - } - else { - it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "ESP KO"); - } - if (id(${canbus_id}_status).state) { + } + else + { + it.print(0, 5, id(roboto_12), id(my_red), TextAlign::TOP_LEFT, "CAN KO"); + } + it.print((128 / 2), (128 / 3) * 1, id(roboto_24), id(my_gray), TextAlign::CENTER,"SoC %"); + it.printf((128 / 2), (128 / 3) * 2 - 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%.1f", id(${yambms_id}_battery_soc).state); + - id: page2 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue)); + it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar + it.rectangle(0, 100, it.get_width(), it.get_height(), id(my_blue)); // footer bar + it.printf(64, 118, id(roboto_18), id(my_yellow), TextAlign::CENTER, "%s", id(${yambms_id}_charging_status).state.c_str()); + // ESP status + if (id(esp32_online_status).state) + { + it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "ESP OK"); + } + else + { + it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "ESP KO"); + } + // CAN status + if (id(${canbus_id}_status).state) + { it.print(0, 5, id(roboto_12), id(my_green), TextAlign::TOP_LEFT, "CAN OK"); - } - else { - it.print(0, 5, id(roboto_12), id(my_red), TextAlign::TOP_LEFT, "CAN KO"); - } - it.print((128 / 2), (128 / 3) * 1, id(roboto_24), id(my_gray), TextAlign::CENTER,"Current A"); - it.printf((128 / 2), (128 / 3) * 2 - 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%.1f", id(${yambms_id}_current).state); - - id: page3 - lambda: |- - it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue)); - it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar - it.rectangle(0, 100, it.get_width(), it.get_height(), id(my_blue)); // footer bar - it.printf(64, 118, id(roboto_18), id(my_yellow), TextAlign::CENTER, "%s", id(${yambms_id}_charging_status).state.c_str()); - if (id(esp32_online_status).state) { - it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "ESP OK"); - } - else { - it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "ESP KO"); - } - if (id(${canbus_id}_status).state) { + } + else + { + it.print(0, 5, id(roboto_12), id(my_red), TextAlign::TOP_LEFT, "CAN KO"); + } + it.print((128 / 2), (128 / 3) * 1, id(roboto_24), id(my_gray), TextAlign::CENTER,"Current A"); + it.printf((128 / 2), (128 / 3) * 2 - 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%.1f", id(${yambms_id}_current).state); + - id: page3 + lambda: |- + it.rectangle(0, 0, it.get_width(), it.get_height(), id(my_blue)); + it.rectangle(0, 20, it.get_width(), it.get_height(), id(my_blue)); // header bar + it.rectangle(0, 100, it.get_width(), it.get_height(), id(my_blue)); // footer bar + it.printf(64, 118, id(roboto_18), id(my_yellow), TextAlign::CENTER, "%s", id(${yambms_id}_charging_status).state.c_str()); + // ESP status + if (id(esp32_online_status).state) + { + it.print(115, 5, id(roboto_12), id(my_green), TextAlign::TOP_RIGHT, "ESP OK"); + } + else + { + it.print(115, 5, id(roboto_12), id(my_red), TextAlign::TOP_RIGHT, "ESP KO"); + } + // CAN status + if (id(${canbus_id}_status).state) + { it.print(0, 5, id(roboto_12), id(my_green), TextAlign::TOP_LEFT, "CAN OK"); - } - else { - it.print(0, 5, id(roboto_12), id(my_red), TextAlign::TOP_LEFT, "CAN KO"); - } - it.print((128 / 2), (128 / 3) * 1, id(roboto_24), id(my_gray), TextAlign::CENTER,"Voltage V"); - it.printf((128 / 2), (128 / 3) * 2 - 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%.1f", id(${yambms_id}_total_voltage).state); \ No newline at end of file + } + else + { + it.print(0, 5, id(roboto_12), id(my_red), TextAlign::TOP_LEFT, "CAN KO"); + } + it.print((128 / 2), (128 / 3) * 1, id(roboto_24), id(my_gray), TextAlign::CENTER,"Voltage V"); + it.printf((128 / 2), (128 / 3) * 2 - 5, id(roboto_32), id(my_gray), TextAlign::CENTER, "%.1f", id(${yambms_id}_total_voltage).state); diff --git a/packages/board/board_esp32-c3-devkitm-1.yaml b/packages/board/board_esp32-c3-devkitm-1.yaml index c53ee8e..6ea0ecd 100644 --- a/packages/board/board_esp32-c3-devkitm-1.yaml +++ b/packages/board/board_esp32-c3-devkitm-1.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -29,7 +29,7 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing on_boot: then: - light.turn_on: @@ -51,6 +51,7 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: USB_SERIAL_JTAG uart: diff --git a/packages/board/board_esp32-c3-eth01-evo.yaml b/packages/board/board_esp32-c3-eth01-evo.yaml index 9da8b23..b091b6f 100644 --- a/packages/board/board_esp32-c3-eth01-evo.yaml +++ b/packages/board/board_esp32-c3-eth01-evo.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -32,7 +32,7 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing # external_components: # - source: github://pr#6861 @@ -58,8 +58,8 @@ ethernet: reset_pin: 6 clock_speed: 20MHz -# logger: -# hardware_uart: USB_SERIAL_JTAG +logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" uart: # UART 1 diff --git a/packages/board/board_esp32-devkit-v1.yaml b/packages/board/board_esp32-devkit-v1.yaml index 74b7360..3209528 100644 --- a/packages/board/board_esp32-devkit-v1.yaml +++ b/packages/board/board_esp32-devkit-v1.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -28,7 +28,7 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing wifi: id: my_network @@ -41,6 +41,9 @@ wifi: captive_portal: +logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" + uart: # UART 0 : uart used for ESP32 flashing and logs, can be released if necessary (tx_pin: 1, rx_pin: 3) # UART 1 @@ -55,6 +58,12 @@ uart: rx_pin: 18 baud_rate: 115200 rx_buffer_size: 512 + # UART 3 + # - id: uart_esp_2 + # tx_pin: 26 + # rx_pin: 25 + # baud_rate: 115200 + # rx_buffer_size: 512 canbus: # CANBUS NODE 1 diff --git a/packages/board/board_esp32-devkitc_espBerry_2-CH-CAN.yaml b/packages/board/board_esp32-devkitc_espBerry_2-CH-CAN.yaml new file mode 100644 index 0000000..8bc8c6d --- /dev/null +++ b/packages/board/board_esp32-devkitc_espBerry_2-CH-CAN.yaml @@ -0,0 +1,102 @@ +# Updated : 2024.12.23 +# 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 . + +substitutions: + board_chip: "ESP32" + board_name: "espBerry 2-CH-CAN" + +esp32: + board: esp32dev + framework: + type: esp-idf + +esphome: + platformio_options: + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing + +wifi: + id: my_network + ssid: !secret wifi_ssid + password: !secret wifi_password + domain: !secret domain + ap: + ssid: "YamBMS Fallback Hotspot" + password: "Y4mBM$85" + +captive_portal: + +logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" + +# +--------------------------------------+ +# | 2-CH CAN HAT related configuration | +# +--------------------------------------+ + +# https://www.waveshare.com/wiki/2-CH_CAN_HAT + +# +--------------------------+ +# | | ESP32 PIN | HAT PIN | +# +--------------------------+ +# MOSI | 23 | 19 | +# MISO | 19 | 21 | +# SCLK | 18 | 23 | +# CS_0 | 5 | 24 | +# CS_1 | 17 | 26 | +# +--------------------------+ + +spi: + # BUS SPI 1 + - id: bus_spi1 + mosi_pin: 23 + miso_pin: 19 + clk_pin: 18 + +canbus: + # CANBUS NODE 1 - CAN0 port + - platform: mcp2515 + spi_id: bus_spi1 + id: canbus_node1 + cs_pin: 5 + can_id: 1 + bit_rate: 500kbps + # CANBUS NODE 2 - CAN1 port + - platform: mcp2515 + spi_id: bus_spi1 + id: canbus_node2 + cs_pin: 17 + can_id: 2 + bit_rate: 500kbps + +# +--------------------------------------+ +# | Inverter Heartbeat Light | +# +--------------------------------------+ + +light: + # ESP Light used to see the inverter heartbeat + # Internal : only specifying an id without a name will implicitly set this to true. + - platform: binary + output: esp_led + id: esp_light + +output: + # ESP LED + - platform: gpio + pin: 2 + id: esp_led + inverted: true diff --git a/packages/board/board_esp32-s3-devkitc-1.yaml b/packages/board/board_esp32-s3-devkitc-1.yaml index 131ddb4..54f7437 100644 --- a/packages/board/board_esp32-s3-devkitc-1.yaml +++ b/packages/board/board_esp32-s3-devkitc-1.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -29,8 +29,8 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) - board_upload.maximum_ram_size: 524288 # Total Size of the internal RAM in bits. It's the same for all ESP32-S3 ( 512KB ) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing + board_upload.maximum_ram_size: 524288 # total size of the internal RAM in bits, it's the same for all ESP32-S3 ( 512KB ) on_boot: then: - light.turn_on: @@ -59,6 +59,7 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: USB_SERIAL_JTAG uart: @@ -75,6 +76,12 @@ uart: rx_pin: 16 baud_rate: 115200 rx_buffer_size: 512 + # UART 3 + - id: uart_esp_3 + tx_pin: 13 + rx_pin: 14 + baud_rate: 115200 + rx_buffer_size: 512 canbus: # CANBUS NODE 1 diff --git a/packages/board/board_esp32-s3-devkitc-1_mcp2515.yaml b/packages/board/board_esp32-s3-devkitc-1_mcp2515.yaml index 9239558..3abd05d 100644 --- a/packages/board/board_esp32-s3-devkitc-1_mcp2515.yaml +++ b/packages/board/board_esp32-s3-devkitc-1_mcp2515.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.2.4 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -29,8 +29,8 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) - board_upload.maximum_ram_size: 524288 # Total Size of the internal RAM in bits. It's the same for all ESP32-S3 ( 512KB ) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing + board_upload.maximum_ram_size: 524288 # total size of the internal RAM in bits, it's the same for all ESP32-S3 ( 512KB ) on_boot: then: - light.turn_on: @@ -59,6 +59,7 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: USB_SERIAL_JTAG uart: @@ -75,20 +76,26 @@ uart: rx_pin: 16 baud_rate: 115200 rx_buffer_size: 512 + # UART 3 + - id: uart_esp_3 + tx_pin: 13 + rx_pin: 14 + baud_rate: 115200 + rx_buffer_size: 512 spi: # BUS SPI 1 - id: bus_spi1 - mosi_pin: 11 - miso_pin: 12 - clk_pin: 13 + mosi_pin: 10 + miso_pin: 11 + clk_pin: 12 canbus: # CANBUS NODE 1 - platform: mcp2515 spi_id: bus_spi1 id: canbus_node1 - cs_pin: 21 + cs_pin: 9 can_id: 1 bit_rate: 500kbps diff --git a/packages/board/board_pvbrain2.yaml b/packages/board/board_pvbrain2.yaml index 03b5acc..47708f0 100644 --- a/packages/board/board_pvbrain2.yaml +++ b/packages/board/board_pvbrain2.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.10.03 -# Version : 1.2.3 +# Updated : 2024.12.23 +# Version : 1.2.5 # GitHub : https://github.com/SeByDocKy/pvbrain2 substitutions: @@ -14,8 +14,8 @@ esp32: esphome: platformio_options: - board_build.flash_mode: dio # Standard uses a single line for data, Dual IO uses 2 lines for data (prevent reboot loop) - board_upload.maximum_ram_size: 524288 # Total Size of the internal RAM in bits. It's the same for all ESP32-S3 ( 512KB ) + board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing + board_upload.maximum_ram_size: 524288 # total size of the internal RAM in bits, it's the same for all ESP32-S3 ( 512KB ) # PSRAM activation and settings psram: @@ -36,8 +36,8 @@ wifi: captive_portal: logger: + baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus" hardware_uart: UART0 # UART0 / USB_SERIAL_JTAG - baud_rate: 0 # Prevent boot loop (bug WK2168 with CANBUS), don't use UART logging and release UART0 (tx_pin: 43, rx_pin: 44) light: # https://esphome.io/components/light/status_led diff --git a/packages/config/config_multi-node_modbus.yaml b/packages/config/config_multi-node_modbus.yaml new file mode 100644 index 0000000..047e769 --- /dev/null +++ b/packages/config/config_multi-node_modbus.yaml @@ -0,0 +1,24 @@ +# Updated : 2024.12.23 +# 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 . + +substitutions: + modbus_update_interval: '5s' # frequency with which BMS/Shunt modbus servers are queried + modbus_baud_rate: '19200' # 9600 / 19200 / 11520 + modbus_command_throttle: '0ms' # minimum time in between 2 requests to the device + modbus_send_wait_time: '250ms' # time in milliseconds before the next ModBUS command is sent if an answer from a previous command is pending diff --git a/packages/config/config_yambms.yaml b/packages/config/config_yambms.yaml new file mode 100644 index 0000000..10ecb7f --- /dev/null +++ b/packages/config/config_yambms.yaml @@ -0,0 +1,26 @@ +# Updated : 2024.12.23 +# 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 . + +substitutions: + yambms_id: 'yambms1' + yambms_name: 'YamBMS 1' + shunt_update_interval: '3s' # frequency at which Shunt data is refreshed + shunt_combine_interval: '1s' # frequency at which data is combined in YamBMS + bms_update_interval: '3s' # frequency at which BMS data is refreshed, going below '3s' can cause problems + bms_combine_interval: '1s' # frequency at which data is combined in YamBMS diff --git a/packages/shunt/shunt_combine.yaml b/packages/shunt/shunt_combine.yaml index fc71684..d9f2b61 100644 --- a/packages/shunt/shunt_combine.yaml +++ b/packages/shunt/shunt_combine.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # This YAML is free software: you can redistribute it and/or @@ -34,7 +34,7 @@ binary_sensor: - platform: template name: "${name} ${shunt_name} Combine Availability" id: shunt${shunt_id}_availability - lambda: return (id(shunt${shunt_id}_voltage).state > 0); + lambda: return (id(shunt${shunt_id}_online_status).state); # Can be combined (indicated, if the Shunt can be combined) - platform: template diff --git a/packages/shunt/shunt_fake.yaml b/packages/shunt/shunt_combine_FAKE.yaml similarity index 87% rename from packages/shunt/shunt_fake.yaml rename to packages/shunt/shunt_combine_FAKE.yaml index 7d89f77..119895d 100644 --- a/packages/shunt/shunt_fake.yaml +++ b/packages/shunt/shunt_combine_FAKE.yaml @@ -21,6 +21,18 @@ packages: shunt_base: !include shunt_base.yaml shunt_combine: !include shunt_combine.yaml +binary_sensor: + # Required sensors cannot be retrieved from Shunt + # online_status + - platform: template + id: shunt${shunt_id}_online_status + name: "${name} ${shunt_name} Online Status" + lambda: |- + if (id(shunt${shunt_id}_voltage).state > 0) + return true; + else + return false; + sensor: # total_voltage - platform: template diff --git a/packages/shunt/shunt_combine_Junctek_KHF_UART.yaml b/packages/shunt/shunt_combine_Junctek_KHF_UART.yaml new file mode 100644 index 0000000..edf3925 --- /dev/null +++ b/packages/shunt/shunt_combine_Junctek_KHF_UART.yaml @@ -0,0 +1,22 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Sleeper85/esphome-junctek_khf + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Junctek_KHF_UART.yaml + shunt_combine: !include shunt_combine.yaml diff --git a/packages/shunt/shunt_combine_Victron_SmartShunt_BLE.yaml b/packages/shunt/shunt_combine_Victron_SmartShunt_BLE.yaml new file mode 100644 index 0000000..2f285dc --- /dev/null +++ b/packages/shunt/shunt_combine_Victron_SmartShunt_BLE.yaml @@ -0,0 +1,22 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Fabian-Schmidt/esphome-victron_ble + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Victron_SmartShunt_BLE.yaml + shunt_combine: !include shunt_combine.yaml diff --git a/packages/shunt/shunt_victron_smartshunt_BLE_connect.yaml b/packages/shunt/shunt_combine_Victron_SmartShunt_BLE_connect.yaml similarity index 88% rename from packages/shunt/shunt_victron_smartshunt_BLE_connect.yaml rename to packages/shunt/shunt_combine_Victron_SmartShunt_BLE_connect.yaml index b035a0d..6d09a0c 100644 --- a/packages/shunt/shunt_victron_smartshunt_BLE_connect.yaml +++ b/packages/shunt/shunt_combine_Victron_SmartShunt_BLE_connect.yaml @@ -48,6 +48,18 @@ ble_client: # | Component entities | # +--------------------------------------+ +binary_sensor: + # Required sensors cannot be retrieved from Shunt + # online_status + - platform: template + id: shunt${shunt_id}_online_status + name: "${name} ${shunt_name} Online Status" + lambda: |- + if (id(shunt${shunt_id}_voltage).state > 0) + return true; + else + return false; + sensor: - platform: victron_ble_connect ble_client_id: ble_client${shunt_id} diff --git a/packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml b/packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml new file mode 100644 index 0000000..a07d077 --- /dev/null +++ b/packages/shunt/shunt_combine_Victron_SmartShunt_UART.yaml @@ -0,0 +1,31 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Sleeper85/esphome-junctek_khf + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Victron_SmartShunt_UART.yaml + shunt_combine: !include shunt_combine.yaml + +# +--------------------------------------+ +# | Component settings | +# +--------------------------------------+ + +uart: + - id: !extend ${shunt_uart_id} + baud_rate: 19200 + rx_buffer_size: 256 diff --git a/packages/shunt/shunt_combine_Victron_SmartShunt_UART_expander.yaml b/packages/shunt/shunt_combine_Victron_SmartShunt_UART_expander.yaml new file mode 100644 index 0000000..e450526 --- /dev/null +++ b/packages/shunt/shunt_combine_Victron_SmartShunt_UART_expander.yaml @@ -0,0 +1,22 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Sleeper85/esphome-junctek_khf + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Victron_SmartShunt_UART.yaml + shunt_combine: !include shunt_combine.yaml diff --git a/packages/shunt/shunt_combine_modbus_client.yaml b/packages/shunt/shunt_combine_modbus_client.yaml new file mode 100644 index 0000000..9f11221 --- /dev/null +++ b/packages/shunt/shunt_combine_modbus_client.yaml @@ -0,0 +1,153 @@ +# Updated : 2024.12.23 +# 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 . + +packages: + shunt_combine: !include shunt_combine.yaml + +# +--------------------------------------+ +# | Component settings | +# +--------------------------------------+ + +modbus_controller: + - id: modbus_controller20${shunt_id} + modbus_id: modbus_client + setup_priority: -10 + address: 20${shunt_id} + update_interval: ${modbus_update_interval} + command_throttle: ${modbus_command_throttle} + max_cmd_retries: 3 + # offline_skip_updates: 5 + on_online: + then: + - logger.log: "Shunt ${shunt_id} modbus server back online !" + on_offline: + then: + - logger.log: "Shunt ${shunt_id} modbus server goes offline !" + - lambda: id(shunt${shunt_id}_online_status).publish_state(false); + +# +--------------------------------------+ +# | Component entities | +# +--------------------------------------+ + +binary_sensor: + # online_status + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_online_status + name: "${name} ${shunt_name} Online Status" + register_type: read + address: 1 + +sensor: + # total_voltage + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_voltage + name: "${name} ${shunt_name} Voltage" + register_type: read + address: 2 + value_type: U_DWORD + accuracy_decimals: 2 + unit_of_measurement: V + device_class: voltage + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # current + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_current + name: "${name} ${shunt_name} Current" + register_type: read + address: 4 + value_type: S_DWORD + accuracy_decimals: 2 + unit_of_measurement: A + device_class: current + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # power + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_power + name: "${name} ${shunt_name} Power" + register_type: read + address: 6 + value_type: S_DWORD + accuracy_decimals: 2 + unit_of_measurement: W + device_class: power + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # state_of_charge + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_soc + name: "${name} ${shunt_name} SoC" + register_type: read + address: 8 + value_type: U_WORD + accuracy_decimals: 0 + unit_of_measurement: '%' + device_class: battery + filters: + - multiply: 1 + - or: + - throttle: 10s + - delta: 1 + # charging_power + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_charging_power + name: "${name} ${shunt_name} Charging Power" + register_type: read + address: 9 + value_type: U_DWORD + accuracy_decimals: 2 + unit_of_measurement: W + device_class: power + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 + # discharging_power + - platform: modbus_controller + modbus_controller_id: modbus_controller20${shunt_id} + id: shunt${shunt_id}_discharging_power + name: "${name} ${shunt_name} Discharging Power" + register_type: read + address: 11 + value_type: U_DWORD + accuracy_decimals: 2 + unit_of_measurement: W + device_class: power + filters: + - multiply: 0.001 + - or: + - throttle: 10s + - delta: 0.01 diff --git a/packages/shunt/shunt_modbus_Junctek_KHF_UART.yaml b/packages/shunt/shunt_modbus_Junctek_KHF_UART.yaml new file mode 100644 index 0000000..259f33a --- /dev/null +++ b/packages/shunt/shunt_modbus_Junctek_KHF_UART.yaml @@ -0,0 +1,22 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Sleeper85/esphome-junctek_khf + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Junctek_KHF_UART.yaml + shunt_combine: !include shunt_modbus_server.yaml diff --git a/packages/shunt/shunt_modbus_Victron_SmartShunt_BLE.yaml b/packages/shunt/shunt_modbus_Victron_SmartShunt_BLE.yaml new file mode 100644 index 0000000..a6cbf5e --- /dev/null +++ b/packages/shunt/shunt_modbus_Victron_SmartShunt_BLE.yaml @@ -0,0 +1,22 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Fabian-Schmidt/esphome-victron_ble + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Victron_SmartShunt_BLE.yaml + shunt_combine: !include shunt_modbus_server.yaml diff --git a/packages/shunt/shunt_modbus_Victron_SmartShunt_UART.yaml b/packages/shunt/shunt_modbus_Victron_SmartShunt_UART.yaml new file mode 100644 index 0000000..42fc261 --- /dev/null +++ b/packages/shunt/shunt_modbus_Victron_SmartShunt_UART.yaml @@ -0,0 +1,31 @@ +# Updated : 2024.12.23 +# Version : 1.1.1 +# GitHub : https://github.com/Sleeper85/esphome-junctek_khf + +# 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 . + +packages: + shunt_sensors: !include shunt_sensors_Victron_SmartShunt_UART.yaml + shunt_combine: !include shunt_modbus_server.yaml + +# +--------------------------------------+ +# | Component settings | +# +--------------------------------------+ + +uart: + - id: !extend ${shunt_uart_id} + baud_rate: 19200 + rx_buffer_size: 256 diff --git a/packages/shunt/shunt_modbus_server.yaml b/packages/shunt/shunt_modbus_server.yaml new file mode 100644 index 0000000..7ed67df --- /dev/null +++ b/packages/shunt/shunt_modbus_server.yaml @@ -0,0 +1,58 @@ +# Updated : 2024.12.23 +# 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 . + +modbus_controller: + - modbus_id: modbus_server + address: 20${shunt_id} # max 255 (8bit) + server_registers: + # online_status (1/0) + - address: 1 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(shunt${shunt_id}_online_status).state); + # total_voltage (mV) + - address: 2 + value_type: U_DWORD + read_lambda: |- + return uint32_t(id(shunt${shunt_id}_voltage).state * 1000); + # current (mA) [signed] + - address: 4 + value_type: S_DWORD + read_lambda: |- + return int32_t(id(shunt${shunt_id}_current).state * 1000); + # power (mW) [signed] + - address: 6 + value_type: S_DWORD + read_lambda: |- + return int32_t(id(shunt${shunt_id}_power).state * 1000); + # soc (%) + - address: 8 + value_type: U_WORD + read_lambda: |- + return uint16_t(id(shunt${shunt_id}_soc).state); + # charging_power (mW) + - address: 9 + value_type: U_DWORD + read_lambda: |- + return uint32_t(id(shunt${shunt_id}_battery_charging_power).state * 1000); + # discharging_power (mW) + - address: 11 + value_type: U_DWORD + read_lambda: |- + return uint32_t(id(shunt${shunt_id}_battery_discharging_power).state * 1000); diff --git a/packages/shunt/shunt_junctek_khf_UART.yaml b/packages/shunt/shunt_sensors_Junctek_KHF_UART.yaml similarity index 89% rename from packages/shunt/shunt_junctek_khf_UART.yaml rename to packages/shunt/shunt_sensors_Junctek_KHF_UART.yaml index 985d978..75f9050 100644 --- a/packages/shunt/shunt_junctek_khf_UART.yaml +++ b/packages/shunt/shunt_sensors_Junctek_KHF_UART.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.10.17 -# Version : 1.1.2 +# Updated : 2024.12.23 +# Version : 1.1.3 # GitHub : https://github.com/Sleeper85/esphome-junctek_khf # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -19,7 +19,6 @@ packages: shunt_base: !include shunt_base.yaml - shunt_combine: !include shunt_combine.yaml # +--------------------------------------+ # | Component settings | @@ -38,6 +37,18 @@ external_components: # | Component entities | # +--------------------------------------+ +binary_sensor: + # Required sensors cannot be retrieved from Shunt + # online_status + - platform: template + id: shunt${shunt_id}_online_status + name: "${name} ${shunt_name} Online Status" + lambda: |- + if (id(shunt${shunt_id}_voltage).state > 0) + return true; + else + return false; + # Platform : # junctek_khf : version with the screen connected (UART and RS485) # junctek_khf_rs485 : version without the screen connected (only RS485) diff --git a/packages/shunt/shunt_victron_smartshunt_BLE.yaml b/packages/shunt/shunt_sensors_Victron_SmartShunt_BLE.yaml similarity index 90% rename from packages/shunt/shunt_victron_smartshunt_BLE.yaml rename to packages/shunt/shunt_sensors_Victron_SmartShunt_BLE.yaml index 980e82f..eedc1d9 100644 --- a/packages/shunt/shunt_victron_smartshunt_BLE.yaml +++ b/packages/shunt/shunt_sensors_Victron_SmartShunt_BLE.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.1.1 +# Updated : 2024.12.23 +# Version : 1.1.3 # GitHub : https://github.com/Fabian-Schmidt/esphome-victron_ble # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -19,7 +19,6 @@ packages: shunt_base: !include shunt_base.yaml - shunt_combine: !include shunt_combine.yaml # +--------------------------------------+ # | Component settings | @@ -53,12 +52,32 @@ victron_ble: # TIME_TO_GO in minutes # (*) Available if device aux port is configured. - # The amount of charged and discharged energy is in the field CONSUMED_AH. # The battery SOC is in the field STATE_OF_CHARGE. - # These are all available fields transmitted by the Victron Battery Shunt. I cannot add additional fields. +binary_sensor: + - platform: victron_ble + victron_ble_id: victron_ble${shunt_id} + name: "${name} ${shunt_name} Battery has Alarm" + type: ALARM + # Required sensors cannot be retrieved from Shunt + # online_status + - platform: template + id: shunt${shunt_id}_online_status + name: "${name} ${shunt_name} Online Status" + lambda: |- + if (id(shunt${shunt_id}_voltage).state > 0) + return true; + else + return false; + +text_sensor: + - platform: victron_ble + victron_ble_id: victron_ble${shunt_id} + name: "${name} ${shunt_name} Battery Alarm reason" + type: ALARM_REASON + sensor: - platform: victron_ble victron_ble_id: victron_ble${shunt_id} @@ -92,15 +111,3 @@ sensor: # victron_ble_id: victron_ble${shunt_id} # name: "${name} ${shunt_name} Starter Battery" # BAUX_VOLTAGE or MID_VOLTAGE or TEMPERATURE, depending on configuration of SmartShunt. # type: AUX_VOLTAGE - -binary_sensor: - - platform: victron_ble - victron_ble_id: victron_ble${shunt_id} - name: "${name} ${shunt_name} Battery has Alarm" - type: ALARM - -text_sensor: - - platform: victron_ble - victron_ble_id: victron_ble${shunt_id} - name: "${name} ${shunt_name} Battery Alarm reason" - type: ALARM_REASON diff --git a/packages/shunt/shunt_victron_smartshunt_UART.yaml b/packages/shunt/shunt_sensors_Victron_SmartShunt_UART.yaml similarity index 93% rename from packages/shunt/shunt_victron_smartshunt_UART.yaml rename to packages/shunt/shunt_sensors_Victron_SmartShunt_UART.yaml index 23d8ec0..a32a413 100644 --- a/packages/shunt/shunt_victron_smartshunt_UART.yaml +++ b/packages/shunt/shunt_sensors_Victron_SmartShunt_UART.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.10.17 -# Version : 1.1.2 +# Updated : 2024.12.23 +# Version : 1.1.3 # GitHub : https://github.com/KinDR007/VictronMPPT-ESPHOME # YamBMS ( Yet another multi-BMS Merging Solution ) @@ -19,7 +19,6 @@ packages: shunt_base: !include shunt_base.yaml - shunt_combine: !include shunt_combine.yaml # +--------------------------------------+ # | Component settings | @@ -29,13 +28,6 @@ external_components: - source: github://KinDR007/VictronMPPT-ESPHOME@main refresh: 0s -# UART baud_rate: 19200 -# UART rx_buffer_size: 256 -uart: - - id: !extend ${shunt_uart_id} - baud_rate: 19200 - rx_buffer_size: 256 - victron: - uart_id: ${shunt_uart_id} id: victron${shunt_id} @@ -45,6 +37,22 @@ victron: # | Component entities | # +--------------------------------------+ +binary_sensor: + - platform: victron + victron_id: victron${shunt_id} + relay_state: + name: "${name} ${shunt_name} relay state" + # Required sensors cannot be retrieved from Shunt + # online_status + - platform: template + id: shunt${shunt_id}_online_status + name: "${name} ${shunt_name} Online Status" + lambda: |- + if (id(shunt${shunt_id}_voltage).state > 0) + return true; + else + return false; + sensor: - platform: victron victron_id: victron${shunt_id} @@ -128,9 +136,3 @@ text_sensor: name: "${name} ${shunt_name} serial number" dc_monitor_mode: name: "${name} ${shunt_name} dc monitor mode" - -binary_sensor: - - platform: victron - victron_id: victron${shunt_id} - relay_state: - name: "${name} ${shunt_name} relay state" diff --git a/packages/shunt/shunt_victron_smartshunt_UART_pvbrain2.yaml b/packages/shunt/shunt_victron_smartshunt_UART_pvbrain2.yaml deleted file mode 100644 index 9f3144f..0000000 --- a/packages/shunt/shunt_victron_smartshunt_UART_pvbrain2.yaml +++ /dev/null @@ -1,132 +0,0 @@ -# Updated : 2024.10.17 -# Version : 1.1.2 -# GitHub : https://github.com/KinDR007/VictronMPPT-ESPHOME - -# 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 . - -packages: - shunt_base: !include shunt_base.yaml - shunt_combine: !include shunt_combine.yaml - -# +--------------------------------------+ -# | Component settings | -# +--------------------------------------+ - -external_components: - - source: github://KinDR007/VictronMPPT-ESPHOME@main - refresh: 0s - -# UART baud_rate: 19200 -# UART rx_buffer_size: 256 - -victron: - - uart_id: ${shunt_uart_id} - id: victron${shunt_id} - throttle: ${shunt_update_interval} - -# +--------------------------------------+ -# | Component entities | -# +--------------------------------------+ - -sensor: - - platform: victron - victron_id: victron${shunt_id} - battery_voltage: - id: shunt${shunt_id}_voltage - name: "${name} ${shunt_name} battery voltage" - auxiliary_battery_voltage: - name: "${name} ${shunt_name} auxiliary battery voltage" - midpoint_voltage_of_the_battery_bank: - name: "${name} ${shunt_name} midpoint voltage of the battery bank" - midpoint_deviation_of_the_battery_bank: - name: "${name} ${shunt_name} midpoint deviation of the battery bank" - battery_current: - id: shunt${shunt_id}_current - name: "${name} ${shunt_name} battery current" - battery_temperature: - name: "${name} ${shunt_name} battery temperature" - instantaneous_power: - id: shunt${shunt_id}_power - name: "${name} ${shunt_name} instantaneous power" - consumed_amp_hours: - name: "${name} ${shunt_name} consumed amp hours" - state_of_charge: - id: shunt${shunt_id}_soc - name: "${name} ${shunt_name} state of charge" - time_to_go: - name: "${name} ${shunt_name} time to go" - depth_of_the_deepest_discharge: - name: "${name} ${shunt_name} depth of the deepest discharge" - depth_of_the_last_discharge: - name: "${name} ${shunt_name} depth of the last discharge" - depth_of_the_average_discharge: - name: "${name} ${shunt_name} depth of the average discharge" - number_of_charge_cycles: - name: "${name} ${shunt_name} number of charge cycles" - number_of_full_discharges: - name: "${name} ${shunt_name} number of full discharges" - cumulative_amp_hours_drawn: - name: "${name} ${shunt_name} cumulative amp hours drawn" - min_battery_voltage: - name: "${name} ${shunt_name} min battery voltage" - max_battery_voltage: - name: "${name} ${shunt_name} max battery voltage" - last_full_charge: - name: "${name} ${shunt_name} last full charge" - number_of_automatic_synchronizations: - name: "${name} ${shunt_name} number of automatic synchronizations" - number_of_low_main_voltage_alarms: - name: "${name} ${shunt_name} number of low main voltage alarms" - number_of_high_main_voltage_alarms: - name: "${name} ${shunt_name} number of high main voltage alarms" - number_of_low_auxiliary_voltage_alarms: - name: "${name} ${shunt_name} number of low auxiliary voltage alarms" - number_of_high_auxiliary_voltage_alarms: - name: "${name} ${shunt_name} number of high auxiliary voltage alarms" - min_auxiliary_battery_voltage: - name: "${name} ${shunt_name} min auxiliary battery voltage" - max_auxiliary_battery_voltage: - name: "${name} ${shunt_name} max auxiliary battery voltage" - amount_of_discharged_energy: - name: "${name} ${shunt_name} amount of discharged energy" - amount_of_charged_energy: - name: "${name} ${shunt_name} amount of charged energy" - dc_monitor_mode_id: - name: "${name} ${shunt_name} dc monitor mode id" - -text_sensor: - - platform: victron - victron_id: victron${shunt_id} - alarm_condition_active: - name: "${name} ${shunt_name} alarm condition active" - alarm_reason: - name: "${name} ${shunt_name} alarm reason" - model_description: - name: "${name} ${shunt_name} model description" - firmware_version: - name: "${name} ${shunt_name} firmware version" - device_type: - name: "${name} ${shunt_name} device type" - serial_number: - name: "${name} ${shunt_name} serial number" - dc_monitor_mode: - name: "${name} ${shunt_name} dc monitor mode" - -binary_sensor: - - platform: victron - victron_id: victron${shunt_id} - relay_state: - name: "${name} ${shunt_name} relay state" diff --git a/packages/yambms/yambms.yaml b/packages/yambms/yambms.yaml index 9b90fee..150e90f 100644 --- a/packages/yambms/yambms.yaml +++ b/packages/yambms/yambms.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) diff --git a/packages/yambms/yambms_combine.yaml b/packages/yambms/yambms_combine.yaml index accebad..c81dffb 100644 --- a/packages/yambms/yambms_combine.yaml +++ b/packages/yambms/yambms_combine.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.11.11 -# Version : 1.5.1 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution ) diff --git a/packages/yambms/yambms_service.yaml b/packages/yambms/yambms_service.yaml index 21b9609..989dc4a 100644 --- a/packages/yambms/yambms_service.yaml +++ b/packages/yambms/yambms_service.yaml @@ -1,5 +1,5 @@ -# Updated : 2024.10.03 -# Version : 1.4.5 +# Updated : 2024.12.23 +# Version : 1.5.2 # GitHub : https://github.com/Sleeper85/esphome-yambms # YamBMS ( Yet another multi-BMS Merging Solution )