Open lemoustachiste opened 2 years ago
checking with the tplink app, it seems my assumptions are correct for time and energy, and current power looks like it is in mW (milliwatt)
Energy seems to be in Wh, so Wh/1000.0 -> kWh
heres my test script with the units formatted (at least as i like them)
import json
import datetime
import base64
plugips = ["10.0.0.64", "10.0.0.65"]
username = "xxxxxxxxx@gmail.com"
password = "xxxxxxx"
for x in plugips:
from PyP100 import PyP110
p110 = PyP110.P110(x, username, password)
p110.handshake()
p110.login()
returnedData = p110.getDeviceInfo()
nickname = base64.b64decode(returnedData['result']['nickname'])
nicknameDecoded = nickname.decode("utf-8")
print ("Plug Name:", nicknameDecoded)
print ("Device IP:", returnedData['result']['ip'])
print ("Device On:", returnedData['result']['device_on'])
print ("Device Model:", returnedData['result']['model'])
print ("Firmware Ver:", returnedData['result']['fw_ver'])
print ("Device ID:", returnedData['result']['device_id'])
print ("MAC:", returnedData['result']['mac'])
print ("Device On Time:", (datetime.timedelta(seconds=(returnedData['result']['on_time']))))
print ("Device Overheated:", returnedData['result']['overheated'])
print ("Power Protection:", returnedData['result']['power_protection_status'])
print ("RSSI:", returnedData['result']['rssi'])
print ("Signal Level:", returnedData['result']['signal_level'])
print (" ")
returnedData = p110.getEnergyUsage()
print("Current Stats:")
todayRuntime = round((returnedData['result']['today_runtime'] / 60), 1)
print ("Hours:", todayRuntime)
todayEnergy = round ((returnedData['result']['today_energy'] / 1000), 2)
print ("kWh:", todayEnergy)
currentPower = round((returnedData['result']['current_power'] / 1000))
print ("Watts:", currentPower)
print (" ")
so I'm getting this object back:
I couldn't find what are the units associated with these values.
runtime
would be in Minute?energy
in Watt? What aboutcurrent_power
?Thanks