CANBUS 2.4.1
This commit is contained in:
1 parent
408ebb5116
commit
f79aca0a22
2 files changed
+161
-29
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 223 KiB After Width: | Height: | Size: 239 KiB |
@@ -1,5 +1,5 @@
|
||||
# Updated : 2024.11.11
|
||||
# Version : 2.3.7
|
||||
# Updated : 2024.11.18
|
||||
# Version : 2.4.1
|
||||
# GitHub : https://github.com/Sleeper85/esphome-yambms
|
||||
|
||||
# YamBMS ( Yet another multi-BMS Merging Solution )
|
||||
@@ -51,6 +51,7 @@ select:
|
||||
- "SMA"
|
||||
- "BYD"
|
||||
- "YamBMS"
|
||||
- "Deye"
|
||||
restore_value: true
|
||||
initial_option: "Automatic"
|
||||
optimistic: true
|
||||
@@ -65,12 +66,13 @@ select:
|
||||
options:
|
||||
- "Disabled"
|
||||
- "PYLON 1.2"
|
||||
- "PYLON +"
|
||||
- "PYLON V2"
|
||||
- "SMA"
|
||||
- "Victron"
|
||||
- "LuxPower"
|
||||
# - "Deye PCS (beta)"
|
||||
restore_value: true
|
||||
initial_option: "PYLON +"
|
||||
initial_option: "PYLON V2"
|
||||
optimistic: true
|
||||
entity_category: config
|
||||
set_action:
|
||||
@@ -181,11 +183,11 @@ interval:
|
||||
else index++;
|
||||
id(${canbus_id}_can_frame) = can_frame[index];
|
||||
}
|
||||
// PYLON + CAN frames
|
||||
// PYLON V2 CAN frames
|
||||
else if (id(${canbus_id}_protocol).active_index() == 2)
|
||||
{
|
||||
int can_frame[] = {1, 2, 3, 4, 5, 6, 10, 11, 19};
|
||||
int max_index = 8;
|
||||
int can_frame[] = {1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15, 16, 17, 19};
|
||||
int max_index = 13;
|
||||
if (index >= max_index) index = 0;
|
||||
else index++;
|
||||
id(${canbus_id}_can_frame) = can_frame[index];
|
||||
@@ -208,6 +210,15 @@ interval:
|
||||
else index++;
|
||||
id(${canbus_id}_can_frame) = can_frame[index];
|
||||
}
|
||||
// Deye PCS CAN frames
|
||||
else if (id(${canbus_id}_protocol).active_index() == 6)
|
||||
{
|
||||
int can_frame[] = {1, 2, 3, 4, 6, 24, 25, 26, 27, 28};
|
||||
int max_index = 9;
|
||||
if (index >= max_index) index = 0;
|
||||
else index++;
|
||||
id(${canbus_id}_can_frame) = can_frame[index];
|
||||
}
|
||||
|
||||
id(${canbus_id}_can_frame_index) = index;
|
||||
return true;
|
||||
@@ -225,37 +236,58 @@ interval:
|
||||
data: !lambda |-
|
||||
|
||||
// Automatic BMS name selection
|
||||
if (id(${canbus_id}_bms_name).active_index() == 0){
|
||||
if (id(${canbus_id}_bms_name).active_index() == 0)
|
||||
{
|
||||
if (id(${canbus_id}_protocol).active_index() == 1) id(${canbus_id}_auto_bms_name) = 1; // PYLON
|
||||
else if (id(${canbus_id}_protocol).active_index() == 2) id(${canbus_id}_auto_bms_name) = 1; // PYLON +
|
||||
else if (id(${canbus_id}_protocol).active_index() == 2) id(${canbus_id}_auto_bms_name) = 1; // PYLON V2
|
||||
else if (id(${canbus_id}_protocol).active_index() == 3) id(${canbus_id}_auto_bms_name) = 4; // SMA
|
||||
else if (id(${canbus_id}_protocol).active_index() == 4) id(${canbus_id}_auto_bms_name) = 0; // Victron
|
||||
else if (id(${canbus_id}_protocol).active_index() == 5) id(${canbus_id}_auto_bms_name) = 0; // LuxPower
|
||||
else if (id(${canbus_id}_protocol).active_index() == 6) id(${canbus_id}_auto_bms_name) = 7; // Deye PCS
|
||||
}
|
||||
else id(${canbus_id}_auto_bms_name) = 0; // YamBMS
|
||||
|
||||
// Manual BMS name selection
|
||||
if ((id(${canbus_id}_bms_name).active_index() == 1) | (id(${canbus_id}_auto_bms_name) == 1)){
|
||||
if ((id(${canbus_id}_bms_name).active_index() == 1) | (id(${canbus_id}_auto_bms_name) == 1))
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : PYLON");
|
||||
return {0x50, 0x59, 0x4C, 0x4F, 0x4E, 0x20, 0x20, 0x20}; // PYLON (recognized by Deye, add SOH info)
|
||||
}
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 2) | (id(${canbus_id}_auto_bms_name) == 2)){
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 2) | (id(${canbus_id}_auto_bms_name) == 2))
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : GOODWE");
|
||||
return {0x47, 0x4F, 0x4F, 0x44, 0x57, 0x45, 0x20, 0x20}; // GOODWE
|
||||
}
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 3) | (id(${canbus_id}_auto_bms_name) == 3)){
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 3) | (id(${canbus_id}_auto_bms_name) == 3))
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : SHEnergy");
|
||||
return {0x53, 0x48, 0x45, 0x6E, 0x65, 0x72, 0x67, 0x79}; // SHEnergy (SEPLOS, recognized by Deye)
|
||||
}
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 4) | (id(${canbus_id}_auto_bms_name) == 4)){
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 4) | (id(${canbus_id}_auto_bms_name) == 4))
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : SMA");
|
||||
return {0x53, 0x4D, 0x41, 0x20, 0x20, 0x20, 0x20, 0x20}; // SMA
|
||||
}
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 5) | (id(${canbus_id}_auto_bms_name) == 5)){
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 5) | (id(${canbus_id}_auto_bms_name) == 5))
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : BYD");
|
||||
return {0x42, 0x59, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00}; // BYD (recognized by Deye)
|
||||
}
|
||||
else {
|
||||
//
|
||||
// YamBMS = 6 = DON'T USE !
|
||||
//
|
||||
else if ((id(${canbus_id}_bms_name).active_index() == 7) | (id(${canbus_id}_auto_bms_name) == 7))
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : Deye PCS infos");
|
||||
// Byte [00:01] : BMS name (ASCII) [DY]
|
||||
// Byte [02:03:04] : Battery pack number (ASCII) [001]
|
||||
// Byte [05] : Battery manufacturer [1:GOTION 96Ah, 2:CATL 100Ah, 3:EVE 100Ah, 4:PH 100Ah, 5:EVE 120Ah, 6:PH 100Ah(214R), 7:ZENERGY 104Ah]
|
||||
// Byte [06:07] : System battery nominal capacity (0.1Ah)
|
||||
// Deye BAT SE-G5.1 Pro-B (EVE 100Ah) reply :
|
||||
return {0x44, 0x59, 0x30, 0x30, 0x31, 0x03, 0xE8, 0x03}; // Deye PCS
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI("canbus", "send can_id: 0x35E ASCII : YamBMS"); // Auto BMS name 0
|
||||
return {0x59, 0x61, 0x6D, 0x42, 0x4D, 0x53, 0x00, 0x00}; // YamBMS
|
||||
}
|
||||
@@ -367,7 +399,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x356 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x359 - Protection Alarms, Warning and Flags ( PYLON / PYLON + )
|
||||
- if: # 0x359 - Protection Alarms, Warning and Flags ( PYLON / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 5;
|
||||
then:
|
||||
@@ -429,7 +461,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x359 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x35C - Request flag to Enable/Disable: Charge, Discharge ( PYLON / PYLON + )
|
||||
- if: # 0x35C - Request flag to Enable/Disable: Charge, Discharge ( PYLON / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 6;
|
||||
then:
|
||||
@@ -466,7 +498,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x35C hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x35A - Protection Alarms and Warning ( SMA / Victron )
|
||||
- if: # 0x35A - Protection Alarms and Warning ( SMA / Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 7;
|
||||
then:
|
||||
@@ -524,20 +556,20 @@ interval:
|
||||
data: !lambda |-
|
||||
// SMA Victron
|
||||
// Byte [00:01] : Bat-Type Product ID
|
||||
// Byte [02:03] : BMS Version Firmware version (2.3 => HEX [02:03])
|
||||
// Byte [02:03] : BMS Version Firmware version (2.4 => HEX [02:04])
|
||||
// Byte [04:05] : Bat-Capacity Available Capacity Ah
|
||||
// Byte [06:07] : Manufacturer ID Hardware version
|
||||
|
||||
uint8_t can_mesg[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
can_mesg[2] = 0x02;
|
||||
can_mesg[3] = 0x03;
|
||||
can_mesg[3] = 0x04;
|
||||
can_mesg[4] = uint16_t(id(${yambms_id}_capacity_remaining_ah).state) & 0xff;
|
||||
can_mesg[5] = uint16_t(id(${yambms_id}_capacity_remaining_ah).state) >> 8 & 0xff;
|
||||
|
||||
ESP_LOGI("canbus", "send can_id: 0x35F hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x70 - Actual Max Cell Temp, Min Cell Temp, Max Cell V, Min Cell V ( PYLON + )
|
||||
- if: # 0x70 - Actual Max Cell Temp, Min Cell Temp, Max Cell V, Min Cell V ( SEPLOS V1.0 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 10;
|
||||
then:
|
||||
@@ -568,7 +600,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x70 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x371 - Actual Max Cell Temp ID, Min Cell Temp ID, Max Cell V ID, Min Cell ID ( PYLON + )
|
||||
- if: # 0x371 - Actual Max Cell Temp ID, Min Cell Temp ID, Max Cell V ID, Min Cell ID ( SEPLOS V1.0 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 11;
|
||||
then:
|
||||
@@ -595,7 +627,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x371 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x372 - Battery modules information ( Victron )
|
||||
- if: # 0x372 - Battery modules information ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 12;
|
||||
then:
|
||||
@@ -617,7 +649,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x372 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x373 - Actual Min Cell V, Max Cell V, Min Cell Temp (Kelvin), Max Cell Temp (Kelvin) ( Victron )
|
||||
- if: # 0x373 - Actual Min Cell V, Max Cell V, Min Cell Temp (Kelvin), Max Cell Temp (Kelvin) ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 13;
|
||||
then:
|
||||
@@ -648,7 +680,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x373 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x374 - Min cell voltage ID [ASCII] ( Victron )
|
||||
- if: # 0x374 - Min cell voltage ID [ASCII] ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 14;
|
||||
then:
|
||||
@@ -666,7 +698,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x374 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x375 - Max cell voltage ID [ASCII] ( Victron )
|
||||
- if: # 0x375 - Max cell voltage ID [ASCII] ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 15;
|
||||
then:
|
||||
@@ -684,7 +716,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x375 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x376 - Min cell temperature ID [ASCII] ( Victron )
|
||||
- if: # 0x376 - Min cell temperature ID [ASCII] ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 16;
|
||||
then:
|
||||
@@ -702,7 +734,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x376 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x377 - Max cell temperature ID [ASCII] ( Victron )
|
||||
- if: # 0x377 - Max cell temperature ID [ASCII] ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 17;
|
||||
then:
|
||||
@@ -720,7 +752,7 @@ interval:
|
||||
ESP_LOGI("canbus", "send can_id: 0x377 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x379 - Battery Installed Capacity Ah for Victron, Sol-Ark, Luxpower ( PYLON + / Victron )
|
||||
- if: # 0x379 - Battery Installed Capacity Ah for Victron, Sol-Ark, LuxPower ( Victron / PYLON V2 )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 19;
|
||||
then:
|
||||
@@ -761,3 +793,103 @@ interval:
|
||||
|
||||
ESP_LOGI("canbus", "send can_id: 0x360 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x359 - Protection and System errors ( Deye PCS )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 24;
|
||||
then:
|
||||
- canbus.send:
|
||||
canbus_id: ${canbus_node_id}
|
||||
can_id: 0x359
|
||||
data: !lambda |-
|
||||
ESP_LOGI("canbus", "send can_id: 0x359 : Protection and System errors (not yet implemented)");
|
||||
return {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
- if: # 0x361 - Actual Max Cell Temp, Min Cell Temp, Max Cell V, Min Cell V ( Deye PCS )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 25;
|
||||
then:
|
||||
- canbus.send:
|
||||
canbus_id: ${canbus_node_id}
|
||||
can_id: 0x361
|
||||
data: !lambda |-
|
||||
// Byte [00:01] : Max cell voltage (0.001 V)
|
||||
// Byte [02:03] : Min cell voltage (0.001 V)
|
||||
// Byte [04:05] : Max cell temperature (0.1 °C)
|
||||
// Byte [06:07] : Min cell temperature (0.1 °C)
|
||||
|
||||
int max_cell_voltage_i = id(${yambms_id}_max_cell_voltage).state * 100.0;
|
||||
int min_cell_voltage_i = id(${yambms_id}_min_cell_voltage).state * 100.0;
|
||||
|
||||
uint8_t can_mesg[8];
|
||||
can_mesg[0] = max_cell_voltage_i & 0xff;
|
||||
can_mesg[1] = max_cell_voltage_i >> 8 & 0xff;
|
||||
can_mesg[2] = min_cell_voltage_i & 0xff;
|
||||
can_mesg[3] = min_cell_voltage_i >> 8 & 0xff;
|
||||
// Added 0.1 °C safeguard to max temperature so that max and min values are never equal
|
||||
can_mesg[4] = int16_t(id(${yambms_id}_max_temperature).state * 10 + 1) & 0xff;
|
||||
can_mesg[5] = int16_t(id(${yambms_id}_max_temperature).state * 10 + 1) >> 8 & 0xff;
|
||||
can_mesg[6] = int16_t(id(${yambms_id}_min_temperature).state * 10) & 0xff;
|
||||
can_mesg[7] = int16_t(id(${yambms_id}_min_temperature).state * 10) >> 8 & 0xff;
|
||||
|
||||
ESP_LOGI("canbus", "send can_id: 0x361 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x363 - Software and Hardware version ( Deye PCS )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 26;
|
||||
then:
|
||||
- canbus.send:
|
||||
canbus_id: ${canbus_node_id}
|
||||
can_id: 0x363
|
||||
data: !lambda |-
|
||||
// Byte [00:01] : Software version
|
||||
// Byte [02:03] : Hardware version
|
||||
ESP_LOGI("canbus", "send can_id: 0x363 : Software and Hardware version");
|
||||
// Deye BAT SE-G5.1 Pro-B (EVE 100Ah) reply :
|
||||
return {0x20, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x00}; // Deye PCS
|
||||
|
||||
- if: # 0x364 - Modules count infos ( Deye PCS )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 27;
|
||||
then:
|
||||
- canbus.send:
|
||||
canbus_id: ${canbus_node_id}
|
||||
can_id: 0x364
|
||||
data: !lambda |-
|
||||
// Byte [00] : Number of battery modules in normal operation
|
||||
// Byte [01] : Number of battery modules blocking charge
|
||||
// Byte [02] : Number of battery modules blocking discharge
|
||||
// Byte [03] : Number of battery modules offline
|
||||
// Byte [04] : Number of battery modules total
|
||||
|
||||
uint8_t can_mesg[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
can_mesg[0] = id(${yambms_id}_bms_combined).state;
|
||||
can_mesg[1] = id(${yambms_id}_bms_blocking_charge).state;
|
||||
can_mesg[2] = id(${yambms_id}_bms_blocking_discharge).state;
|
||||
can_mesg[3] = (id(${yambms_id}_bms_count).state - id(${yambms_id}_bms_combined).state);
|
||||
can_mesg[4] = id(${yambms_id}_bms_count).state;
|
||||
|
||||
ESP_LOGI("canbus", "send can_id: 0x364 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
|
||||
- if: # 0x371 - BMS instruction : [ON-GRID] Charge Amps, Discharge Amps ( Deye PCS )
|
||||
condition:
|
||||
lambda: return id(${canbus_id}_can_frame) == 28;
|
||||
then:
|
||||
- canbus.send:
|
||||
canbus_id: ${canbus_node_id}
|
||||
can_id: 0x371
|
||||
data: !lambda |-
|
||||
// 0x351 => OFF-GRID / 0x371 => ON-GRID
|
||||
// Byte [00:01] = CCL : Charge Limit Current (0.1 A)
|
||||
// Byte [02:03] = DCL : Discharge Limit Current (0.1 A)
|
||||
|
||||
uint8_t can_mesg[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
can_mesg[0] = uint16_t(id(${yambms_id}_requested_charge_current).state * 10) & 0xff;
|
||||
can_mesg[1] = uint16_t(id(${yambms_id}_requested_charge_current).state * 10) >> 8 & 0xff;
|
||||
can_mesg[2] = uint16_t(id(${yambms_id}_requested_discharge_current).state * 10) & 0xff;
|
||||
can_mesg[3] = uint16_t(id(${yambms_id}_requested_discharge_current).state * 10) >> 8 & 0xff;
|
||||
|
||||
ESP_LOGI("canbus", "send can_id: 0x371 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]);
|
||||
return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
|
||||
Reference in new issue
Block a user