Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JK-PB bms compatibility. Target: 1 ESP in a "listening mode" connected to RS485 network. #464

Open
wants to merge 194 commits into
base: main
Choose a base branch
from

Conversation

txubelaxu
Copy link

JK-PB2A16S-20P model jk-bms.
Two bms connected to that RS485 internal network.
ubuntu connected in a "listening mode" using a USB<->RS485 adaptor.

JK-PB2A16S-20P model jk-bms.
Two bms connected to that RS485 internal network.
ubuntu connected in a "listening mode" using a USB<->RS485 adaptor.
Copy link
Author

@txubelaxu txubelaxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have installed clang-format (v14 now)

@txubelaxu txubelaxu changed the title script to sniffing traffic from the RS485 network Add JK-PB bms compatibility. Target: 1 ESP in a "listening mode" connected to RS485 network. Mar 3, 2024
@txubelaxu txubelaxu closed this Mar 3, 2024
@txubelaxu txubelaxu reopened this Mar 3, 2024
@txubelaxu
Copy link
Author

txubelaxu commented Mar 3, 2024

I have created a new component: "jk_rs485". It is for JK-PB HW v14.
This is a sniffing way to gather information across the RS485 network.
The goal to achieve is to gathering information about every jk-bms using only one ESP. This way, Bluetooth remains free.

To compile:
esphome compile esp32-example-rs485.yaml

Pending:

  • testing
  • configure yaml with multiple BMSs. Each one: 1 address [0x00,0x0f]. So, address paramether to insert inside yaml config is pending.

Copy link
Author

@txubelaxu txubelaxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I have changed erroneusly components/jk_bms_ble/jk_bms_ble.cpp file.
I do know how to solve this error.
Other changes are new files.

Copy link
Author

@txubelaxu txubelaxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something wrong here?
It is marked as failed.

@syssi
Copy link
Owner

syssi commented Mar 4, 2024

I will have a look as soon as possible. Please give me some time! :-)

@txubelaxu
Copy link
Author

Sorry!! I am very newbie at github.
👏👏😉

@syssi
Copy link
Owner

syssi commented Mar 5, 2024

No problem. Feel free to ask any questions.

@txubelaxu
Copy link
Author

No problem. Feel free to ask any questions.

Many thanks, Sebastian. Certainly, I do not know how to manage/arrange the "code + configuration.yaml" to demultiplex the info arraiving from RS485. So, I have got the info about every BMS connected to the RS485 network (it does not matter how many are: max 16). I know how to pass the UART information to the jk_rs485 component (but only one). But I have achieve the goal of sharing the same UART with two jk_rs485 components. I would like to:

  1. remake the configuration.yaml structure in order to place inside that file each jk_rs485 node: each one with a identifyer and an address.
  2. "publish_state" info and settings, but signaling the identifyer (not address) of the jk_rs485 node.

I do not know if this is possible.

Many thanks!!

@brycelarge
Copy link

any chance you could put a wiring diagram together so I can test with my 3 new JK BMS?

@txubelaxu
Copy link
Author

any chance you could put a wiring diagram together so I can test with my 3 new JK BMS?

#463 (comment)

@brycelarge
Copy link

any chance you could put a wiring diagram together so I can test with my 3 new JK BMS?

#463 (comment)

Which Ethernet wires go to tx and rx on the ESP board?

@txubelaxu
Copy link
Author

any chance you could put a wiring diagram together so I can test with my 3 new JK BMS?

#463 (comment)

Which Ethernet wires go to tx and rx on the ESP board?

image

@txubelaxu
Copy link
Author

it is not ethernet. It is RS485, ok?
You need a USB to RS485 adaptor.

@brycelarge
Copy link

it is not ethernet. It is RS485, ok? You need a USB to RS485 adaptor.

USB plugs into the ESP32 dev board and RJ45 into the RS485 port in the inverter?

@txubelaxu
Copy link
Author

txubelaxu commented Mar 10, 2024 via email

@denveronly
Copy link

denveronly commented Mar 10, 2024

Can you point to a code that should be loaded to ESPHome please?
Is it working already? Master and Slave Sniff? I have 1 Master and 6 Slaves right now lol.

@vlxxdev
Copy link

vlxxdev commented Aug 8, 2024

@txubelaxu Hi! I'm trying to understand your project and if I understood correctly, you connect the inverter to the battery via rs485 via CAN bus and simultaneously receive data from the inverter also via rs485 or is it not quite like that?

@brycelarge
Copy link

Since the last changes I cannot update:

Compiling .pioenvs/jkbms/src/esphome/components/jk_rs485_bms/jk_rs485_bms.o
In file included from src/esphome/components/jk_rs485_bms/jk_rs485_bms.cpp:1:
src/esphome/components/jk_rs485_bms/jk_rs485_bms.h:3:10: fatal error: switch/jk_switch.h: No such file or directory
#include "switch/jk_switch.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pioenvs/jkbms/src/esphome/components/logger/logger_esp32.o
*** [.pioenvs/jkbms/src/esphome/components/jk_rs485_bms/jk_rs485_bms.o] Error 1
========================== [FAILED] Took 2.63 seconds ==========================

Please also update your 1 master multiple slave examples, seems those are not working anymore either

@syssi
Copy link
Owner

syssi commented Aug 22, 2024

@brycelarge Did you try a clean build? esphome clean yourconfig.yaml; esphome run yourconfig.yaml or press the CLEAN build files button at the ESPHome dashboard.

@brycelarge
Copy link

@brycelarge Did you try a clean build? esphome clean yourconfig.yaml; esphome run yourconfig.yaml or press the CLEAN build files button at the ESPHome dashboard.

Yes I did but still get that issue.

INFO ESPHome 2024.8.0
INFO Reading configuration /config/esphome/jkbms.yaml...
INFO Updating https://github.com/txubelaxu/esphome-jk-bms.git@main
INFO Deleting /data/build/jkbms/.pioenvs
INFO Deleting /data/build/jkbms/.piolibdeps
INFO Done!

Compiling .pioenvs/jkbms/src/esphome/components/esp32/gpio.o
Compiling .pioenvs/jkbms/src/esphome/components/esp32/preferences.o
Compiling .pioenvs/jkbms/src/esphome/components/esphome/ota/ota_esphome.o
Compiling .pioenvs/jkbms/src/esphome/components/jk_rs485_bms/jk_rs485_bms.o
In file included from src/esphome/components/jk_rs485_bms/jk_rs485_bms.cpp:1:
src/esphome/components/jk_rs485_bms/jk_rs485_bms.h:3:10: fatal error: switch/jk_switch.h: No such file or directory
#include "switch/jk_switch.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/jkbms/src/esphome/components/jk_rs485_bms/jk_rs485_bms.o] Error 1
========================= [FAILED] Took 19.11 seconds =========================

@jogybaer0815
Copy link

same here: i added for the last updates "broadcast_to_all_bms: True" and that was fine but after the latest updates of ESPHome it is an invalid option. But commenting this offers more errors :(
What is going on and what is the solution?
Regards

@brycelarge
Copy link

Im still getting this error:

In file included from src/esphome/components/jk_rs485_bms/jk_rs485_bms.cpp:1:
src/esphome/components/jk_rs485_bms/jk_rs485_bms.h:4:10: fatal error: number/jk_number.h: No such file or directory
#include "number/jk_number.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/jkbms/src/esphome/components/jk_rs485_bms/jk_rs485_bms.o] Error 1
========================= [FAILED] Took 21.01 seconds =========================

I'm using 1 master and multiple slaves. I have cleaned build files, also physically SSH into esphome container and deleted all the files in the components dir but still the same error persists. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants