Open sugar012 opened 1 year ago
Hi! I made this library primarly for use with Victron-Systems via the dbus-serialbattery-project. Since much of the testing takes place in that project at the moment the most recent changes and fixes take place in the jkbms_ble-branch of that project, namely here: https://github.com/Louisvdw/dbus-serialbattery/blob/jkbms_ble/etc/dbus-serialbattery/bms/jkbms_brn.py . In that version the new 32s-BMS should already be working, you may try that version.
i think the change from 16 to 32 in line 60 did the trick for me!
Do you happen to know why this enormous reading are this way? like 25.900000000000002
{'model_nbr': 'BK-BLE-1.0', 'device_info': {'hw_rev': '11.XW', 'sw_rev': '11.26', 'uptime': 2358600, 'vendor_id': 'JK_B2A24S15P', 'manufacturing_date': '230409', 'serial_number': '3010546682', 'production': 'Input Us'}, 'last_update': 1683383596.653985, 'settings': {'cell_uvp': 2.8000000000000003, 'cell_uvpr': 2.85, 'cell_ovp': 3.66, 'cell_ovpr': 3.64, 'balance_trigger_voltage': 0.003, 'power_off_voltage': 2.5, 'max_charge_current': 120.0, 'max_discharge_current': 150.0, 'max_balance_current': 120.0, 'cell_count': 16, 'charging_switch': True, 'discharging_switch': True, 'balancing_switch': True}, 'cell_info': {'voltages': [3.487, 3.486, 3.487, 3.487, 3.486, 3.486, 3.486, 3.486, 3.486, 3.486, 3.486, 3.486, 3.486, 3.487, 3.486, 3.486], 'average_cell_voltage': 3.487, 'delta_cell_voltage': 0.002, 'max_voltage_cell': 8, 'min_voltage_cell': 3, 'resistances': [0.063, 0.063, 0.061, 0.061, 0.059000000000000004, 0.06, 0.059000000000000004, 0.059000000000000004, 0.062, 0.063, 0.058, 0.059000000000000004, 0.06, 0.06, 0.06, 0.061, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'total_voltage': 55.787, 'current': 0.0, 'temperature_sensor_1': 25.900000000000002, 'temperature_sensor_2': 25.6, 'temperature_mos': 0.0, 'balancing_current': 0.0, 'balancing_action': 0.0, 'battery_soc': 99, 'capacity_remain': 299.038, 'capacity_nominal': 302.0, 'cycle_count': 18, 'cycle_capacity': 5634.25, 'charging_switch_enabled': True, 'discharging_switch_enabled': True, 'balancing_active': False, 'error_bitmask_16': '0x0', 'error_bitmask_2': '0000000000000000', 'power': 0.0}, 'warnings': {'resistance_too_high': False, 'cell_count_wrong': False, 'charge_overtemp': False, 'charge_undertemp': False, 'discharge_overtemp': False, 'cell_overvoltage': False, 'cell_undervoltage': False, 'charge_overcurrent': False, 'discharge_overcurrent': False}}
i think the change from 16 to 32 in line 60 did the trick for me!
I think this could cause unwanted side-effects as this only shifts the the bit-positions of the voltages in the data-frame. But all upcoming positions need to be shifted as well. I fixed this in the version i mentioned above in a way that every jkbms should work. You better use that one.
Do you happen to know why this enormous reading are this way? like
25.900000000000002
I assume this is because of the way decimal-numbers are represented in most programming languages as floating-point-numbers, that are only approximated and sometimes a bit off the actual value and cause some error in low decimal places. The lib does not round in any way but uses this raw-value.
i think the change from 16 to 32 in line 60 did the trick for me!
I think this could cause unwanted side-effects as this only shifts the the bit-positions of the voltages in the data-frame. But all upcoming positions need to be shifted as well. I fixed this in the version i mentioned above in a way that every jkbms should work. You better use that one.
yep, i'm using that one!
Do you happen to know why this enormous reading are this way? like
25.900000000000002
I assume this is because of the way decimal-numbers are represented in most programming languages as floating-point-numbers, that are only approximated and sometimes a bit off the actual value and cause some error in low decimal places. The lib does not round in any way but uses this raw-value.
Any hint on how to make it round would be appreciated. thanks man
Use the lib as you do now. After calling data=jk.get_status()
Simply apply pythons builtin round
( https://www.w3schools.com/python/ref_func_round.asp ) like: round(data["cell_info"]["voltages"][0],2)
Hello there, i found your code trying to figure out a way to read data from my jkbms. It has hardware 11 and AFAIK it supports 32 cells the output changed a bit. my current output is this, what do you think?