]> git.sven.stormbind.net Git - sven/scripts.git/commitdiff
Remove powerDetailsCondensed - no need to make it that complicated
authorSven Höxter <sven@stormbind.net>
Mon, 14 Apr 2025 12:55:37 +0000 (14:55 +0200)
committerSven Höxter <sven@stormbind.net>
Mon, 14 Apr 2025 12:55:37 +0000 (14:55 +0200)
home/portalmonitor.py

index 993aa656b795c15587e3c39307ed3306a6355240..20d327c01ef8222074072ea0dec9bb870c01cf65 100755 (executable)
@@ -36,19 +36,6 @@ def isDaylight(lat, lon, toleranceSeconds):
 
     return daylight
 
-# Condense the per Panel/Microinverter details down to
-# the information we want to print out later on
-def powerDetailsCondensed(powerDetails):
-    powerCondensed = []
-    for panel in powerDetails:
-        panelData = {}
-        panelData["name"] = panel["SNALIAS"]
-        panelData["power"] = panel["POWER"]
-        panelData["timestamp"] = panel["SITETIME"]
-        powerCondensed.append(panelData)
-
-    return(powerCondensed)
-
 
 # Query all relevant System Information in one Session
 def retrieveData(userName, password, stationId):
@@ -79,7 +66,7 @@ def retrieveData(userName, password, stationId):
                     'whereCondition': f"{{\"STATIONID\":\"{stationId}\"}}"
                 },
                 timeout=(10, 60)).json()
-            powerDetails = powerDetailsCondensed(r['Data']['QueryResults'])
+            powerDetails = r['Data']['QueryResults']
 
             r = s.post('https://www.envertecportal.com/apiAccount/Logout',
                        timeout=(20, 40))
@@ -126,9 +113,9 @@ if isDaylight(conf['config'].getfloat('lat'), conf['config'].getfloat('lon'),
                                    conf['config']['stationId'])
 
     if args.printStatus:
-        print(f"Reported Total Power: {currentPower[0]}")
+        print(f"Total Power: {currentPower[0]}")
         for panel in currentPower[1]:
-            print(f"{panel['name']}: {panel['power']} - {panel['timestamp']}")
+            print(f"{panel['SNALIAS']}: {panel['POWER']} - {panel['SITETIME']}")
 
     if currentPower == 0:
         if stateCheck('FAILED', conf['config']['stateFile']):