Skip to content

Commit

Permalink
adds cell temperatures to battery.temp1..4, uses Power temp as MOSFET
Browse files Browse the repository at this point in the history
temp
  • Loading branch information
wollew committed Jun 2, 2024
1 parent 6705621 commit 8d746e3
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions etc/dbus-serialbattery/bms/seplos.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,35 @@ def decode_status_data(self, data):
)
self.cells[i].voltage = voltage
logger.debug("Voltage cell[{}]={}V".format(i, voltage))
for i in range(min(4, self.cell_count)):
temp = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + i * 4) - 2731
) / 10
self.cells[i].temp = temp
logger.debug("Temp cell[{}]={}°C".format(i, temp))

self.temp1 = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 4 * 4) - 2731
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 0 * 4) - 2731
) / 10
self.temp2 = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 1 * 4) - 2731
) / 10
self.temp3 = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 2 * 4) - 2731
) / 10
self.temp4 = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 3 * 4) - 2731
) / 10
temp_environment = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 4 * 4) - 2731
) / 10
self.temp_mos = (
Seplos.int_from_2byte_hex_ascii(data, temps_offset + 5 * 4) - 2731
) / 10
logger.debug("Temp cell1={}°C".format(self.temp1))
logger.debug("Temp cell2={}°C".format(self.temp2))
logger.debug("Temp cell3={}°C".format(self.temp3))
logger.debug("Temp cell4={}°C".format(self.temp4))
logger.debug(
"Environment temp = {}°C , Power/MOSFET temp = {}°C".format(
temp_environment, self.temp_mos
)
)

self.current = (
Seplos.int_from_2byte_hex_ascii(data, offset=96, signed=True) / 100
)
Expand All @@ -261,11 +278,6 @@ def decode_status_data(self, data):
)
)
logger.debug("Cycles = {}".format(self.cycles))
logger.debug(
"Environment temp = {}°C , Power temp = {}°C".format(
self.temp1, self.temp2
)
)
logger.debug("HW:" + self.hardware_version)

return True
Expand Down

0 comments on commit 8d746e3

Please sign in to comment.