npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@iampravikant/tuya-cloud-sdk-nodejs

v1.1.2

Published

NodeJS SDK to access Tuya cloud

Downloads

59

Readme

Tuya Cloud SDK - NodeJS

npm version

Access Tuya supported devices via this SDK

Installation

npm i @iampravikant/tuya-cloud-sdk-nodejs

Prerequisite

  • Login into your Tuya account (If you don't have an account yet, Sign up)
  • Goto Cloud and create a new project. Make sure your select the correct region and make a note of it (You will need while initialising the SDK).
  • Once created, open it and go to Overview tab.
  • Make a note of Access ID and Access Secret (You will need while initialising the SDK).
  • Open Devices tab and link your app account. Click on "Link your app account" and once the QR code opens, scan it from your app (example: SmartLife). (In SmartLife app, there is a button on top right to scan QR code.)
  • Now you should see your app account added. Make a node of the UID. This is be your User ID (You will need while initialising the SDK).

Usage

Initial configuration

import { TuyaConfig, TuyaRegion, TuyaClient } from '@iampravikant/tuya-cloud-sdk-nodejs';

TuyaConfig.init('YOUR_ACCESS_ID_FROM_TUYA', 'YOUR_ACCESS_SECRET_FROM_TUYA', 'YOUR_REGION_FROM_TUYA', 'YOUR_USER_ID_FROM_TUYA');

Example:

TuyaConfig.init('...', '...', TuyaRegion.EU, 'eu...');

Home

Get homes

TuyaClient.Home.getHomes();

Get home

TuyaClient.Home.getHome(homeId);

Delete home

TuyaClient.Home.deleteHome(homeId);

Room

Get rooms in a home

TuyaClient.Room.getRooms(homeId);

Create a room in a home

TuyaClient.Room.createRoom(homeId, roomnName);

Delete rooms in a home

TuyaClient.Room.deleteRoom(homeId, roomId);

Device

Get devices in a home

TuyaClient.Device.getDevices(homeId);

Control device

Get the switch status of a device

TuyaClient.Device.getDeviceSwitch(deviceId);

Set the switch status of a device

TuyaClient.Device.setDeviceSwitch(deviceId, on);

Finally

  • Feel free to open an issue.
  • Star the repo if you found it useful 😀