|
17 | 17 | print("Usage: %s <PLUGID> <PLUGIP> <PLUGKEY> <PLUGVERS>\n" % sys.argv[0])
|
18 | 18 | print(" Required: <PLUGID> is the Device ID e.g. 01234567891234567890")
|
19 | 19 | print(" <PLUGIP> is the IP address of the smart plug e.g. 10.0.1.99")
|
20 |
| - print(" Optional: <PLUGKEY> is the Device Keyy (default 0123456789abcdef)") |
21 |
| - print(" <PLUGVERS> is the Firmware Version 3.1 (defualt) or 3.3\n") |
| 20 | + print(" Optional: <PLUGKEY> is the Device Key (default 0123456789abcdef)") |
| 21 | + print(" <PLUGVERS> is the Firmware Version 3.1 (default) or 3.3\n") |
22 | 22 | print(" Note: You may also send values via Environmental variables: ")
|
23 | 23 | print(" PLUGID, PLUGIP, PLUGKEY, PLUGVERS\n")
|
24 | 24 | exit()
|
|
36 | 36 | now = datetime.datetime.utcnow()
|
37 | 37 | iso_time = now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
38 | 38 |
|
39 |
| -# Poll Smart Swich for Power Data |
| 39 | +# Poll Smart Device for Raw Data |
| 40 | +(raw) = tuyapower.deviceRaw(PLUGID, PLUGIP, PLUGKEY, PLUGVERS) |
| 41 | +# Poll Smart Switch for Power Data |
40 | 42 | (on, w, mA, V, err) = tuyapower.deviceInfo(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
|
41 | 43 |
|
42 | 44 | # Check for error
|
|
51 | 53 | # Print Output
|
52 | 54 | print("TuyaPower (Tuya Power Stats) [%s] %s [%s]"%(tuyapower.__version__,tuyapower.api,tuyapower.api_ver))
|
53 | 55 | print("\nDevice %s at %s key %s protocol %s:" % (PLUGID,PLUGIP,PLUGKEY,PLUGVERS))
|
| 56 | +print(" Response Data: %s" % raw) |
54 | 57 | print(" Switch On: %r" % on)
|
55 | 58 | print(" Power (W): %f" % w)
|
56 | 59 | print(" Current (mA): %f" % mA)
|
|
0 commit comments