Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @tuyapi/homebridge-plugin with all npm packages installed. Try it out:

var homebridgePlugin = require("@tuyapi/homebridge-plugin")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@tuyapi/homebridge-plugin v0.1.2

A Homebridge plugin for Tuya devices

@tuyapi/homebridge-plugin

🏠 Offical Homebridge plugin for TuyAPI.

Installation

npm i @tuyapi/homebridge -g

Example config.json

{
  "platform": "TuyaPlatform",
  "name": "TuyaPlatform",
  "devices": [
    {
      "name": "Tuya Device 1",
      "id": "xxxxxxxxxxxxxxxxxxxx",
      "key": "xxxxxxxxxxxxxxxx"
    },
    {
      "name": "Tuya Device 2",
      "id": "xxxxxxxxxxxxxxxxxxxx",
      "key": "xxxxxxxxxxxxxxxx"
    }
  ]
}

See this page for finding the above parameters.

If you find that the built-in IP auto discovery doesn't work for your network setup, you can pass it in manually like so:

{
  "name": "Tuya Device 1",
  "id": "xxxxxxxxxxxxxxxxxxxx",
  "key": "xxxxxxxxxxxxxxxx",
  "ip": "xxx.xxx.xxx.xxx"
}

For devices with more than one switch (for example, powerstrips), a config would look like this:

"devices": [
  {
    "name": "Power strip main",
    "id": "power-strip-id",
    "key": "power-strip-key",
    "dps": 1
  },
  {
    "name": "Power strip USB",
    "id": "same-power-strip-id",
    "key": "same-power-strip-key",
    "dps": 2
  }
]
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free