Skip to content

Commit

Permalink
v0.14 (#314)
Browse files Browse the repository at this point in the history
new version
remove Sinowealth by default as it causes other issues but can be enabled manually
  • Loading branch information
Louisvdw committed Dec 3, 2022
1 parent bb6ec31 commit 7aab4c8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
54 changes: 27 additions & 27 deletions etc/dbus-serialbattery/dbushelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,34 @@ def setup_instance(self):
default_instance = 'battery:1'
settings = {
'instance': [path + '_' + str(bms_id).replace(" ", "_")+ '/ClassAndVrmInstance', default_instance, 0, 0],
'CellVoltageMin': [path + '/CellVoltageMin', 2.8, 0.0, 5.0],
'CellVoltageMax': [path + '/CellVoltageMax', 3.45, 0.0, 5.0],
'CellVoltageFloat': [path + '/CellVoltageFloat', 3.35, 0.0, 5.0],
'VoltageMaxTime': [path + '/VoltageMaxTime', 900, 0, 0],
'VoltageResetSocLimit': [path + '/VoltageResetSocLimit', 90, 0, 100],
'MaxChargeCurrent': [path + '/MaxCurrentCharge', 5, 0.0, 500],
'MaxDischargeCurrent': [path + '/MaxCurrentDischarge', 7, 0.0, 500],
'AllowDynamicChargeCurrent': [path + '/AllowDynamicChargeCurrent', 1, 0, 1],
'AllowDynamicDischargeCurrent': [path + '/AllowDynamicDischargeCurrent', 1, 0, 1],
'AllowDynamicChargeVoltage': [path + '/AllowDynamicChargeVoltage', 0, 0, 1],
'SocLowWarning': [path + '/SocLowWarning', 20, 0, 100],
'SocLowAlarm': [path + '/SocLowAlarm', 10, 0, 100],
'Capacity': [path + '/Capacity', '', 0, 500],
'EnableInvertedCurrent': [path + '/EnableInvertedCurrent', 0, 0, 1],
# 'CellVoltageMin': [path + '/CellVoltageMin', 2.8, 0.0, 5.0],
# 'CellVoltageMax': [path + '/CellVoltageMax', 3.45, 0.0, 5.0],
# 'CellVoltageFloat': [path + '/CellVoltageFloat', 3.35, 0.0, 5.0],
# 'VoltageMaxTime': [path + '/VoltageMaxTime', 900, 0, 0],
# 'VoltageResetSocLimit': [path + '/VoltageResetSocLimit', 90, 0, 100],
# 'MaxChargeCurrent': [path + '/MaxCurrentCharge', 5, 0.0, 500],
# 'MaxDischargeCurrent': [path + '/MaxCurrentDischarge', 7, 0.0, 500],
# 'AllowDynamicChargeCurrent': [path + '/AllowDynamicChargeCurrent', 1, 0, 1],
# 'AllowDynamicDischargeCurrent': [path + '/AllowDynamicDischargeCurrent', 1, 0, 1],
# 'AllowDynamicChargeVoltage': [path + '/AllowDynamicChargeVoltage', 0, 0, 1],
# 'SocLowWarning': [path + '/SocLowWarning', 20, 0, 100],
# 'SocLowAlarm': [path + '/SocLowAlarm', 10, 0, 100],
# 'Capacity': [path + '/Capacity', '', 0, 500],
# 'EnableInvertedCurrent': [path + '/EnableInvertedCurrent', 0, 0, 1],

'CCMSocLimitCharge1': [path + '/CCMSocLimitCharge1', 98, 0, 100],
'CCMSocLimitCharge2': [path + '/CCMSocLimitCharge2', 95, 0, 100],
'CCMSocLimitCharge3': [path + '/CCMSocLimitCharge3', 91, 0, 100],
'CCMSocLimitDischarge1': [path + '/CCMSocLimitDischarge1', 10, 0, 100],
'CCMSocLimitDischarge2': [path + '/CCMSocLimitDischarge2', 20, 0, 100],
'CCMSocLimitDischarge3': [path + '/CCMSocLimitDischarge3', 30, 0, 100],
'CCMCurrentLimitCharge1': [path + '/CCMCurrentLimitCharge1', 5, 0, 100],
'CCMCurrentLimitCharge2': [path + '/CCMCurrentLimitCharge2', '', 0, 100],
'CCMCurrentLimitCharge3': [path + '/CCMCurrentLimitCharge3', '', 0, 100],
'CCMCurrentLimitDischarge1': [path + '/CCMCurrentLimitDischarge1', 5, 0, 100],
'CCMCurrentLimitDischarge2': [path + '/CCMCurrentLimitDischarge2', '', 0, 100],
'CCMCurrentLimitDischarge3': [path + '/CCMCurrentLimitDischarge3', '', 0, 100],
}
# 'CCMSocLimitCharge1': [path + '/CCMSocLimitCharge1', 98, 0, 100],
# 'CCMSocLimitCharge2': [path + '/CCMSocLimitCharge2', 95, 0, 100],
# 'CCMSocLimitCharge3': [path + '/CCMSocLimitCharge3', 91, 0, 100],
# 'CCMSocLimitDischarge1': [path + '/CCMSocLimitDischarge1', 10, 0, 100],
# 'CCMSocLimitDischarge2': [path + '/CCMSocLimitDischarge2', 20, 0, 100],
# 'CCMSocLimitDischarge3': [path + '/CCMSocLimitDischarge3', 30, 0, 100],
# 'CCMCurrentLimitCharge1': [path + '/CCMCurrentLimitCharge1', 5, 0, 100],
# 'CCMCurrentLimitCharge2': [path + '/CCMCurrentLimitCharge2', '', 0, 100],
# 'CCMCurrentLimitCharge3': [path + '/CCMCurrentLimitCharge3', '', 0, 100],
# 'CCMCurrentLimitDischarge1': [path + '/CCMCurrentLimitDischarge1', 5, 0, 100],
# 'CCMCurrentLimitDischarge2': [path + '/CCMCurrentLimitDischarge2', '', 0, 100],
# 'CCMCurrentLimitDischarge3': [path + '/CCMCurrentLimitDischarge3', '', 0, 100],
}

self.settings = SettingsDevice(get_bus(), settings, self.handle_changed_setting)
self.battery.role, self.instance = self.get_role_instance()
Expand Down
3 changes: 3 additions & 0 deletions etc/dbus-serialbattery/sinowealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def read_pack_config_data(self):
return False
cell_cnt_mask = int(7)
self.cell_count = (pack_config_data[1] & cell_cnt_mask) + 3
if self.cell_count < 1 or self.cell_count > 32:
logger.error(">>> ERROR: No valid cell count returnd: %u", self.cell_count)
return False
logger.info(">>> INFO: Number of cells: %u", self.cell_count)
temp_sens_mask = int(~(1 << 6))
self.temp_sensors = 1 if (pack_config_data[1] & temp_sens_mask) else 2 # one means two
Expand Down
4 changes: 2 additions & 2 deletions etc/dbus-serialbattery/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{"bms" : "Daly", "address" : b"\x40"},
{"bms" : "Daly", "address" : b"\x80"},
{"bms" : "Jkbms", "baud" : 115200},
{"bms" : "Sinowealth"},
# {"bms" : "Sinowealth"},
{"bms" : "Lifepower"},
{"bms" : "Renogy", "address": b"\x30"},
{"bms" : "Renogy", "address": b"\xF7"},
Expand All @@ -29,7 +29,7 @@

# Constants - Need to dynamically get them in future
DRIVER_VERSION = 0.14
DRIVER_SUBVERSION = '~3'
DRIVER_SUBVERSION = ''
zero_char = chr(48)
degree_sign = u'\N{DEGREE SIGN}'

Expand Down

0 comments on commit 7aab4c8

Please sign in to comment.