Skip to content

Commit

Permalink
Fix wrong error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Jul 2, 2024
1 parent 6f073c8 commit fb2230b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion etc/dbus-serialbattery/battery.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def manage_charge_voltage_linear(self) -> None:
if self.soc_calc <= utils.SOC_LEVEL_TO_RESET_VOLTAGE_LIMIT:
# set state to error, to show in the GUI that something is wrong
self.state = 10
self.error_code = 31
self.error_code = 8

# write to log, that reset to float was not possible
logger.error(
Expand Down
2 changes: 1 addition & 1 deletion etc/dbus-serialbattery/dbus-serialbattery.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def get_port() -> str:
# check config, if there are any invalid values trigger "settings incorrect" error
if not utils.validate_config_values():
battery.state = 10
battery.error_code = 31
battery.error_code = 119

# use external current sensor if configured
try:
Expand Down
14 changes: 7 additions & 7 deletions etc/dbus-serialbattery/dbushelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def setup_instance(self):
"AllowMaxVoltage could not be converted to type int: "
+ str(value["AllowMaxVoltage"])
)
pass

# check if the battery has CustomName set
if "CustomName" in value and value["CustomName"] != "":
Expand All @@ -287,7 +286,6 @@ def setup_instance(self):
"MaxVoltageStartTime could not be converted to type int: "
+ str(value["MaxVoltageStartTime"])
)
pass

# check if the battery has SocCalc set
# load SOC from dbus only if SOC_CALCULATION is enabled
Expand All @@ -307,7 +305,6 @@ def setup_instance(self):
"SocCalc could not be converted to type float: "
+ str(value["SocCalc"])
)
pass
else:
logger.debug("Soc_calc not found in dbus")

Expand All @@ -329,7 +326,6 @@ def setup_instance(self):
"SocResetLastReached could not be converted to type int: "
+ str(value["SocResetLastReached"])
)
pass

# check the last seen time and remove the battery it it was not seen for 30 days
elif "LastSeen" in value and int(value["LastSeen"]) < int(
Expand Down Expand Up @@ -481,9 +477,11 @@ def handle_changed_setting(self, setting, oldvalue, newvalue):

# this function is called when the battery is initiated
def setup_vedbus(self):
# Set up dbus service and device instance
# and notify of all the attributes we intend to update
# This is only called once when a battery is initiated
"""
Set up dbus service and device instance
and notify of all the attributes we intend to update
This is only called once when a battery is initiated
"""
self.setup_instance()
logger.info("%s" % (self._dbusname))

Expand Down Expand Up @@ -909,6 +907,8 @@ def publish_dbus(self):

# Update battery extras
self._dbusservice["/State"] = self.battery.state
# https://github.com/victronenergy/veutil/blob/master/inc/veutil/ve_regs_payload.h
# https://github.com/victronenergy/veutil/blob/master/src/qt/bms_error.cpp
self._dbusservice["/ErrorCode"] = self.battery.error_code
self._dbusservice["/History/ChargeCycles"] = self.battery.cycles
self._dbusservice["/History/TotalAhDrawn"] = self.battery.total_ah_drawn
Expand Down

0 comments on commit fb2230b

Please sign in to comment.