You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/API.md
+16-25Lines changed: 16 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,9 @@ Docs
5
5
### Table of Contents
6
6
7
7
-[TuyaDevice](#tuyadevice)
8
-
-[getStatus](#getstatus)
9
-
-[setStatus](#setstatus)
10
-
-[getSchema](#getschema)
11
-
-[discoverDevices](#discoverdevices)
8
+
-[resolveIds](#resolveids)
9
+
-[get](#get)
10
+
-[set](#set)
12
11
-[\_extractJSON](#_extractjson)
13
12
14
13
## TuyaDevice
@@ -26,41 +25,33 @@ Represents a Tuya device.
26
25
-`options.key`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** encryption key of device
27
26
-`options.version`**[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** protocol version (optional, default `3.1`)
28
27
29
-
### getStatus
28
+
### resolveIds
30
29
31
-
Gets the device's current status.
30
+
Resolves IDs stored in class to IPs.
31
+
32
+
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true if IPs were found and devices are ready to be used
33
+
34
+
### get
35
+
36
+
Gets the device's current status. Defaults to returning only the first 'dps', but by setting {schema: true} you can get everything.
32
37
33
38
**Parameters**
34
39
40
+
-`options`
41
+
-`ID`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** optional, ID of device. Defaults to first device.
-`on`**[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)**`true` for on, `false` for off
52
+
{id, set: true|false, dps:1}
44
53
-`callback`**function ([error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error), result)** returns `true` if the command succeeded
45
54
46
-
### getSchema
47
-
48
-
Gets control schema from device.
49
-
50
-
Returns **[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** schema - object of parsed JSON
51
-
52
-
### discoverDevices
53
-
54
-
Attempts to autodiscover devices (i.e. translate device ID to IP).
55
-
56
-
**Parameters**
57
-
58
-
-`ids`
59
-
-`callback`
60
-
-`IDs`**[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** can be a single ID or an array of IDs
0 commit comments