changeset 19:3a3dba401b4a

Hook up more stuff.. - Battery temperature - Aux voltage - Low/high main/aux voltage, and flat battery alarms
author Daniel O'Connor <darius@dons.net.au>
date Mon, 06 Dec 2021 22:32:32 +1030
parents 9c2e08444598
children 8d48ca5294d3
files eprodbus.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/eprodbus.py	Mon Dec 06 12:07:30 2021 +1030
+++ b/eprodbus.py	Mon Dec 06 22:32:32 2021 +1030
@@ -71,11 +71,22 @@
                 self.dbusservice['/Dc/0/Voltage'] = p.volts
             elif type(p) == epro.BatteryCurrent:
                 self.dbusservice['/Dc/0/Current'] = p.amps
+            elif type(p) == epro.BatteryTemperature:
+                self.dbusservice['/Dc/0/Temperature'] = p.temp
             elif type(p) == epro.AmpHours:
                 self.dbusservice['/ConsumedAmphours'] = p.amphrs
             elif type(p) == epro.TimeRemaining:
                 # ePro reports in minutes, Venus expects seconds
                 self.dbusservice['/TimeToGo'] = p.time * 60
+            elif type(p) == epro.AuxVoltage:
+                self.dbusservice['/Dc/1/Voltage'] = p.volts
+            elif type(p) == epro.MonitorStatus:
+                self.dbusservice['/Alarms/LowVoltage'] = 2 if p.mainlv else 0
+                self.dbusservice['/Alarms/HighVoltage'] = 2 if p.mainhv else 0
+                self.dbusservice['/Alarms/LowStarterVoltage'] = 2 if p.auxlv else 0
+                self.dbusservice['/Alarms/HighStarterVoltage'] = 2 if p.auxhv else 0
+                self.dbusservice['/Alarms/LowSoc'] = 2 if p.batflat else 0
+                self.dbusservice['/Settings/HasTemperature'] = 1 if p.tempsense else 0
         return True
 
     def log_epro(self):
@@ -162,10 +173,18 @@
     dbusservice.add_path('/DeviceInstance', value = instance)
     dbusservice.add_path('/ProductId', value = 'unknown')
     dbusservice.add_path('/Dc/0/Voltage', value = None)
+    dbusservice.add_path('/Dc/0/Temperature', value = None)
     dbusservice.add_path('/Dc/0/Current', value = None)
+    dbusservice.add_path('/Dc/1/Voltage', value = None)
     dbusservice.add_path('/Soc', value = None)
     dbusservice.add_path('/TimeToGo', value = None)
     dbusservice.add_path('/ConsumedAmphours', value = None)
+    dbusservice.add_path('/Alarms/LowVoltage', value = 0)
+    dbusservice.add_path('/Alarms/HighVoltage', value = 0)
+    dbusservice.add_path('/Alarms/LowStarterVoltage', value = 0)
+    dbusservice.add_path('/Alarms/HighStarterVoltage', value = 0)
+    dbusservice.add_path('/Alarms/LowSoc', value = 0)
+    dbusservice.add_path('/Settings/HasTemperature', value = 0)
 
     s = serial.Serial('/dev/' + port, 2400, parity = 'E')
     s.timeout = 0.1