@open-tuya/devices 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/package.json +9 -4
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @open-tuya/devices
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@open-tuya/devices)
|
|
4
|
+
[](https://www.npmjs.com/package/@open-tuya/devices)
|
|
5
|
+
[](https://github.com/cheziyi/open-tuya/actions/workflows/ci.yml?query=branch%3Amain)
|
|
6
|
+
[](https://github.com/cheziyi/open-tuya/actions/workflows/import-catalog.yml)
|
|
7
|
+
[](package.json)
|
|
8
|
+
[](package.json)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
Look up what each data point of a Tuya device controls, from a catalog of
|
|
12
|
+
over 1,700 devices converted from [tuya-local](https://github.com/make-all/tuya-local),
|
|
13
|
+
and read and write the device by those names.
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @open-tuya/devices
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { findDeviceEntries, readControls, writeControls } from "@open-tuya/devices";
|
|
21
|
+
|
|
22
|
+
const dataPoints = await client.readDataPoints();
|
|
23
|
+
const [entry] = findDeviceEntries({ productKey, dataPoints });
|
|
24
|
+
readControls(entry, dataPoints);
|
|
25
|
+
// { device: { on: true, voltageInV: 230.5, powerInW: 12.3, timerInSeconds: 0 } }
|
|
26
|
+
await client.writeDataPoints(writeControls(entry, { device: { on: false } }, dataPoints));
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
[The open-tuya README](https://github.com/cheziyi/open-tuya#naming-data-points) says how a control is named
|
|
30
|
+
and what a write can throw. A device the catalog lacks goes to tuya-local
|
|
31
|
+
first: the catalog is imported from it each day.
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
[MIT](LICENSE). Copyright © 2026 the open-tuya contributors.
|
|
36
|
+
|
|
37
|
+
Not affiliated with, authorized, or endorsed by Tuya Inc. Read the
|
|
38
|
+
[legal disclaimer](https://github.com/cheziyi/open-tuya#legal-disclaimer) before use.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tuya/devices",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Catalog of Tuya devices and what each of their data points controls.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tuya",
|
|
@@ -8,10 +8,15 @@
|
|
|
8
8
|
"data-points",
|
|
9
9
|
"device-catalog",
|
|
10
10
|
"home-automation",
|
|
11
|
-
"smart-home"
|
|
11
|
+
"smart-home",
|
|
12
|
+
"tuya-local",
|
|
13
|
+
"tuya-data-points",
|
|
14
|
+
"nodejs",
|
|
15
|
+
"typescript",
|
|
16
|
+
"open-tuya"
|
|
12
17
|
],
|
|
13
18
|
"license": "MIT",
|
|
14
|
-
"homepage": "https://github.com/cheziyi/open-tuya#readme",
|
|
19
|
+
"homepage": "https://github.com/cheziyi/open-tuya/tree/main/packages/devices#readme",
|
|
15
20
|
"bugs": "https://github.com/cheziyi/open-tuya/issues",
|
|
16
21
|
"repository": {
|
|
17
22
|
"type": "git",
|
|
@@ -28,7 +33,7 @@
|
|
|
28
33
|
".": "./dist/index.js"
|
|
29
34
|
},
|
|
30
35
|
"dependencies": {
|
|
31
|
-
"@open-tuya/core": "^0.1.
|
|
36
|
+
"@open-tuya/core": "^0.1.1"
|
|
32
37
|
},
|
|
33
38
|
"engines": {
|
|
34
39
|
"node": ">=22.12.0"
|