fix: setpoint clamp, thread safety, error handling, real-time kWh counters; cleanup repo
This commit is contained in:
+6
-7
@@ -111,9 +111,8 @@ class client:
|
||||
logger.info("Connecting to dbus...")
|
||||
logger.info("Return from setpoint: {}".format(self.session_bus.call_blocking(self.device, path_setpoint ,None,'SetValue', 'v', [self.setpoint])))
|
||||
break
|
||||
except:
|
||||
|
||||
logger.info("Unable to connect to dbus {}".format(path_setpoint))
|
||||
except Exception as e:
|
||||
logger.info("Unable to connect to dbus {}: {!r}".format(path_setpoint, e))
|
||||
time.sleep(5)
|
||||
|
||||
def get_power_usage(self):
|
||||
@@ -129,9 +128,9 @@ class client:
|
||||
try:
|
||||
self.session_bus.call_blocking(self.device, path_setpoint ,None,'SetValue', 'v', [setpoint])
|
||||
self.setpoint = setpoint
|
||||
except:
|
||||
logger.info("Unable to connect to dbus {}".format(path_setpoint))
|
||||
self.setpoint = None
|
||||
except Exception as e:
|
||||
# keep the last known setpoint; None would break later comparisons
|
||||
logger.error("Unable to set dbus {}: {!r}".format(path_setpoint, e))
|
||||
|
||||
|
||||
def get_battery_current(self):
|
||||
@@ -193,7 +192,7 @@ class battery:
|
||||
#self.paths = victron.listPaths(device)
|
||||
|
||||
def get_name(self):
|
||||
return self.snameoc
|
||||
return self.name
|
||||
|
||||
|
||||
def get_soc(self):
|
||||
|
||||
Reference in New Issue
Block a user