#!/usr/bin/env python

import PayloadProcessor
import simplejson as json

slrProc = PayloadProcessor.SolarInverterProcessor()

wstProc = PayloadProcessor.WSTSensorProcessor()

payload = "<GATEWAY_ID V='WBEGTWYIN008'><DT V='2019-12-24 22:05:00'><SINV id='DLT04' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.86'/><COSFi V='644.86'/><PF V='64486'/><WattH_T V='588.00'/><RunT_T V='9.69'/><WattH V='2279.14'/><RunT V='2027.66'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.60'/><DCA V='499.60'/><DVW V='286.02'/></MDCIP><MDCIP V='2'><DCV V='786.80'/><DCA V='461.40'/><DVW V='223.02'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.20'/><ACA V='58.07'/><ACW V='14.60'/><FRQ V='51.55'/></MACOP><MACOP V='2'><ACV V='267.20'/><ACA V='58.15'/><ACW V='14.54'/><FRQ V='51.55'/></MACOP><MACOP V='3'><ACV V='260.90'/><ACA V='58.10'/><ACW V='14.43'/><FRQ V='51.55'/></MACOP><alarms></alarms></SINV><SINV id='DLT05' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.90'/><COSFi V='644.90'/><PF V='64490'/><WattH_T V='685.00'/><RunT_T V='9.71'/><WattH V='3086.36'/><RunT V='2038.19'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.90'/><DCA V='500.20'/><DVW V='328.83'/></MDCIP><MDCIP V='2'><DCV V='787.20'/><DCA V='500.40'/><DVW V='282.47'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.90'/><ACA V='72.59'/><ACW V='18.53'/><FRQ V='51.54'/></MACOP><MACOP V='2'><ACV V='268.50'/><ACA V='72.77'/><ACW V='18.40'/><FRQ V='51.54'/></MACOP><MACOP V='3'><ACV V='261.50'/><ACA V='73.00'/><ACW V='18.30'/><FRQ V='51.54'/></MACOP><alarms></alarms></SINV><SINV id='DLT06' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.96'/><COSFi V='644.96'/><PF V='64496'/><WattH_T V='598.00'/><RunT_T V='9.69'/><WattH V='2452.63'/><RunT V='1831.44'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='775.60'/><DCA V='500.50'/><DVW V='308.58'/></MDCIP><MDCIP V='2'><DCV V='775.50'/><DCA V='500.30'/><DVW V='281.79'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.60'/><ACA V='72.20'/><ACW V='18.53'/><FRQ V='51.53'/></MACOP><MACOP V='2'><ACV V='268.90'/><ACA V='72.05'/><ACW V='18.35'/><FRQ V='51.53'/></MACOP><MACOP V='3'><ACV V='262.50'/><ACA V='72.51'/><ACW V='18.27'/><FRQ V='51.53'/></MACOP><alarms></alarms></SINV><SINV id='DLT07' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0.00'/><COSFi V='0.00'/><PF V='0'/><WattH_T V='358.00'/><RunT_T V='9.61'/><WattH V='1488.02'/><RunT V='1999.80'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='710.90'/><DCA V='299.90'/><DVW V='169.54'/></MDCIP><MDCIP V='2'><DCV V='710.10'/><DCA V='298.60'/><DVW V='144.13'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.80'/><ACA V='37.54'/><ACW V='9.61'/><FRQ V='51.56'/></MACOP><MACOP V='2'><ACV V='269.20'/><ACA V='37.66'/><ACW V='9.55'/><FRQ V='51.56'/></MACOP><MACOP V='3'><ACV V='262.60'/><ACA V='37.40'/><ACW V='9.39'/><FRQ V='51.56'/></MACOP><alarms></alarms></SINV><SINV id='DLT08' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0'/><COSFi V='0'/><PF V='0'/><WattH_T V='114.00'/><RunT_T V='8.83'/><WattH V='575.33'/><RunT V='1792.04'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='675.20'/><DCA V='221.70'/><DVW V='123.14'/></MDCIP><MDCIP V='2'><DCV V='675.60'/><DCA V='220.90'/><DVW V='91.39'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='256.90'/><ACA V='25.44'/><ACW V='6.04'/><FRQ V='51.51'/></MACOP><MACOP V='2'><ACV V='317.00'/><ACA V='25.35'/><ACW V='6.35'/><FRQ V='51.51'/></MACOP><MACOP V='3'><ACV V='287.80'/><ACA V='25.37'/><ACW V='5.93'/><FRQ V='51.51'/></MACOP><alarms></alarms></SINV><WST id='WST001' type='WST_RTD_RS485'><WSNSR V='8.79'/></WST><WST id='WST002' type='WST_IRRADIATION_RS485'><ANLG1 V='0'/></WST></DT></GATEWAY_ID>"
payloadJsonStr = '{"WBEGTWYIN103" : [ { "DT" : "2020-09-06 23:05:30", "imei" : "862649043469932", "inverters" : [ { "slave_id" : 1, "device_type" : "INVERTER_HAVELS_40KW", "device_category" : "inverter", "device_id" : "DLT001", "total_acp" : 0, "react_power" : 0, "today_energy" : 0, "today_runt" : 0, "total_energy" : 0, "total_runt" : 0, "op_state" : 0, "ac_volt" : [ 0, 0, 0 ], "ac_cur" : [ 0, 0, 0 ], "ac_freq" : [ 0, null, null ], "ac_power" : [ null, null, null ], "dc_volt" : [ 0, 0 ], "dc_cur" : [ 0, 0 ], "dc_power" : [ 0, 0 ] } ], "wst" : [ { "slave_id" : 31, "device_type" : "WST_RTD_RS485", "device_category" : "WST", "device_id" : "WST001", "module_temp" : 0 }, { "slave_id" : 51, "device_type" : "WST_IRRADIATION_RS485", "device_category" : "WST", "device_id" : "WST002", "irradiation" : 0 } ] } ] }'
payloadJson = json.loads(payloadJsonStr)
payload = '{"WBEGTWYIN066":[{"DT":"2020-11-12 12:35:00","imei":"862649044417898","inverters":[{"ac_cur":["16.30","16.10","16.40"],"ac_freq":["49.97","49.97","49.97"],"ac_power":[0,0,0],"ac_volt":["244.40","246.30","243.00"],"app_power":"11.53","dc_cur":["18.40",0,0,0],"dc_power":["12.29",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT001","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":1,"today_energy":"578.00","today_runt":0,"total_acp":"11.53","total_dcp":0,"total_energy":"580.00"},{"ac_cur":["17.50","17.30","17.70"],"ac_freq":["49.96","49.96","49.96"],"ac_power":[0,0,0],"ac_volt":["244.40","246.50","243.20"],"app_power":"12.47","dc_cur":["19.40",0,0,0],"dc_power":["12.84",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT002","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":2,"today_energy":"638.00","today_runt":0,"total_acp":"12.47","total_dcp":0,"total_energy":"638.00"},{"ac_cur":["18.00","17.90","18.20"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["243.80","245.90","242.20"],"app_power":"12.84","dc_cur":["19.60",0,0,0],"dc_power":["13.39",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT003","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":3,"today_energy":"628.00","today_runt":0,"total_acp":"12.83","total_dcp":0,"total_energy":"628.00"},{"ac_cur":["17.20","17.10","17.40"],"ac_freq":["49.98","49.98","49.98"],"ac_power":[0,0,0],"ac_volt":["243.10","245.50","242.10"],"app_power":"12.24","dc_cur":["19.10",0,0,0],"dc_power":["12.88",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT004","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":4,"today_energy":"633.00","today_runt":0,"total_acp":"12.24","total_dcp":0,"total_energy":"633.00"},{"ac_cur":["17.50","17.40","17.70"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["244.20","245.30","242.70"],"app_power":"12.49","dc_cur":["19.60",0,0,0],"dc_power":["13.26",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT005","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":5,"today_energy":"646.00","today_runt":0,"total_acp":"12.51","total_dcp":0,"total_energy":"646.00"}],"wst":[{"device_category":"WST","device_id":"WST001","device_type":"WST_STM8_RS485","irradiation":199,"module_temp":"28.89"}]}]}'
payloadJson = json.loads(payload)

print(json.dumps(slrProc.populateTodayEnergyJson( payloadJson )))

#print(slrProc.populateTodayEnergy( payload ).decode('utf-8')+'\n')

#print(wstProc.mergeWstJson(payloadJson))

5c1a73bfffc3fbf132866d598722210b6cff3a29
<mask token>

<mask token>
print(json.dumps(slrProc.populateTodayEnergyJson(payloadJson)))

<mask token>
slrProc = PayloadProcessor.SolarInverterProcessor()
wstProc = PayloadProcessor.WSTSensorProcessor()
payload = (
    "<GATEWAY_ID V='WBEGTWYIN008'><DT V='2019-12-24 22:05:00'><SINV id='DLT04' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.86'/><COSFi V='644.86'/><PF V='64486'/><WattH_T V='588.00'/><RunT_T V='9.69'/><WattH V='2279.14'/><RunT V='2027.66'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.60'/><DCA V='499.60'/><DVW V='286.02'/></MDCIP><MDCIP V='2'><DCV V='786.80'/><DCA V='461.40'/><DVW V='223.02'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.20'/><ACA V='58.07'/><ACW V='14.60'/><FRQ V='51.55'/></MACOP><MACOP V='2'><ACV V='267.20'/><ACA V='58.15'/><ACW V='14.54'/><FRQ V='51.55'/></MACOP><MACOP V='3'><ACV V='260.90'/><ACA V='58.10'/><ACW V='14.43'/><FRQ V='51.55'/></MACOP><alarms></alarms></SINV><SINV id='DLT05' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.90'/><COSFi V='644.90'/><PF V='64490'/><WattH_T V='685.00'/><RunT_T V='9.71'/><WattH V='3086.36'/><RunT V='2038.19'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.90'/><DCA V='500.20'/><DVW V='328.83'/></MDCIP><MDCIP V='2'><DCV V='787.20'/><DCA V='500.40'/><DVW V='282.47'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.90'/><ACA V='72.59'/><ACW V='18.53'/><FRQ V='51.54'/></MACOP><MACOP V='2'><ACV V='268.50'/><ACA V='72.77'/><ACW V='18.40'/><FRQ V='51.54'/></MACOP><MACOP V='3'><ACV V='261.50'/><ACA V='73.00'/><ACW V='18.30'/><FRQ V='51.54'/></MACOP><alarms></alarms></SINV><SINV id='DLT06' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.96'/><COSFi V='644.96'/><PF V='64496'/><WattH_T V='598.00'/><RunT_T V='9.69'/><WattH V='2452.63'/><RunT V='1831.44'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='775.60'/><DCA V='500.50'/><DVW V='308.58'/></MDCIP><MDCIP V='2'><DCV V='775.50'/><DCA V='500.30'/><DVW V='281.79'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.60'/><ACA V='72.20'/><ACW V='18.53'/><FRQ V='51.53'/></MACOP><MACOP V='2'><ACV V='268.90'/><ACA V='72.05'/><ACW V='18.35'/><FRQ V='51.53'/></MACOP><MACOP V='3'><ACV V='262.50'/><ACA V='72.51'/><ACW V='18.27'/><FRQ V='51.53'/></MACOP><alarms></alarms></SINV><SINV id='DLT07' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0.00'/><COSFi V='0.00'/><PF V='0'/><WattH_T V='358.00'/><RunT_T V='9.61'/><WattH V='1488.02'/><RunT V='1999.80'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='710.90'/><DCA V='299.90'/><DVW V='169.54'/></MDCIP><MDCIP V='2'><DCV V='710.10'/><DCA V='298.60'/><DVW V='144.13'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.80'/><ACA V='37.54'/><ACW V='9.61'/><FRQ V='51.56'/></MACOP><MACOP V='2'><ACV V='269.20'/><ACA V='37.66'/><ACW V='9.55'/><FRQ V='51.56'/></MACOP><MACOP V='3'><ACV V='262.60'/><ACA V='37.40'/><ACW V='9.39'/><FRQ V='51.56'/></MACOP><alarms></alarms></SINV><SINV id='DLT08' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0'/><COSFi V='0'/><PF V='0'/><WattH_T V='114.00'/><RunT_T V='8.83'/><WattH V='575.33'/><RunT V='1792.04'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='675.20'/><DCA V='221.70'/><DVW V='123.14'/></MDCIP><MDCIP V='2'><DCV V='675.60'/><DCA V='220.90'/><DVW V='91.39'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='256.90'/><ACA V='25.44'/><ACW V='6.04'/><FRQ V='51.51'/></MACOP><MACOP V='2'><ACV V='317.00'/><ACA V='25.35'/><ACW V='6.35'/><FRQ V='51.51'/></MACOP><MACOP V='3'><ACV V='287.80'/><ACA V='25.37'/><ACW V='5.93'/><FRQ V='51.51'/></MACOP><alarms></alarms></SINV><WST id='WST001' type='WST_RTD_RS485'><WSNSR V='8.79'/></WST><WST id='WST002' type='WST_IRRADIATION_RS485'><ANLG1 V='0'/></WST></DT></GATEWAY_ID>"
    )
payloadJsonStr = (
    '{"WBEGTWYIN103" : [ { "DT" : "2020-09-06 23:05:30", "imei" : "862649043469932", "inverters" : [ { "slave_id" : 1, "device_type" : "INVERTER_HAVELS_40KW", "device_category" : "inverter", "device_id" : "DLT001", "total_acp" : 0, "react_power" : 0, "today_energy" : 0, "today_runt" : 0, "total_energy" : 0, "total_runt" : 0, "op_state" : 0, "ac_volt" : [ 0, 0, 0 ], "ac_cur" : [ 0, 0, 0 ], "ac_freq" : [ 0, null, null ], "ac_power" : [ null, null, null ], "dc_volt" : [ 0, 0 ], "dc_cur" : [ 0, 0 ], "dc_power" : [ 0, 0 ] } ], "wst" : [ { "slave_id" : 31, "device_type" : "WST_RTD_RS485", "device_category" : "WST", "device_id" : "WST001", "module_temp" : 0 }, { "slave_id" : 51, "device_type" : "WST_IRRADIATION_RS485", "device_category" : "WST", "device_id" : "WST002", "irradiation" : 0 } ] } ] }'
    )
payloadJson = json.loads(payloadJsonStr)
payload = (
    '{"WBEGTWYIN066":[{"DT":"2020-11-12 12:35:00","imei":"862649044417898","inverters":[{"ac_cur":["16.30","16.10","16.40"],"ac_freq":["49.97","49.97","49.97"],"ac_power":[0,0,0],"ac_volt":["244.40","246.30","243.00"],"app_power":"11.53","dc_cur":["18.40",0,0,0],"dc_power":["12.29",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT001","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":1,"today_energy":"578.00","today_runt":0,"total_acp":"11.53","total_dcp":0,"total_energy":"580.00"},{"ac_cur":["17.50","17.30","17.70"],"ac_freq":["49.96","49.96","49.96"],"ac_power":[0,0,0],"ac_volt":["244.40","246.50","243.20"],"app_power":"12.47","dc_cur":["19.40",0,0,0],"dc_power":["12.84",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT002","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":2,"today_energy":"638.00","today_runt":0,"total_acp":"12.47","total_dcp":0,"total_energy":"638.00"},{"ac_cur":["18.00","17.90","18.20"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["243.80","245.90","242.20"],"app_power":"12.84","dc_cur":["19.60",0,0,0],"dc_power":["13.39",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT003","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":3,"today_energy":"628.00","today_runt":0,"total_acp":"12.83","total_dcp":0,"total_energy":"628.00"},{"ac_cur":["17.20","17.10","17.40"],"ac_freq":["49.98","49.98","49.98"],"ac_power":[0,0,0],"ac_volt":["243.10","245.50","242.10"],"app_power":"12.24","dc_cur":["19.10",0,0,0],"dc_power":["12.88",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT004","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":4,"today_energy":"633.00","today_runt":0,"total_acp":"12.24","total_dcp":0,"total_energy":"633.00"},{"ac_cur":["17.50","17.40","17.70"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["244.20","245.30","242.70"],"app_power":"12.49","dc_cur":["19.60",0,0,0],"dc_power":["13.26",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT005","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":5,"today_energy":"646.00","today_runt":0,"total_acp":"12.51","total_dcp":0,"total_energy":"646.00"}],"wst":[{"device_category":"WST","device_id":"WST001","device_type":"WST_STM8_RS485","irradiation":199,"module_temp":"28.89"}]}]}'
    )
payloadJson = json.loads(payload)
print(json.dumps(slrProc.populateTodayEnergyJson(payloadJson)))

import PayloadProcessor
import simplejson as json
slrProc = PayloadProcessor.SolarInverterProcessor()
wstProc = PayloadProcessor.WSTSensorProcessor()
payload = (
    "<GATEWAY_ID V='WBEGTWYIN008'><DT V='2019-12-24 22:05:00'><SINV id='DLT04' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.86'/><COSFi V='644.86'/><PF V='64486'/><WattH_T V='588.00'/><RunT_T V='9.69'/><WattH V='2279.14'/><RunT V='2027.66'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.60'/><DCA V='499.60'/><DVW V='286.02'/></MDCIP><MDCIP V='2'><DCV V='786.80'/><DCA V='461.40'/><DVW V='223.02'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.20'/><ACA V='58.07'/><ACW V='14.60'/><FRQ V='51.55'/></MACOP><MACOP V='2'><ACV V='267.20'/><ACA V='58.15'/><ACW V='14.54'/><FRQ V='51.55'/></MACOP><MACOP V='3'><ACV V='260.90'/><ACA V='58.10'/><ACW V='14.43'/><FRQ V='51.55'/></MACOP><alarms></alarms></SINV><SINV id='DLT05' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.90'/><COSFi V='644.90'/><PF V='64490'/><WattH_T V='685.00'/><RunT_T V='9.71'/><WattH V='3086.36'/><RunT V='2038.19'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.90'/><DCA V='500.20'/><DVW V='328.83'/></MDCIP><MDCIP V='2'><DCV V='787.20'/><DCA V='500.40'/><DVW V='282.47'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.90'/><ACA V='72.59'/><ACW V='18.53'/><FRQ V='51.54'/></MACOP><MACOP V='2'><ACV V='268.50'/><ACA V='72.77'/><ACW V='18.40'/><FRQ V='51.54'/></MACOP><MACOP V='3'><ACV V='261.50'/><ACA V='73.00'/><ACW V='18.30'/><FRQ V='51.54'/></MACOP><alarms></alarms></SINV><SINV id='DLT06' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.96'/><COSFi V='644.96'/><PF V='64496'/><WattH_T V='598.00'/><RunT_T V='9.69'/><WattH V='2452.63'/><RunT V='1831.44'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='775.60'/><DCA V='500.50'/><DVW V='308.58'/></MDCIP><MDCIP V='2'><DCV V='775.50'/><DCA V='500.30'/><DVW V='281.79'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.60'/><ACA V='72.20'/><ACW V='18.53'/><FRQ V='51.53'/></MACOP><MACOP V='2'><ACV V='268.90'/><ACA V='72.05'/><ACW V='18.35'/><FRQ V='51.53'/></MACOP><MACOP V='3'><ACV V='262.50'/><ACA V='72.51'/><ACW V='18.27'/><FRQ V='51.53'/></MACOP><alarms></alarms></SINV><SINV id='DLT07' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0.00'/><COSFi V='0.00'/><PF V='0'/><WattH_T V='358.00'/><RunT_T V='9.61'/><WattH V='1488.02'/><RunT V='1999.80'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='710.90'/><DCA V='299.90'/><DVW V='169.54'/></MDCIP><MDCIP V='2'><DCV V='710.10'/><DCA V='298.60'/><DVW V='144.13'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.80'/><ACA V='37.54'/><ACW V='9.61'/><FRQ V='51.56'/></MACOP><MACOP V='2'><ACV V='269.20'/><ACA V='37.66'/><ACW V='9.55'/><FRQ V='51.56'/></MACOP><MACOP V='3'><ACV V='262.60'/><ACA V='37.40'/><ACW V='9.39'/><FRQ V='51.56'/></MACOP><alarms></alarms></SINV><SINV id='DLT08' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0'/><COSFi V='0'/><PF V='0'/><WattH_T V='114.00'/><RunT_T V='8.83'/><WattH V='575.33'/><RunT V='1792.04'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='675.20'/><DCA V='221.70'/><DVW V='123.14'/></MDCIP><MDCIP V='2'><DCV V='675.60'/><DCA V='220.90'/><DVW V='91.39'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='256.90'/><ACA V='25.44'/><ACW V='6.04'/><FRQ V='51.51'/></MACOP><MACOP V='2'><ACV V='317.00'/><ACA V='25.35'/><ACW V='6.35'/><FRQ V='51.51'/></MACOP><MACOP V='3'><ACV V='287.80'/><ACA V='25.37'/><ACW V='5.93'/><FRQ V='51.51'/></MACOP><alarms></alarms></SINV><WST id='WST001' type='WST_RTD_RS485'><WSNSR V='8.79'/></WST><WST id='WST002' type='WST_IRRADIATION_RS485'><ANLG1 V='0'/></WST></DT></GATEWAY_ID>"
    )
payloadJsonStr = (
    '{"WBEGTWYIN103" : [ { "DT" : "2020-09-06 23:05:30", "imei" : "862649043469932", "inverters" : [ { "slave_id" : 1, "device_type" : "INVERTER_HAVELS_40KW", "device_category" : "inverter", "device_id" : "DLT001", "total_acp" : 0, "react_power" : 0, "today_energy" : 0, "today_runt" : 0, "total_energy" : 0, "total_runt" : 0, "op_state" : 0, "ac_volt" : [ 0, 0, 0 ], "ac_cur" : [ 0, 0, 0 ], "ac_freq" : [ 0, null, null ], "ac_power" : [ null, null, null ], "dc_volt" : [ 0, 0 ], "dc_cur" : [ 0, 0 ], "dc_power" : [ 0, 0 ] } ], "wst" : [ { "slave_id" : 31, "device_type" : "WST_RTD_RS485", "device_category" : "WST", "device_id" : "WST001", "module_temp" : 0 }, { "slave_id" : 51, "device_type" : "WST_IRRADIATION_RS485", "device_category" : "WST", "device_id" : "WST002", "irradiation" : 0 } ] } ] }'
    )
payloadJson = json.loads(payloadJsonStr)
payload = (
    '{"WBEGTWYIN066":[{"DT":"2020-11-12 12:35:00","imei":"862649044417898","inverters":[{"ac_cur":["16.30","16.10","16.40"],"ac_freq":["49.97","49.97","49.97"],"ac_power":[0,0,0],"ac_volt":["244.40","246.30","243.00"],"app_power":"11.53","dc_cur":["18.40",0,0,0],"dc_power":["12.29",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT001","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":1,"today_energy":"578.00","today_runt":0,"total_acp":"11.53","total_dcp":0,"total_energy":"580.00"},{"ac_cur":["17.50","17.30","17.70"],"ac_freq":["49.96","49.96","49.96"],"ac_power":[0,0,0],"ac_volt":["244.40","246.50","243.20"],"app_power":"12.47","dc_cur":["19.40",0,0,0],"dc_power":["12.84",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT002","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":2,"today_energy":"638.00","today_runt":0,"total_acp":"12.47","total_dcp":0,"total_energy":"638.00"},{"ac_cur":["18.00","17.90","18.20"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["243.80","245.90","242.20"],"app_power":"12.84","dc_cur":["19.60",0,0,0],"dc_power":["13.39",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT003","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":3,"today_energy":"628.00","today_runt":0,"total_acp":"12.83","total_dcp":0,"total_energy":"628.00"},{"ac_cur":["17.20","17.10","17.40"],"ac_freq":["49.98","49.98","49.98"],"ac_power":[0,0,0],"ac_volt":["243.10","245.50","242.10"],"app_power":"12.24","dc_cur":["19.10",0,0,0],"dc_power":["12.88",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT004","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":4,"today_energy":"633.00","today_runt":0,"total_acp":"12.24","total_dcp":0,"total_energy":"633.00"},{"ac_cur":["17.50","17.40","17.70"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["244.20","245.30","242.70"],"app_power":"12.49","dc_cur":["19.60",0,0,0],"dc_power":["13.26",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT005","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":5,"today_energy":"646.00","today_runt":0,"total_acp":"12.51","total_dcp":0,"total_energy":"646.00"}],"wst":[{"device_category":"WST","device_id":"WST001","device_type":"WST_STM8_RS485","irradiation":199,"module_temp":"28.89"}]}]}'
    )
payloadJson = json.loads(payload)
print(json.dumps(slrProc.populateTodayEnergyJson(payloadJson)))

#!/usr/bin/env python

import PayloadProcessor
import simplejson as json

slrProc = PayloadProcessor.SolarInverterProcessor()

wstProc = PayloadProcessor.WSTSensorProcessor()

payload = "<GATEWAY_ID V='WBEGTWYIN008'><DT V='2019-12-24 22:05:00'><SINV id='DLT04' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.86'/><COSFi V='644.86'/><PF V='64486'/><WattH_T V='588.00'/><RunT_T V='9.69'/><WattH V='2279.14'/><RunT V='2027.66'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.60'/><DCA V='499.60'/><DVW V='286.02'/></MDCIP><MDCIP V='2'><DCV V='786.80'/><DCA V='461.40'/><DVW V='223.02'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.20'/><ACA V='58.07'/><ACW V='14.60'/><FRQ V='51.55'/></MACOP><MACOP V='2'><ACV V='267.20'/><ACA V='58.15'/><ACW V='14.54'/><FRQ V='51.55'/></MACOP><MACOP V='3'><ACV V='260.90'/><ACA V='58.10'/><ACW V='14.43'/><FRQ V='51.55'/></MACOP><alarms></alarms></SINV><SINV id='DLT05' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.90'/><COSFi V='644.90'/><PF V='64490'/><WattH_T V='685.00'/><RunT_T V='9.71'/><WattH V='3086.36'/><RunT V='2038.19'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='786.90'/><DCA V='500.20'/><DVW V='328.83'/></MDCIP><MDCIP V='2'><DCV V='787.20'/><DCA V='500.40'/><DVW V='282.47'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='262.90'/><ACA V='72.59'/><ACW V='18.53'/><FRQ V='51.54'/></MACOP><MACOP V='2'><ACV V='268.50'/><ACA V='72.77'/><ACW V='18.40'/><FRQ V='51.54'/></MACOP><MACOP V='3'><ACV V='261.50'/><ACA V='73.00'/><ACW V='18.30'/><FRQ V='51.54'/></MACOP><alarms></alarms></SINV><SINV id='DLT06' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='644.96'/><COSFi V='644.96'/><PF V='64496'/><WattH_T V='598.00'/><RunT_T V='9.69'/><WattH V='2452.63'/><RunT V='1831.44'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='775.60'/><DCA V='500.50'/><DVW V='308.58'/></MDCIP><MDCIP V='2'><DCV V='775.50'/><DCA V='500.30'/><DVW V='281.79'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.60'/><ACA V='72.20'/><ACW V='18.53'/><FRQ V='51.53'/></MACOP><MACOP V='2'><ACV V='268.90'/><ACA V='72.05'/><ACW V='18.35'/><FRQ V='51.53'/></MACOP><MACOP V='3'><ACV V='262.50'/><ACA V='72.51'/><ACW V='18.27'/><FRQ V='51.53'/></MACOP><alarms></alarms></SINV><SINV id='DLT07' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0.00'/><COSFi V='0.00'/><PF V='0'/><WattH_T V='358.00'/><RunT_T V='9.61'/><WattH V='1488.02'/><RunT V='1999.80'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='710.90'/><DCA V='299.90'/><DVW V='169.54'/></MDCIP><MDCIP V='2'><DCV V='710.10'/><DCA V='298.60'/><DVW V='144.13'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='263.80'/><ACA V='37.54'/><ACW V='9.61'/><FRQ V='51.56'/></MACOP><MACOP V='2'><ACV V='269.20'/><ACA V='37.66'/><ACW V='9.55'/><FRQ V='51.56'/></MACOP><MACOP V='3'><ACV V='262.60'/><ACA V='37.40'/><ACW V='9.39'/><FRQ V='51.56'/></MACOP><alarms></alarms></SINV><SINV id='DLT08' type='INVERTER_DELTA_RPIM3'><IPPWR V='0.00'/><OPPWR V='0.00'/><APP V='0.00'/><APP1 V='0.00'/><APP2 V='0.00'/><APP3 V='0.00'/><RCP V='0'/><COSFi V='0'/><PF V='0'/><WattH_T V='114.00'/><RunT_T V='8.83'/><WattH V='575.33'/><RunT V='1792.04'/><Op_State V='No DC'/><RecTime V='0'/><DCIP V='1'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='2'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><DCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></DCIP><MDCIP V='1'><DCV V='675.20'/><DCA V='221.70'/><DVW V='123.14'/></MDCIP><MDCIP V='2'><DCV V='675.60'/><DCA V='220.90'/><DVW V='91.39'/></MDCIP><MDCIP V='3'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='4'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='5'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><MDCIP V='6'><DCV V='0.00'/><DCA V='0.00'/><DVW V='0.00'/></MDCIP><ACOP V='1'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='2'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><ACOP V='3'><ACV V='0.00'/><ACA V='0.00'/><ACW V='0.00'/><FRQ V='0.00'/></ACOP><MACOP V='1'><ACV V='256.90'/><ACA V='25.44'/><ACW V='6.04'/><FRQ V='51.51'/></MACOP><MACOP V='2'><ACV V='317.00'/><ACA V='25.35'/><ACW V='6.35'/><FRQ V='51.51'/></MACOP><MACOP V='3'><ACV V='287.80'/><ACA V='25.37'/><ACW V='5.93'/><FRQ V='51.51'/></MACOP><alarms></alarms></SINV><WST id='WST001' type='WST_RTD_RS485'><WSNSR V='8.79'/></WST><WST id='WST002' type='WST_IRRADIATION_RS485'><ANLG1 V='0'/></WST></DT></GATEWAY_ID>"
payloadJsonStr = '{"WBEGTWYIN103" : [ { "DT" : "2020-09-06 23:05:30", "imei" : "862649043469932", "inverters" : [ { "slave_id" : 1, "device_type" : "INVERTER_HAVELS_40KW", "device_category" : "inverter", "device_id" : "DLT001", "total_acp" : 0, "react_power" : 0, "today_energy" : 0, "today_runt" : 0, "total_energy" : 0, "total_runt" : 0, "op_state" : 0, "ac_volt" : [ 0, 0, 0 ], "ac_cur" : [ 0, 0, 0 ], "ac_freq" : [ 0, null, null ], "ac_power" : [ null, null, null ], "dc_volt" : [ 0, 0 ], "dc_cur" : [ 0, 0 ], "dc_power" : [ 0, 0 ] } ], "wst" : [ { "slave_id" : 31, "device_type" : "WST_RTD_RS485", "device_category" : "WST", "device_id" : "WST001", "module_temp" : 0 }, { "slave_id" : 51, "device_type" : "WST_IRRADIATION_RS485", "device_category" : "WST", "device_id" : "WST002", "irradiation" : 0 } ] } ] }'
payloadJson = json.loads(payloadJsonStr)
payload = '{"WBEGTWYIN066":[{"DT":"2020-11-12 12:35:00","imei":"862649044417898","inverters":[{"ac_cur":["16.30","16.10","16.40"],"ac_freq":["49.97","49.97","49.97"],"ac_power":[0,0,0],"ac_volt":["244.40","246.30","243.00"],"app_power":"11.53","dc_cur":["18.40",0,0,0],"dc_power":["12.29",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT001","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":1,"today_energy":"578.00","today_runt":0,"total_acp":"11.53","total_dcp":0,"total_energy":"580.00"},{"ac_cur":["17.50","17.30","17.70"],"ac_freq":["49.96","49.96","49.96"],"ac_power":[0,0,0],"ac_volt":["244.40","246.50","243.20"],"app_power":"12.47","dc_cur":["19.40",0,0,0],"dc_power":["12.84",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT002","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":2,"today_energy":"638.00","today_runt":0,"total_acp":"12.47","total_dcp":0,"total_energy":"638.00"},{"ac_cur":["18.00","17.90","18.20"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["243.80","245.90","242.20"],"app_power":"12.84","dc_cur":["19.60",0,0,0],"dc_power":["13.39",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT003","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":3,"today_energy":"628.00","today_runt":0,"total_acp":"12.83","total_dcp":0,"total_energy":"628.00"},{"ac_cur":["17.20","17.10","17.40"],"ac_freq":["49.98","49.98","49.98"],"ac_power":[0,0,0],"ac_volt":["243.10","245.50","242.10"],"app_power":"12.24","dc_cur":["19.10",0,0,0],"dc_power":["12.88",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT004","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":4,"today_energy":"633.00","today_runt":0,"total_acp":"12.24","total_dcp":0,"total_energy":"633.00"},{"ac_cur":["17.50","17.40","17.70"],"ac_freq":["49.94","49.94","49.94"],"ac_power":[0,0,0],"ac_volt":["244.20","245.30","242.70"],"app_power":"12.49","dc_cur":["19.60",0,0,0],"dc_power":["13.26",0,0,0],"dc_volt":["655.35",0,0,0],"device_category":"inverter","device_id":"DLT005","device_type":"INVERTER_ABB_100KW","op_state":"Unknown","pf":"1.00","react_power":"-0.10","slave_id":5,"today_energy":"646.00","today_runt":0,"total_acp":"12.51","total_dcp":0,"total_energy":"646.00"}],"wst":[{"device_category":"WST","device_id":"WST001","device_type":"WST_STM8_RS485","irradiation":199,"module_temp":"28.89"}]}]}'
payloadJson = json.loads(payload)

print(json.dumps(slrProc.populateTodayEnergyJson( payloadJson )))

#print(slrProc.populateTodayEnergy( payload ).decode('utf-8')+'\n')

#print(wstProc.mergeWstJson(payloadJson))
