This topic is to discuss the ZBPCM - ZigBee/INSTEON Interface to Blue Line Innovations PowerCost™ Monitor.
Device Details
How to use with Indigo
theDevice = indigo.devices[34336396]
accumEnergyTotal = indigo.devices[theDevice].states['accumEnergyTotal']
indigo.server.log("current kWh total: " + str(accumEnergyTotal))
indigo.device.resetEnergyAccumTotal(34336396)
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()
Users browsing this forum: No registered users and 1 guest