/tuya-openapi-node

NodeJS interface for Tuya IoT devices through the Tuya OpenAPI

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Tuya IoT Core API (NodeJS)

Get Tuya API key & secret

Usage

Standalone
  • install modules with npm install
  • create a .env file (see .env.example)
  • run tests with npm test

TODO:

  • link, rename, test & unlink devices
  • implement interactive test script
  • implement pure CLI
  • implement classes for other IoT devices (climate, fan, lock, etc.)

Useful Hints

  • Device online heartbeat timeout is ~5 minutes, so even though online status is registered within ~30 seconds, official offline status is registered within the heartbeat timeout
  • status function values (switch_*, colour_data_*, etc.) have their values updated instantaniously, so they can be used to determine a device's responsiveness
  • Most light bulbs (dj) consume ~30 Watts in white mode, and <~30 Watts in colour mode
  • Power sockets (cz) report down to at least ~32 Watts as measurable power consumption

About

Advanced low-level device communication. Utilizes tuya-connector-nodejs.

See also