Skip to content

Commit

Permalink
Fix for #450
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed May 2, 2023
1 parent 80e2c67 commit 70658e9
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
3 changes: 3 additions & 0 deletions etc/dbus-serialbattery/bms/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def test_connection(self):

self.find_LiPro_cells()

# get first data to show in startup log
self.refresh_data()

return self.get_settings()
except IOError:
return False
Expand Down
9 changes: 7 additions & 2 deletions etc/dbus-serialbattery/bms/jkbms_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ def test_connection(self):
return False

logger.info("JK BMS found!")

# get first data to show in startup log
self.get_settings()
self.refresh_data()

return True

def get_settings(self):
Expand Down Expand Up @@ -150,8 +155,8 @@ def refresh_data(self):
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"])
self.current = st["cell_info"]["current"]
self.voltage = st["cell_info"]["total_voltage"]
self.current = round(st["cell_info"]["current"], 1)
self.voltage = round(st["cell_info"]["total_voltage"], 2)

self.soc = st["cell_info"]["battery_soc"]
self.cycles = st["cell_info"]["cycle_count"]
Expand Down
3 changes: 3 additions & 0 deletions etc/dbus-serialbattery/bms/lltjbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def test_connection(self):
result = False
try:
result = self.read_hardware_data()
# get first data to show in startup log
if result:
self.refresh_data()
except Exception as err:
logger.error(f"Unexpected {err=}, {type(err)=}")
result = False
Expand Down
3 changes: 3 additions & 0 deletions etc/dbus-serialbattery/bms/renogy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def test_connection(self):
result = False
try:
result = self.read_gen_data()
# get first data to show in startup log
if result:
self.refresh_data()
except Exception as err:
logger.error(f"Unexpected {err=}, {type(err)=}")
result = False
Expand Down
8 changes: 6 additions & 2 deletions etc/dbus-serialbattery/bms/revov.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ def test_connection(self):
result = False
try:
result = self.read_gen_data()
except:
pass
# get first data to show in startup log
if result:
self.refresh_data()
except Exception as err:
logger.error(f"Unexpected {err=}, {type(err)=}")
result = False

return result

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 @@ -36,7 +36,7 @@ def _get_list_from_config(

# Constants - Need to dynamically get them in future
DRIVER_VERSION = "1.0"
DRIVER_SUBVERSION = ".0-jkbms_ble (20230501)"
DRIVER_SUBVERSION = ".0-jkbms_ble (20230502)"
zero_char = chr(48)
degree_sign = "\N{DEGREE SIGN}"

Expand Down

0 comments on commit 70658e9

Please sign in to comment.