There is a simple way, from what I know, to just grab it via python. I grabbed a large project off of the internet and skimmed it down to something simple. Make sure you have python. Make a new file. Paste these contents:
import sys
import urllib.parse
import urllib.request
import random
command = sys.argv[1]
postData = {'request': 'create_chklst'}
postData = urllib.parse.urlencode(postData).encode("ascii")
req = urllib.request.Request("http://{ip}/common/info.cgi?{rand}".format(ip='10.0.0.20', rand=str(random.random())), data=postData)
response = urllib.request.urlopen(req)
ret = response.read().decode("utf-8")
ret = ret.strip()
lines = ret.split("\n")
retVal = None
for line in lines:
if line.startswith("Meter Watt:"):
power = line.split()[-1]
if retVal:
raise ValueError("Two power readings in one response?")
try:
retVal = float(power)
except ValueError:
print("Error on string '%s'" % line)
print("Watts: %s" % retVal);
then run it via python3.
I wanted to mention that this script worked for me with DSP W215 HW ver A1 firmware 1.24. There is a new HW version B1, I am not sure if this would work with that HW version (I don't believe so since B1 requires a password on scripts to run). I can confirm that my A1 unit doesn't work with scripts for B1 HW version, so they dont see to be backward/forward compatible.
As far as making it run, I don't know python so I had to figure out a couple of things:
1. It needs a parameter when you invoke the script. I don't know whether the parameter is important but it won't run without it. So I run python.exe wattlog.py anytexthere
2. You need to update your smart plug ip address inside (rigth now there is an ip address like 10.x.x.x). I only changed it one place.
3. There is no need to enter the device pin code inside the script (kind of bad if you think about security)
4. (optional) You can call python script inside a DOS bat file if you want to cycle through it and maybe put the output inside a log.txt file. Alternatively, if you know python I am sure you can cycle inside the scrypt.