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

@nrchkb/node-red-tuya-smart-device

v0.1.0

Published

A node-red module to interact with the tuya smart devices

Downloads

158

Readme

node-red-contrib-tuya-smart-device

This package is based and continues the work of https://github.com/vinodsr/node-red-contrib-tuya-smart-device

npm NPM Build and Publish package License

A node-red module which helps you to connect to any Tuya device.

image

Table of contents

Requirements

  • nodeJS >= 16.0.0
  • node-red >= 2.5.0

Features

  • Controls tuya device
  • Controls multiple device using a single node using generic node (hub node)
  • Can use device IP for communication
  • Configure retry and find intervals
  • Ability to set up Tuya Protocol Version
  • Ability to listen to both Data and DP-Refresh event
  • Can store deviceId and deviceKey as credentials
  • Better error handling
  • Better log handling

Getting Started

Instructions for getting the device id is available here

Another technique for getting all deviceid linked to your tuya account

https://github-wiki-see.page/m/iRayanKhan/homebridge-tuya/wiki/Get-Local-Keys-for-your-devices

You will get the device id and the key once you run the wizard program as per the instructions

Get more details about latest version changes in the CHANGELOG.md

Setup

(Back to top)

The node takes one input and one output. Once you drop the node into the flow, you need to use the deviceid and devicekey that you got from the getting started step.

Once you set up the node, you can then use input to send any command to the device as per the tuya standards.

Input Format

(Back to top)

image

Output Format

(Back to top)

image

If you need the error thrown by the node use the catch node.

The status output sends the state of the client (CONNECTING,CONNECTED,ERROR or DISCONNECTED). It will only send message if the state has been changed. . eg: even though multiple errors have been thrown, only once the ERROR state will be sent. One possible scenario is ERROR -> CONNECTING -> CONNECTED. again if ERROR occurs , then the state is sent out of the node.

Examples

You can refer the example flow to get started

Troubleshooting

  • I am getting "Can't find device error"

    The can't find device error can be due to many reasons

    1. Make sure the device is powered on
    2. Make sure the Device ID / IP / Key are correct
    3. Make sure that you haven't created multiple nodes for the same device. Multiple connections to the same device is not possible. This is a limitation of TuyAPI.
  • What is the difference between FindTimeout and RetryTimeout?

    FindTimeout is the time in milliseconds that tuya api will check for a device. Once the timeout has breached, the can't find device error is shown.

    RetryTimeout is the time in milliseconds to wait for the node to retry the connection once the device connection is disconnected due to some unexpected errors.

  • What is the purpose of the status output ?

    The status output can be used to get the state of the current node(client). Whether disconnected or in error. You can make logic in node-red using this status. If you need to catch the whole error use the catch node.

License

(Back to top)

MIT License - Copyright (c) 2020 Vinod S R

Contributing

(Back to top)

Your contributions are always welcome! Please have a look at the contribution guidelines first.