Skip to content

Commit

Permalink
Fixes #916
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Jan 28, 2024
1 parent 555ff13 commit 2da6bae
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* `BULK_CELL_VOLTAGE` -> `SOC_RESET_VOLTAGE`
* `BULK_AFTER_DAYS` -> `SOC_RESET_AFTER_DAYS`

## v1.1.x

* Changed: JKBMS BLE - Fix driver gets unresponsive, if connection is lost https://github.com/Louisvdw/dbus-serialbattery/issues/720 with https://github.com/Louisvdw/dbus-serialbattery/pull/941 by @cupertinomiranda
* Changed: JKBMS BLE - Fix temperature issue https://github.com/Louisvdw/dbus-serialbattery/issues/916 by @mr-manuel

## v1.1.20240121

* Changed: Exit the driver with error, when port is excluded in config, else the serialstarter does not continue by @mr-manuel
Expand Down
16 changes: 11 additions & 5 deletions etc/dbus-serialbattery/bms/jkbms_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,15 @@ def refresh_data(self):
for c in range(self.cell_count):
self.cells[c].voltage = st["cell_info"]["voltages"][c]

self.to_temp(0, st["cell_info"]["temperature_mos"])
self.to_temp(1, st["cell_info"]["temperature_sensor_1"])
self.to_temp(2, st["cell_info"]["temperature_sensor_2"])
temp_mos = st["cell_info"]["temperature_mos"]
self.to_temp(0, temp_mos if temp_mos < 32767 else (65535 - temp_mos) * -1)

temp1 = st["cell_info"]["temperature_sensor_1"]
self.to_temp(1, temp1 if temp1 < 32767 else (65535 - temp1) * -1)

temp2 = st["cell_info"]["temperature_sensor_2"]
self.to_temp(1, temp2 if temp2 < 32767 else (65535 - temp2) * -1)

self.current = round(st["cell_info"]["current"], 1)
self.voltage = round(st["cell_info"]["total_voltage"], 2)

Expand All @@ -197,8 +203,8 @@ def refresh_data(self):
self.balancing = False if st["cell_info"]["balancing_action"] == 0.000 else True
self.balancing_current = (
st["cell_info"]["balancing_current"]
if st["cell_info"]["balancing_current"] < 32768
else (65536 / 1000 - st["cell_info"]["balancing_current"]) * -1
if st["cell_info"]["balancing_current"] < 32767
else (65535 / 1000 - st["cell_info"]["balancing_current"]) * -1
)
self.balancing_action = st["cell_info"]["balancing_action"]

Expand Down
7 changes: 4 additions & 3 deletions etc/dbus-serialbattery/bms/jkbms_brn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from time import sleep, time
import asyncio
import threading
import sys

# if used as standalone script then use custom logger
# else import logger from utils
Expand Down Expand Up @@ -141,7 +142,9 @@ class Jkbms_Brn:

def __init__(self, addr):
self.address = addr
self.bt_thread = threading.Thread(target=self.connect_and_scrape)
self.bt_thread = threading.Thread(
target=self.connect_and_scrape, name="Thread-JKBMS-BLE"
)
self.trigger_soc_reset = False

async def scanForDevices(self):
Expand Down Expand Up @@ -568,8 +571,6 @@ async def reset_soc_jk(self, c):


if __name__ == "__main__":
import sys

jk = Jkbms_Brn(sys.argv[1])
if not jk.test_connection():
logger.error(">>> ERROR: Unable to connect")
Expand Down
2 changes: 1 addition & 1 deletion etc/dbus-serialbattery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _get_list_from_config(


# Constants
DRIVER_VERSION = "1.1.20240121dev"
DRIVER_VERSION = "1.1.20240128dev"
zero_char = chr(48)
degree_sign = "\N{DEGREE SIGN}"

Expand Down

0 comments on commit 2da6bae

Please sign in to comment.