diff --git a/etc/dbus-serialbattery/dbushelper.py b/etc/dbus-serialbattery/dbushelper.py index c8ffb23c..a2287e93 100644 --- a/etc/dbus-serialbattery/dbushelper.py +++ b/etc/dbus-serialbattery/dbushelper.py @@ -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() diff --git a/etc/dbus-serialbattery/sinowealth.py b/etc/dbus-serialbattery/sinowealth.py index 151c5a68..ada97b8d 100755 --- a/etc/dbus-serialbattery/sinowealth.py +++ b/etc/dbus-serialbattery/sinowealth.py @@ -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 diff --git a/etc/dbus-serialbattery/utils.py b/etc/dbus-serialbattery/utils.py index 2f1613f6..b73bc5b6 100644 --- a/etc/dbus-serialbattery/utils.py +++ b/etc/dbus-serialbattery/utils.py @@ -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"}, @@ -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}'