Skip to content

Commit

Permalink
0.1.3
Browse files Browse the repository at this point in the history
Minor fixes for calculation to keep inline with reported results (when available)
Negative for NetConsumption indicates exporting power
Update Storage state if no Data versus offline
  • Loading branch information
ghawken committed Jan 17, 2017
1 parent 3331e35 commit 29c8859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion EnphaseEnvoy.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>0.1.2</string>
<string>0.1.3</string>
<key>ServerApiVersion</key>
<string>1.0.0</string>
<key>IwsApiVersion</key>
Expand Down
7 changes: 6 additions & 1 deletion EnphaseEnvoy.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ def parseStateValues(self, dev):
The parseStateValues() method walks through the dict and assigns the
corresponding value to each device state.
"""

#testdata = {u'production': [{u'activeCount': 32, u'wNow': 303, u'readingTime': 1484494980, u'type': u'inverters', u'whLifetime': 1799748.9794444444}, {u'whToday': 137.262, u'pwrFactor': 0.53, u'readingTime': 1484494980, u'activeCount': 1, u'rmsVoltage': 248.215, u'reactPwr': 490.766, u'whLifetime': 1321326.262, u'apprntPwr': 596.966, u'wNow': 316.044, u'type': u'eim', u'whLastSevenDays': 116064.262, u'rmsCurrent': 4.81}], u'consumption': [{u'varhLagLifetime': 913691.045, u'rmsVoltage': 248.132, u'pwrFactor': 0.35, u'whToday': 6075.567, u'vahToday': 8331.054, u'varhLeadLifetime': 912659.572, u'varhLeadToday': 4580.572, u'readingTime': 1484494980, u'activeCount': 1, u'varhLagToday': 4093.045, u'vahLifetime': 2530344.054, u'reactPwr': 402.82, u'whLifetime': 1756854.567, u'apprntPwr': 3780.981, u'wNow': 1337.481, u'type': u'eim', u'whLastSevenDays': 161357.567, u'rmsCurrent': 15.238}]}
#self.finalDict = testdata

if self.debugLevel >= 2:
self.debugLog(u"Saving Values method called.")

Expand Down Expand Up @@ -572,7 +576,7 @@ def parseStateValues(self, dev):
self.debugLog(u'No netConsumption being reporting.....Calculating....')
# Calculate?
#
netConsumption = int(self.finalDict['production'][1]['wNow']) - int (self.finalDict['consumption'][0]['wNow'])
netConsumption = int(self.finalDict['consumption'][0]['wNow']) - int(self.finalDict['production'][1]['wNow'])
dev.updateStateOnServer('netConsumptionWattsNow', value=int(netConsumption))
else:
if self.debugLevel >= 2:
Expand All @@ -587,6 +591,7 @@ def parseStateValues(self, dev):
else:
if self.debugLevel >= 2:
self.debugLog(u"no Storage result found.")
dev.updateStateOnServer('storageState', value='No Data')

update_time = t.strftime("%m/%d/%Y at %H:%M")
dev.updateStateOnServer('deviceLastUpdated', value=update_time)
Expand Down

0 comments on commit 29c8859

Please sign in to comment.