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 faeede5 commit 58b06b7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions etc/dbus-serialbattery/bms/battery_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def test_connection(self):
result = False
try:
result = self.read_status_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/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
4 changes: 2 additions & 2 deletions etc/dbus-serialbattery/bms/hlpdatabms4s.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@


class HLPdataBMS4S(Battery):
def __init__(self, port, baud):
super(HLPdataBMS4S, self).__init__(port, baud)
def __init__(self, port, baud, address):
super(HLPdataBMS4S, self).__init__(port, baud, address)
self.type = self.BATTERYTYPE

BATTERYTYPE = "HLPdataBMS4S"
Expand Down
5 changes: 4 additions & 1 deletion 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 Expand Up @@ -155,7 +158,7 @@ def read_gen_data(self):
) = unpack_from(">HhHHHHhHHBBBBB", gen_data)
self.voltage = voltage / 100
self.current = current / 100
self.soc = 100 * capacity_remain / capacity
self.soc = round(100 * capacity_remain / capacity, 0)
self.capacity_remain = capacity_remain / 100
self.capacity = capacity / 100
self.to_cell_bits(balance, balance2)
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

0 comments on commit 58b06b7

Please sign in to comment.