@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.
Files changed (2) hide show
  1. package/README.md +38 -0
  2. package/package.json +9 -4
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @open-tuya/devices
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@open-tuya/devices)](https://www.npmjs.com/package/@open-tuya/devices)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@open-tuya/devices)](https://www.npmjs.com/package/@open-tuya/devices)
5
+ [![CI](https://github.com/cheziyi/open-tuya/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cheziyi/open-tuya/actions/workflows/ci.yml?query=branch%3Amain)
6
+ [![Catalog import](https://img.shields.io/github/actions/workflow/status/cheziyi/open-tuya/import-catalog.yml?branch=main&label=catalog%20import)](https://github.com/cheziyi/open-tuya/actions/workflows/import-catalog.yml)
7
+ [![Node version](https://img.shields.io/node/v/@open-tuya/devices)](package.json)
8
+ [![Types](https://img.shields.io/badge/types-TypeScript-blue)](package.json)
9
+ [![License](https://img.shields.io/npm/l/@open-tuya/devices)](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",
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.0"
36
+ "@open-tuya/core": "^0.1.1"
32
37
  },
33
38
  "engines": {
34
39
  "node": ">=22.12.0"