Compare commits
3 commits
f1a9eb4288
...
f3a7259d22
Author | SHA1 | Date | |
---|---|---|---|
Carsten Schmiemann | f3a7259d22 | ||
Carsten Schmiemann | d8bb0fe8d1 | ||
Carsten Schmiemann | 815e0344bd |
|
@ -114,12 +114,14 @@ class BatriumBattery(can.Listener):
|
||||||
logging.debug("Cell number in bypass: %d", self.NumberInBypass)
|
logging.debug("Cell number in bypass: %d", self.NumberInBypass)
|
||||||
|
|
||||||
elif msg.arbitration_id == 0x00111800:
|
elif msg.arbitration_id == 0x00111800:
|
||||||
self.TimeToEmpty = ((msg.data[5] * 256) + msg.data[4] * 60)
|
self.TimeToEmpty = ((msg.data[5] * 256) + msg.data[4]) * 60
|
||||||
logging.debug("Time to empty: %dmin", self.TimeToEmpty)
|
logging.debug("Time to empty: %dmin", (msg.data[5] * 256) + msg.data[4])
|
||||||
|
logging.debug("Time to empty: %dsec", self.TimeToEmpty)
|
||||||
|
|
||||||
elif msg.arbitration_id == 0x00111700:
|
elif msg.arbitration_id == 0x00111700:
|
||||||
self.TimeToFull = ((msg.data[5] * 256) + msg.data[4] * 60)
|
self.TimeToFull = ((msg.data[5] * 256) + msg.data[4]) * 60
|
||||||
logging.debug("Time to full: %dmin", self.TimeToFull)
|
logging.debug("Time to full: %dmin", (msg.data[5] * 256) + msg.data[4])
|
||||||
|
logging.debug("Time to full: %dsec", self.TimeToFull)
|
||||||
|
|
||||||
elif msg.arbitration_id == 0x00140400:
|
elif msg.arbitration_id == 0x00140400:
|
||||||
self.maxDischargeCurrent = ((msg.data[3] * 256) + msg.data[2]) * 0.01
|
self.maxDischargeCurrent = ((msg.data[3] * 256) + msg.data[2]) * 0.01
|
||||||
|
|
|
@ -44,6 +44,7 @@ class DbusBatteryService:
|
||||||
self.cell_balanced = 0
|
self.cell_balanced = 0
|
||||||
self.ChargedEnergy = 0
|
self.ChargedEnergy = 0
|
||||||
self.DischargedEnergy = 0
|
self.DischargedEnergy = 0
|
||||||
|
self.maxChargeVoltage = 0
|
||||||
self._bat = BatriumBattery(connection=connection)
|
self._bat = BatriumBattery(connection=connection)
|
||||||
self.notifier = can.Notifier(self._bat._ci, [self._bat])
|
self.notifier = can.Notifier(self._bat._ci, [self._bat])
|
||||||
|
|
||||||
|
@ -237,6 +238,10 @@ class DbusBatteryService:
|
||||||
|
|
||||||
if self._bat.maxChargeVoltage != 0:
|
if self._bat.maxChargeVoltage != 0:
|
||||||
self._dbusservice['/Info/MaxChargeVoltage'] = self._bat.maxChargeVoltage
|
self._dbusservice['/Info/MaxChargeVoltage'] = self._bat.maxChargeVoltage
|
||||||
|
self.maxChargeVoltage = self._bat.maxChargeVoltage
|
||||||
|
# Workaround lower charge voltage a bit, because Batrium sends TCL 0V if charge is disabled
|
||||||
|
elif self.maxChargeVoltage != 0:
|
||||||
|
self._dbusservice['/Info/MaxChargeVoltage'] = self.maxChargeVoltage - 0.1
|
||||||
|
|
||||||
self._dbusservice['/System/NrOfModulesOnline'] = self._bat.numberOfModules
|
self._dbusservice['/System/NrOfModulesOnline'] = self._bat.numberOfModules
|
||||||
self._dbusservice['/System/NrOfBatteriesBalancing'] = self._bat.NumberInBypass
|
self._dbusservice['/System/NrOfBatteriesBalancing'] = self._bat.NumberInBypass
|
||||||
|
@ -267,18 +272,23 @@ class DbusBatteryService:
|
||||||
self._dbusservice['/System/MaxVoltageCellId'] = self._bat.maxCellVoltageId
|
self._dbusservice['/System/MaxVoltageCellId'] = self._bat.maxCellVoltageId
|
||||||
self._dbusservice['/System/MinVoltageCellId'] = self._bat.minCellVoltageId
|
self._dbusservice['/System/MinVoltageCellId'] = self._bat.minCellVoltageId
|
||||||
|
|
||||||
if self._bat.current > 0:
|
if self._bat.current > 1:
|
||||||
#charging
|
#charging
|
||||||
if self._bat.NumberInBypass < 80000:
|
if self._bat.TimeToFull < 432000:
|
||||||
self._dbusservice['/TimeToGo'] = self._bat.TimeToFull
|
self._dbusservice['/TimeToGo'] = self._bat.TimeToFull
|
||||||
else:
|
else:
|
||||||
self._dbusservice['/TimeToGo'] = None
|
self._dbusservice['/TimeToGo'] = None
|
||||||
else :
|
else :
|
||||||
|
self._dbusservice['/TimeToGo'] = None
|
||||||
|
|
||||||
|
if self._bat.current < -1:
|
||||||
#discharging
|
#discharging
|
||||||
if self._bat.NumberInBypass < 80000:
|
if self._bat.TimeToEmpty < 432000:
|
||||||
self._dbusservice['/TimeToGo'] = self._bat.TimeToEmpty
|
self._dbusservice['/TimeToGo'] = self._bat.TimeToEmpty
|
||||||
else:
|
else:
|
||||||
self._dbusservice['/TimeToGo'] = None
|
self._dbusservice['/TimeToGo'] = None
|
||||||
|
else :
|
||||||
|
self._dbusservice['/TimeToGo'] = None
|
||||||
|
|
||||||
if self._bat.NumberInBypass == self._bat.numberOfModules:
|
if self._bat.NumberInBypass == self._bat.numberOfModules:
|
||||||
self.cell_balanced = True
|
self.cell_balanced = True
|
||||||
|
|
Loading…
Reference in a new issue