Skip to content

Commit

Permalink
v0.0.24 - added deviceRaw()
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Sep 6, 2020
1 parent 2f9a28f commit 9691f75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ For a helpful video walk-through of getting the KEYS you can also watch this gre
```python
(on, w, mA, V, err) = tuyapower.deviceInfo(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
```
* deviceRaw - Poll device and return raw response data.
```python
rawData = tuyapower.deviceRaw(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
```
* devicePrint - Poll device and print formatted output to stdout.
```python
tuyapower.devicePrint(PLUGID, PLUGIP, PLUGKEY, PLUGVERS)
Expand Down Expand Up @@ -90,6 +94,7 @@ For a helpful video walk-through of getting the KEYS you can also watch this gre
* mA = milliamps
* V = Voltage
* err = Error message or OK
* rawData = Raw response from device
* devices = Dictionary of all devices found with power data if available

Note: If error occurs, on will be set to false, w, mA and V will be set to -99.0.
Expand Down
6 changes: 4 additions & 2 deletions tuyapower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Functions and Usage
(on, w, mA, V, err) = tuyapower.deviceInfo(id, ip, key, vers)
rawData = tuyapower.deviceRaw(id, ip, key, vers)
tuyapower.devicePrint(id, ip, key, vers)
dataJSON = tuyapower.deviceJSON(id, ip, key, vers)
devices = deviceScan(verbose, port)
Expand All @@ -27,6 +28,7 @@
mA = milliamps
V = Voltage (-99 if error or not supported)
err = Error message or OK
rawData = Raw response from device
devices = Dictionary of all devices found with power data if available
"""
from __future__ import print_function # python 2.7 support
Expand Down Expand Up @@ -185,7 +187,7 @@ def deviceInfo(deviceid, ip, key, vers):
# (dps) = tuyapower.deviceInfo(id, ip, key, vers)
def deviceRaw(deviceid, ip, key, vers):
"""Poll Device for Status - raw DPS response
(dps) = tuyapower.deviceInfo(id, ip, key, vers)
rawData = tuyapower.deviceRaw(id, ip, key, vers)
Parameters :
id = Device ID e.g. 01234567891234567890
Expand All @@ -194,7 +196,7 @@ def deviceRaw(deviceid, ip, key, vers):
vers = Version of Protocol 3.1 or 3.3
Response :
dps = raw dps response
rawData = Data response from device
"""
watchdog = 0
while True:
Expand Down

0 comments on commit 9691f75

Please sign in to comment.