jblance / mpp-solar

Python package to communicate to MPP Solar PIP-4048MS inverters (and similar)
MIT License
364 stars 151 forks source link

JKBMS Charging and discharging with wrong values #203

Open miguel300477 opened 2 years ago

miguel300477 commented 2 years ago

Hi,

I been monitoring my JKBMS and i noticed for a long while that the charging and discharging current goes to to the oposite number after 32amps.

So if im charging it shows for exemple 20amps but after it passes 32amps it goes negative value. the same is happening with the discharge...

Im using mqtt to export to home assistant.

Anyone has the same issue?

miguel300477 commented 2 years ago

In the pictures, today so far im only charging the battery, but the data does positive, to negative and so on. I got a peak at about 70amps but the values seem to subtract...and dont understand...

jkbms 1

Charge Graph jkbms 2

Discarge Graph jkbms 3

sebmueller commented 2 years ago

Hello, I got similar readings. Not sure what it means. After the Battery is full, the Values are pending +- 10A

image

syssi commented 2 years ago

Do you use BLE (JK02/JK04) or a UART-TTL connection?

sebmueller commented 2 years ago

I use a Bluetooth Connection.

geobitus commented 10 months ago

Hi there First of all thanks for sharing that great work. I am using a BLE connection to an JK BMS, I encountered the same issue and found that this sign switching is related to data decoding, When eg. voltage_cellxx/resistance_cellxx all decimals are present and decoded correctly the sign is correct, When from voltage_cellxx/resistance_cellxx some decimal are missing eg. 3.38 instead of 3.885 etc..the sign is wrong, Hope this found will help.

jblance commented 10 months ago

thanks for your feedback, if you can catch that failure in a debug run it would be helpfull

geobitus commented 10 months ago

Happy New One for all. That was the worst feedback ever from my side, not enough tested, my bad :-( sorry for misleading, Digging deeper I found that the sign switching is related to '["LittleHex2Short:r /1000", 2 , "Current_Charge" , "A"]' found in /mppsolar/protocols/jjkv11.py and in my case also occur near 32 Amps readings no matter if is charging or discharging, My empirically tested solution to get rid of this behave was to change LittleHex2Short to BigHex2Short and add some math after eg. instead of '/1000 ' use '/5 -x' I can't reproduce all here because I don't want to induce to anyone hiccups or a math hart attack :-) Hope this time the found will help.

capture !UPDATE! Wrong again,, now switching occur @ 51,2 Amps SW NEW UPDATE

  1. In file /usr/local/.../protocols/jkv11.py line 74 replacing "LittleHex2Short:r /1000" to "BigHex2Short:r /5 -153.6" for the charging leading me to the found: when the real current reported by the BMS on the app is 0 the script still report DEC 768 and for that the need to substract153.6 ??? seems that the script is decoding another byte instead of 2 since the 768 will translate to BIN 0011 0000 0000 or somehow is related to little/big endian.

  2. For the discharging current same file line 75 "BigHex2Short:r /5" works fine and shows the correct current in the tested 0~100Amps range