That's great news on identifying the reason for the kWh issue.
Here's another observation, this ones just as odd as my others. I'm polling the two (2) ZBPCMs every minute and then writing lastChanged, curEnergyLevel and accumEnergyTotal for each unit to two seperate CSV files.
originalDevice.csv08/12/15 06:47:05 PM,1119,7.0793
08/12/15 06:48:06 PM,1126,7.0854
08/12/15 06:49:05 PM,1115,19.568308/12/15 06:50:07 PM,1136,7.0975
08/12/15 06:51:05 PM,1125,7.1036
08/12/15 06:52:05 PM,1130,7.1096
20150812 Wednesday, August 12, 2015.csv08/12/15 06:47:03 PM,1122,19.5501
08/12/15 06:48:03 PM,1126,19.5616
08/12/15 06:49:03 PM,1115,19.5683
08/12/15 06:50:04 PM,1136,19.5743
08/12/15 06:51:02 PM,1125,19.5804
08/12/15 06:52:02 PM,1125,7.1036Notice the highlighted readings at 6:49p and 6:52p, those values are from the other ZBPCM.
The code I'm using is pretty straight forward. I have a schedule running every minute, which calls an Action Group named Write PowerCost Monitor Data. That Action Group executes two separate embedded python scripts, each script writes to a separate CSV file, one for each ZBPCM.
This is code from one of the embedded scripts.
- Code: Select all
import time
import datetime
theDevice = indigo.devices[34336396] # "PowerCost Monitor"
curEnergyLevel = int(indigo.devices[theDevice].states['curEnergyLevel'])
accumEnergyTotal = indigo.devices[theDevice].states['accumEnergyTotal']
if curEnergyLevel != 0 and accumEnergyTotal != 0:
lastChanged = str(indigo.devices[theDevice].lastChanged)
lastChangedDate = datetime.datetime.strptime(lastChanged, '%Y-%m-%d %H:%M:%S')
Usage_Date = lastChangedDate.strftime("%m/%d/%y %I:%M:%S %p")
# Write status to file
# Define the appropriate directory
theDir = "/Users/Anyone/Documents/PowerCost Monitor Data/byMinute/"
# format the file to write
theFile = theDir + "originalDevice.csv"
# Format the data to write to file
# theData = ("%s,%s,%s\n" % (Usage_Date,curEnergyLevel,accumEnergyTotal))
# Open the ouptput file for appending, write and close
fo = open(theFile, "a")
fo.write( ("%s,%s,%s\n" % (Usage_Date,curEnergyLevel,accumEnergyTotal)) );
fo.close()
I did notice around this time, not exactly at these times, some read errors; 'failed to read imeter data (calculated crc: ####, received crc: ####)'. Nothing else unusual.
Any thoughts on why I'd see a reading for the other ZBPCM?