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

JK BMS RS485 doesn't work #23

Closed
danieltorkian opened this issue Mar 14, 2024 · 10 comments
Closed

JK BMS RS485 doesn't work #23

danieltorkian opened this issue Mar 14, 2024 · 10 comments

Comments

@danieltorkian
Copy link
Contributor

2024-03-14 18:46:34.633 | INFO | Thread-2 | verter.BmsToInverter:164 | Reading BMS #1 JK_RS485 on /dev/ttyAMA0...
2024-03-14 18:46:34.645 | INFO | Thread-2 | stoinverter.core.BMS:120 | ---------------------------------> Thread 44
2024-03-14 18:46:34.647 | ERROR | Thread-2 | stoinverter.core.BMS:139 | Error requesting data!
java.lang.UnsupportedOperationException: null
at java.nio.ByteBuffer.array(ByteBuffer.java:1471) ~[?:?]
at com.airepublic.bmstoinverter.protocol.rs485.JSerialCommPort.sendFrame(JSerialCommPort.java:115) ~[protocol-rs485-0.0.1-SNAPSHOT.jar:?]
at com.airepublic.bmstoinverter.bms.jk.rs485.JKBmsRS485Processor.collectData(JKBmsRS485Processor.java:27) ~[bms-jk-rs485-0.0.1-SNAPSHOT.jar:?]
at com.airepublic.bmstoinverter.core.BMS.process(BMS.java:127) ~[core-api-0.0.1-SNAPSHOT.jar:?]
at com.airepublic.bmstoinverter.BmsToInverter.lambda$start$2(BmsToInverter.java:165) ~[bms-to-inverter-main-0.0.1-SNAPSHOT.jar:?]
at java.lang.Thread.run(Thread.java:840) [?:?]

@ai-republic
Copy link
Owner

Hi Daniel,
ok, thanks for that. I've not been able to test the RS485 binding for the JK so its good if your willing to help me test it and get it up and running.
I will update the code to fix that exception and then we can go from that. Could you also please set the log level to debug please to get more information?

@danieltorkian
Copy link
Contributor Author

sure thing

logs.txt

this my config:
bms.pollInterval=1

bms.1.type=JK_RS485
bms.1.id=1
bms.1.portLocator=/dev/ttyAMA0
bms.1.delayAfterNoBytes=2000

###################################################################

Inverter settings

###################################################################

The inverter type can be NONE, DEYE_CAN, GROWATT_CAN, SMA_SI_CAN, SOLARK_CAN

inverter.type=SOLARK_CAN

The port name/device to use to communicate to the inverter

inverter.portLocator=can0

Interval to send data to the inverter (in seconds)

inverter.sendInterval=1

I use SEENGREAT RS485-Dual-CAN-I and also tested two RS485-USB Dongles with same results....

@ai-republic
Copy link
Owner

ai-republic commented Mar 15, 2024

Hi Daniel,
I fixed the exception above.
Could you set the log level to debug and do a Clean install from the Configurator app please and test again?
I also adjusted the Configurator app to produce a log file configuration that doesn't log all the useless information at startup, so you might want to get the new Configurator too.

@danieltorkian
Copy link
Contributor Author

Hi Thank you!
I tried again but still getting an error. See logs.
BMS-to-Inverter.log

@danieltorkian
Copy link
Contributor Author

can you please give me the permissions to push a branch and request a PR????

@ai-republic
Copy link
Owner

Hi Daniel,
I've added iterating through all commands and error handling in case no data was received.
The program will delay (Delay after no bytes received setting) a short time and try to read again. If no bytes are received for over 10x then it will try the next command.

Could you please Clean install with the Configurator and lets see if we get any responses.

@ai-republic ai-republic changed the title JK BMS doesn't work JK RS485 BMS doesn't work Mar 16, 2024
@ai-republic ai-republic changed the title JK RS485 BMS doesn't work JK BMS RS485 doesn't work Mar 16, 2024
@danieltorkian
Copy link
Contributor Author

Hey Torsten, CRC calculation of spec is wrong.... See according branch. Next step would be to convert the values from response to Battery_Object according to the spec.

@ai-republic
Copy link
Owner

ai-republic commented Mar 18, 2024

Hi Daniel,
thanks for your contribution.
I merged your code with some minor changes. I skipped the lombok framework (I know its nice) but I'd like to keep the footprint as small as possible.
I was thinking about requesting all values at once, but kept it consistent with the other bindings.
But it will be more performant this way so I kept it :)

I did however change some of your code to read the frames. Maybe you like to have a look and see if I didn't miss anything critical.

Can you get any readings from the JK now?

@ai-republic
Copy link
Owner

@danieltorkian could you try a Clean install from the Configurator application and test the JK binding?

@ai-republic
Copy link
Owner

I will close this issue, since the JK RS485 binding is working now

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

No branches or pull requests

2 participants