• Have you tried out dark mode?! Scroll to the bottom of any page to find a sun or moon icon to turn dark mode on or off!

diy solar

diy solar

YamBMS JK-BMS-CAN with new Cut-Off Charging Logic (open-source)

Bonjour Sleeper85

J'étais en train de recompiler avec les sources distante quand tu as mis a jour Yambms pour la mise a jour 2025.05
J'ai passé toute l'après-midi a m'arracher les cheveux :fp

A la base je voulais faire fonctionner Yambms avec MQTT 4xJKBMS un DEYE et un Shunt Victron via UART mais je n'y arrive pas pour le moment. Je reviendrais avec ma question là-dessus ultérieurement.

Suite aux modif de ce jour j'ai un peu galérer pour avoir un résultat concluant pour ne pas refaire les Dashboard

Voici ce que j'ai utilisé :
name: ' '
hostname: yambms
friendly_name: MybmsDeye8KLP1
yambms_id: 'yambms1'
yambms_name: 'YamBMS 1'

J'ai seulement 8 entités qui ont changé de nom
C'est juste la dernière lettre a retirer, je sais pas si c'est a cause de tous mes essais ou si c'est une nouvelle politique de nommage d'entités.

Exemple :
sensor.yambms_yambms_1_battery_capacity_s
Changé pour :
sensor.yambms_yambms_1_battery_capacity

Ce sont des entités avec un symbole grec par exemple a la fin. Caractère Zeta (Somme)
 
The latest HA update changes the entity naming logic. The dashboard no longer works.

When importing an ESP32, the name 'yambms' is added before the entities, which means a double yambms.

Special characters are no longer added.

I had to delete my ESP32s from HA and then add them again.


How to prevent it ?
I understand that you can manually change the code to not use the ${friendly_name} variable in entity names before recompiling and updating HA. In this way I have corrected the code https://github.com/slipx06/Sunsynk-Home-Assistant-Dash and it seems prevent the problem. But I haven't done the HA update yet :)

I don't see the use of this variable anywhere in the YamBMS configuration file. Where to look for it ?
 
Last edited:
A quick summary regarding the naming of esphome entities since HA 2025.05.

Before this HA 2025.05 update, all my YAML files automatically add the value of the var name in front of the entity names, and I didn't use the friendly_name.

Here's what I've noticed since HA 2025.05:

If the friendly_name isn't defined, then the name will be added as a prefix to all entities, otherwise, it will be the friendly_name.
In any case, since all YamBMS entity names were already prefixed with the name, this is a duplicate.

To avoid modifying all the YAML, here's what I did yesterday:

1) The name variable can still be used to add a second prefix. (this variable is empty by default to avoid adding a double prefix)
2) I added a hostname variable that corresponds to the ESP32 name.
3) I added a friendly_name variable to prefix the entities with the desired name.

The modified code:

1747045889997.png

What you need to add to your main.yaml file to keep the same naming logic as before (the dashboard will continue to function as before) :

YAML:
# +--------------------------------------+
# | Global Settings                      |
# +--------------------------------------+
substitutions:
  # Name
  name: '' # Name that can be added as a second prefix after the friendly name, you can leave it blank.
  hostname: 'yambms' # This is the name of the node. It should always be unique in your ESPHome network.
  friendly_name : 'YamBMS' # Prefix added in front of all entity names and also to classify them.
  # +--------------------------------------+
  # | YamBMS Settings                      |
  # +--------------------------------------+

This allows you to sort your entities and I think it is the best solution at present.

1747046167708.png
 
Last edited:
Bonjour Sleeper85

J'étais en train de recompiler avec les sources distante quand tu as mis a jour Yambms pour la mise a jour 2025.05
J'ai passé toute l'après-midi a m'arracher les cheveux :fp

A la base je voulais faire fonctionner Yambms avec MQTT 4xJKBMS un DEYE et un Shunt Victron via UART mais je n'y arrive pas pour le moment. Je reviendrais avec ma question là-dessus ultérieurement.

Suite aux modif de ce jour j'ai un peu galérer pour avoir un résultat concluant pour ne pas refaire les Dashboard

Voici ce que j'ai utilisé :


J'ai seulement 8 entités qui ont changé de nom
C'est juste la dernière lettre a retirer, je sais pas si c'est a cause de tous mes essais ou si c'est une nouvelle politique de nommage d'entités.

Exemple :

Changé pour :


Ce sont des entités avec un symbole grec par exemple a la fin. Caractère Zeta (Somme)

Désolé j'ai effectivement corrigé ce problème hier mais pas encore adapté les fichiers d'exemple car je n'ai pas mon PC habituel avec moi.

Du coup tu as bien trouvé tout seul.

Comme dit plus haut la partie subsitution commence comme ceci à présent :

Toutes les entités seront préfixée et triée sur base du friendly_name, les dashboard proposés utilisent le prédixe yambms ce qui peut être changé avec un replace .yambms par la valeur souhaitée.

YAML:
# +--------------------------------------+
# | Global Settings                      |
# +--------------------------------------+
substitutions:
  # Name
  name: '' # Name that can be added as a second prefix after the friendly name, you can leave it blank.
  hostname: 'yambms' # This is the name of the node. It should always be unique in your ESPHome network.
  friendly_name : 'YamBMS' # Prefix added in front of all entity names and also to classify them.
  # +--------------------------------------+
  # | YamBMS Settings                      |
  # +--------------------------------------+
 
J'ai seulement 8 entités qui ont changé de nom
C'est juste la dernière lettre a retirer, je sais pas si c'est a cause de tous mes essais ou si c'est une nouvelle politique de nommage d'entités.

Yes, indeed, special characters are automatically removed from entity names, so I need to slightly correct the dashboards.
This is also due to this HA update.

This is a problem for the 6 entities below :
  1. sensor.yambms_yambms_yambms_1_total_voltage_o => sensor.yambms_yambms_yambms_1_total_voltage
  2. sensor.yambms_yambms_yambms_1_current_s => sensor.yambms_yambms_yambms_1_current
  3. sensor.yambms_yambms_yambms_1_power_s => sensor.yambms_yambms_yambms_1_power
  4. sensor.yambms_yambms_yambms_1_installed_battery_capacity_s => sensor.yambms_yambms_yambms_1_installed_battery_capacity
  5. sensor.yambms_yambms_yambms_1_battery_capacity_s => sensor.yambms_yambms_yambms_1_battery_capacity
  6. sensor.yambms_yambms_yambms_1_capacity_remaining_s => sensor.yambms_yambms_yambms_1_capacity_remaining
 
The example YAMLs and dashboards have been updated following the changes introduced by the HA 2025.05 update regarding esphome entities names.

The new dashboard will no longer work correctly with older versions of HA (6 entities are problematic).

Compiling the current code with an older version of HA should not pose any problems.
 
Bonjour Sleeper85

J'ai la config suivante :
  • Onduleur DEYE 8K LP1
  • 4x JK-PB BMS en RS485
  • 1x Smarshunt Victron en UART
  • Des ESP32-S3 Atomic CAN/Atomic RS485/ISO485
J'arrive faire fonctionner tout ca avec un ESP32-S3 sur un M5Stack Atomic CAN et un module ISO485 sous HomeAssistant

J'aimerais utiliser MQTT a la place.
La compilation fonctionne, par contre au niveau de l'ESP ca ne va pas, dès que j'en met plus que 2 l'ESP est KO.

J'ai vue que ton projet pouvais utiliser plusieurs ESP32 avec une liaison Modbus entre les ESP.
Est-il envisageable de faire une config Master/Slave avec ce type de BMS, par exemple en mettant 2 Sniffer ? (1 Sniffer / ESP avec 2 JK-PB BMS / ESP) afin d'alléger.

Ou aurrais-tu une autre piste / Idée?
  • Utiliser une liaison RS485 / BMS sans le Sniffer ?
PS : Je souhaite utilise le package full du bms "bms_combine_JK_RS485_Modbus_bms_full" , sinon c'est pas marrant :p

I have the following configuration:
  • DEYE 8K LP1 inverter
  • 4x JK-PB BMS in RS485
  • 1x Smarshunt Victron in UART
  • ESP32-S3 Atomic CAN/Atomic RS485/ISO485
I can make all this work with an ESP32-S3 on an M5Stack Atomic CAN and an ISO485 module under HomeAssistant.

I would like to use MQTT instead.

The compilation works, but the ESP does not, as soon as I put more than 2 the ESP is KO.


I saw that your project could use several ESP32s with a Modbus link between the ESPs.

Is it possible to do a Master/Slave configuration with this type of BMS, for example by using 2 Sniffers (1 Sniffer / ESP with 2 JK-PB BMS / ESP) in order to lighten the load?

Or do you have another idea?
 
Last edited:
Bonjour Sleeper85

J'ai la config suivante :
  • Onduleur DEYE 8K LP1
  • 4x JK-PB BMS en RS485
  • 1x Smarshunt Victron en UART
  • Des ESP32-S3 Atomic CAN/Atomic RS485/ISO485
J'arrive faire fonctionner tout ca avec un ESP32-S3 sur un M5Stack Atomic CAN et un module ISO485 sous HomeAssistant

J'aimerais utiliser MQTT a la place.
La compilation fonctionne, par contre au niveau de l'ESP ca ne va pas, dès que j'en met plus que 2 l'ESP est KO.

J'ai vue que ton projet pouvais utiliser plusieurs ESP32 avec une liaison Modbus entre les ESP.
Est-il envisageable de faire une config Master/Slave avec ce type de BMS, par exemple en mettant 2 Sniffer ? (1 Sniffer / ESP avec 2 JK-PB BMS / ESP) afin d'alléger.

Ou aurrais-tu une autre piste / Idée?
  • Utiliser une liaison RS485 / BMS sans le Sniffer ?
PS : Je souhaite utilise le package full du bms "bms_combine_JK_RS485_Modbus_bms_full" , sinon c'est pas marrant :p

I have the following configuration:
  • DEYE 8K LP1 inverter
  • 4x JK-PB BMS in RS485
  • 1x Smarshunt Victron in UART
  • ESP32-S3 Atomic CAN/Atomic RS485/ISO485
I can make all this work with an ESP32-S3 on an M5Stack Atomic CAN and an ISO485 module under HomeAssistant.

I would like to use MQTT instead.

The compilation works, but the ESP does not, as soon as I put more than 2 the ESP is KO.


I saw that your project could use several ESP32s with a Modbus link between the ESPs.

Is it possible to do a Master/Slave configuration with this type of BMS, for example by using 2 Sniffers (1 Sniffer / ESP with 2 JK-PB BMS / ESP) in order to lighten the load?

Or do you have another idea?

Quand tu dit ESP32-S3 tu parles de Atom S3 ?

PSRAM désactivée?

MQTT serait plus lourd que api du coup ?

Tu peux me contacter en privé et on pourrait s'appeler ça sera peut être plus simple.
 
Quand tu dit ESP32-S3 tu parles de Atom S3 ?

PSRAM désactivée?

MQTT serait plus lourd que api du coup ?

Tu peux me contacter en privé et on pourrait s'appeler ça sera peut être plus simple.
Oui c'est bien un Atom S3
Pour la PSRAM : Je n'ai rien touché , j'utilise les packages distant. Je ne sais pas comment on peut la désactiver. :fp

J'ai pris ma config fonctionnelle sous HA, j'ai commenté les 2 lignes :
api:
reboot_timeout: 0s
Puis j'ai décommenté la partie mqtt

Je te contact en mp tout a l'heure. il faut que j'aille chercher les bambins a l'école.
 
Hi, people :) @Sleeper85, will there be support in the future for the Pylon RS485 protocol between the inverter and the ESP except for the canbus protocol? There are many inverters (PIP, MPP Solar, Sila, most likely there are more) that claim to have a canbus, but in fact only the RS485 protocol works.
 
Hi, people :) @Sleeper85, will there be support in the future for the Pylon RS485 protocol between the inverter and the ESP except for the canbus protocol? There are many inverters (PIP, MPP Solar, Sila, most likely there are more) that claim to have a canbus, but in fact only the RS485 protocol works.

I'm aware of this situation, but I don't currently have the time to develop this PYLON RS485 protocol.

If you know anyone who can do so, you can easily collaborate with me via a PR on GitHub.

Here is the PYLON RS485 protocol document.
 
Hello

Here is the requested information
- JK-BMS version
- device address
I did not use the JK RS485 adapter. The BMS is directly connected to the board with a JST 1.25 4-pin cable on the GPS port.

So here is how UART works in my case:

JK_BD6A20S10P, HW: V11.XW, FW: V11.42
YamBMS still on 1.5.4

GND, TX on PIN 11, RX on pin 13

1747314912687.png

1747314066616.png1747314093047.png

1747314162119.png1747314214727.png1747314713951.png
 
I'm aware of this situation, but I don't currently have the time to develop this PYLON RS485 protocol.

If you know anyone who can do so, you can easily collaborate with me via a PR on GitHub.

Here is the PYLON RS485 protocol document.
I’m gonna give it a whack, but it’ll be vibe coded garbage mostly. I think I’ll aim for the pace protocol though as it supports straight modbus which would be easier to get going with esphome. If I get a working yaml together with the mappings, would you be able to look it over and help set it to be compliant with the codebase formatting?
 
I’m gonna give it a whack, but it’ll be vibe coded garbage mostly. I think I’ll aim for the pace protocol though as it supports straight modbus which would be easier to get going with esphome. If I get a working yaml together with the mappings, would you be able to look it over and help set it to be compliant with the codebase formatting?

Yes of course 😉

There is also a possibility to use the WECO and Soltaro CAN bus protocols. I have some information on these protocols but not this type of inverter to develop and test.
 
Yes of course 😉

There is also a possibility to use the WECO and Soltaro CAN bus protocols. I have some information on these protocols but not this type of inverter to develop and test.
for anyone else in the future, i think for SRNE and other rs485 protcols its kinda a dead end as from my testing as most the polling i saw only allowed for SOC communcating to the BMS. so all the dynamic charge logic in yambus goes to waste, but the aggregating does still have value though.

for anyone who wants to dig further into it, heres my code MODBUS server code for PACE (which SRNE and other budget inverters support over rs485 if they dont have CAN BUS for the project). I'm going to probably to go my own path of using my current SRNE modbus connection for device control to adjust the charging registers dynamically based on SOC using yambus logic, but thats beyond the scope of this library.

# Pace BMS yaml

uart:
- id: uart_modbus
tx_pin: 18
rx_pin: 17
baud_rate: 9600
parity: NONE
stop_bits: 1

modbus:
- id: modbus_slave
uart_id: uart_modbus
role: server

modbus_controller:
- id: pace_bms
modbus_id: modbus_slave
address: 1 # Needs logic/location to put in rs485 address for yambus yaml implementation

server_registers:
# 40001 → offset 0
- address: 0
value_type: S_WORD
read_lambda: |-
return int(id(${yambms_id}_current).state * 100);

# 40002 → offset 1
- address: 1
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_total_voltage).state * 100);

# 40003 → offset 2
- address: 2
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_state_of_charge).state);

# 40004 → offset 3
- address: 3
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_battery_soh).state);

# 40005 → offset 4
- address: 4
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_capacity_remaining_ah).state * 100);

# 40006 → offset 5
- address: 5
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_battery_capacity).state * 100);

# 40007 → offset 6
- address: 6
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_installed_battery_capacity).state * 100);

# 40008 → offset 7
- address: 7
value_type: U_WORD
read_lambda: |-
return int(id(${yambms_id}_charging_cycles).state);

# 40009 → offset 8 (reserved)
- address: 8
value_type: U_WORD
read_lambda: |-
return 0;

# 40010 → offset 9 (Warning Bitmask Mapping)
- address: 9
value_type: U_WORD
read_lambda: |-
uint16_t mask = static_cast<uint16_t>(id(yambms_errors_bitmask_warning).state);
uint16_t warning = 0;
if (mask & 0x0002) warning |= 1 << 0; // cell overvoltage
if (mask & 0x0004) warning |= 1 << 1; // cell undervoltage
if (mask & 0x0002) warning |= 1 << 2; // pack overvoltage
if (mask & 0x0004) warning |= 1 << 3; // pack undervoltage
if (mask & 0x0100) warning |= 1 << 4; // charging overcurrent
if (mask & 0x0080) warning |= 1 << 5; // discharging overcurrent
if (mask & 0x0020) warning |= 1 << 8; // charging high temp
if (mask & 0x0008) warning |= 1 << 9; // discharging high temp
if (mask & 0x0040) warning |= 1 << 10; // charging low temp
if (mask & 0x0010) warning |= 1 << 11; // discharging low temp
if (mask & 0x0800) warning |= 1 << 14; // MOSFET high temp
if (id(yambms_battery_soc).state <= 10) warning |= 1 << 15;
return warning;

# 40011 → offset 10 (Protection Bitmask Mapping)
- address: 10
value_type: U_WORD
read_lambda: |-
uint16_t mask = static_cast<uint16_t>(id(yambms_errors_bitmask_alarm).state);
uint16_t protection = 0;
if (mask & 0x0002) protection |= 1 << 0; // cell OV protection
if (mask & 0x0004) protection |= 1 << 1; // cell UV protection
if (mask & 0x0100) protection |= 1 << 2; // charge OC protection
if (mask & 0x0080) protection |= 1 << 3; // discharge OC protection
if (mask & 0x0400) protection |= 1 << 4; // short circuit protection
if (mask & 0x0010) protection |= 1 << 5; // charge low temp protection
if (mask & 0x0020) protection |= 1 << 6; // charge high temp protection
if (mask & 0x0040) protection |= 1 << 7; // discharge low temp protection
if (mask & 0x0008) protection |= 1 << 8; // discharge high temp protection
return protection;

# 40012 → offset 11 (Status Flag Mapping)
- address: 11
value_type: U_WORD
read_lambda: |-
uint16_t flag = 0;
// Faults
// BIT0: charging MOSFET fault (no direct sensor)
// BIT1: discharging MOSFET fault (no direct sensor)
// BIT2: temperature sensor fault (no direct sensor)
// BIT3: reserve
// BIT4: battery cell fault (map to cell imbalance/alarm)
if (id(${yambms_id}_alarm).state == "UBC") flag |= 1 << 4;
// BIT5: comm fault (no direct sensor)
// Status
// BIT8: state of charge (charging or charged)
if (id(${yambms_id}_current).state > 0.5) flag |= 1 << 8;
// BIT9: state of discharge
if (id(${yambms_id}_current).state < -0.5) flag |= 1 << 9;
// BIT10: charging MOSFET ON (charging)
if (id(${yambms_id}_current).state > 0.5) flag |= 1 << 10;
// BIT11: discharging MOSFET ON (discharging)
if (id(${yambms_id}_current).state < -0.5) flag |= 1 << 11;
// BIT12: charging limiter (no direct sensor)
// BIT14: charger inversed (no direct sensor)
// BIT15: heater ON (no direct sensor)
return flag;
 
Hi,
I have a problem with Lilygo T-can. Due to the update of HA. I wanted to flash my Lilygo T-can with the new version of yambms to get full access again. I compiled it several times. I tried local packages as well as remote packages. But after flashing it does not connect to HA. It even dont get recognized by HA.
I used the "YamBMS_RP_JK-PB_RS485_Modbus.yaml" just uncommented the Lilygo t-can board and left everything else untouched. Do I need to change something else?
The same with local packages yaml. Some idea whats wrong?
 
Hi,
I have a problem with Lilygo T-can. Due to the update of HA. I wanted to flash my Lilygo T-can with the new version of yambms to get full access again. I compiled it several times. I tried local packages as well as remote packages. But after flashing it does not connect to HA. It even dont get recognized by HA.
I used the "YamBMS_RP_JK-PB_RS485_Modbus.yaml" just uncommented the Lilygo t-can board and left everything else untouched. Do I need to change something else?
The same with local packages yaml. Some idea whats wrong?

Did you add the new variables following the HA 2025.05 update?

YAML:
# +--------------------------------------+
# | Global Settings                      |
# +--------------------------------------+
substitutions:
  # Name
  name: '' # Name that can be added as a second prefix after the friendly name, you can leave it blank.
  hostname: 'yambms' # This is the name of the node. It should always be unique in your ESPHome network.
  friendly_name : 'YamBMS' # Prefix added in front of all entity names and also to classify them.
  # +--------------------------------------+
  # | YamBMS Settings                      |
  # +--------------------------------------+
 
Did you add the new variables following the HA 2025.05 update?

YAML:
# +--------------------------------------+
# | Global Settings                      |
# +--------------------------------------+
substitutions:
  # Name
  name: '' # Name that can be added as a second prefix after the friendly name, you can leave it blank.
  hostname: 'yambms' # This is the name of the node. It should always be unique in your ESPHome network.
  friendly_name : 'YamBMS' # Prefix added in front of all entity names and also to classify them.
  # +--------------------------------------+
  # | YamBMS Settings                      |
  # +--------------------------------------+
yeah, as I said I`ve used this yaml.
YamBMS_RP_JK-PB_RS485_Modbus.yaml V1.5.5
I`ve just uncommeted the Lillygo T-Can board. Everything else I left untouched. The light of the rgb LED is just constant red.
I also tried to compile a file for ESP32-S3_DevKitC-1 and flashed it. This board did connect to HA without problems but for that board I dont have the hardware for CAN and RS 485.

 
yeah, as I said I`ve used this yaml.
YamBMS_RP_JK-PB_RS485_Modbus.yaml V1.5.5
I`ve just uncommeted the Lillygo T-Can board. Everything else I left untouched. The light of the rgb LED is just constant red.
I also tried to compile a file for ESP32-S3_DevKitC-1 and flashed it. This board did connect to HA without problems but for that board I dont have the hardware for CAN and RS 485.



Can you ping the IP address of your ESP32 ?
 
Last edited:

diy solar

diy solar
Back
Top