Skip to content

Commit 2f9a28f

Browse files
committed
Added raw device response
1 parent 98c9f62 commit 2f9a28f

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,5 @@ upload.sh
108108
test.sh
109109
.vscode/
110110
sandbox/
111-
.DS_Store
111+
.DS_Store
112+
jason.py

plugpower.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
print("Usage: %s <PLUGID> <PLUGIP> <PLUGKEY> <PLUGVERS>\n" % sys.argv[0])
1818
print(" Required: <PLUGID> is the Device ID e.g. 01234567891234567890")
1919
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")
2222
print(" Note: You may also send values via Environmental variables: ")
2323
print(" PLUGID, PLUGIP, PLUGKEY, PLUGVERS\n")
2424
exit()
@@ -36,7 +36,9 @@
3636
now = datetime.datetime.utcnow()
3737
iso_time = now.strftime("%Y-%m-%dT%H:%M:%SZ")
3838

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
4042
(on, w, mA, V, err) = tuyapower.deviceInfo(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
4143

4244
# Check for error
@@ -51,6 +53,7 @@
5153
# Print Output
5254
print("TuyaPower (Tuya Power Stats) [%s] %s [%s]"%(tuyapower.__version__,tuyapower.api,tuyapower.api_ver))
5355
print("\nDevice %s at %s key %s protocol %s:" % (PLUGID,PLUGIP,PLUGKEY,PLUGVERS))
56+
print(" Response Data: %s" % raw)
5457
print(" Switch On: %r" % on)
5558
print(" Power (W): %f" % w)
5659
print(" Current (mA): %f" % mA)

test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
now = datetime.datetime.utcnow()
3737
iso_time = now.strftime("%Y-%m-%dT%H:%M:%SZ")
3838

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
4042
(on, w, mA, V, err) = tuyapower.deviceInfo(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
4143

4244
# Check for error
@@ -51,6 +53,7 @@
5153
# Print Output
5254
print("TuyaPower (Tuya Power Stats) [%s] %s [%s]"%(tuyapower.__version__,tuyapower.api,tuyapower.api_ver))
5355
print("\nDevice %s at %s key %s protocol %s:" % (PLUGID,PLUGIP,PLUGKEY,PLUGVERS))
56+
print(" Response Data: %s" % raw)
5457
print(" Switch On: %r" % on)
5558
print(" Power (W): %f" % w)
5659
print(" Current (mA): %f" % mA)

0 commit comments

Comments
 (0)