Skip to content

Commit

Permalink
You can now provide Query Properties Map for Smart Device, it will ma…
Browse files Browse the repository at this point in the history
…ke dps to be translated into human-readable format. You can generate the map on tuya IoT Platform > Device Control > Query Properties
  • Loading branch information
Shaquu committed Jul 1, 2024
1 parent abc9c27 commit 4b69b8b
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 123 deletions.
18 changes: 0 additions & 18 deletions .github/stale.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/node.js.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release publish

on:
push:
branches:
- master

jobs:
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
always-auth: true
- name: Publish
run: |
npm ci
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_TKN}}
- name: Update Node-Red flow-library
uses: Zehir/[email protected]
continue-on-error: true
with:
package-name: '@nrchkb/node-red-tuya-smart-device'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ dist

# TernJS port file
.tern-port

.idea
.vscode
23 changes: 0 additions & 23 deletions .vscode/settings.json

This file was deleted.

38 changes: 25 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.1.0 - 2024-07-01

### Changed

- Forked :)

### Added

- You can now provide Query Properties Map for Smart Device, it will make dps to be translated into human-readable format. You can generate the map on tuya IoT Platform > Device Control > Query Properties

# Legacy Changelog

## 5.3.0

- Added log level control to each node
Expand All @@ -12,19 +24,19 @@

## 5.1.0

- Update tuya CLI to v7.5.1 (https://github.com/vinodsr/node-red-contrib-tuya-smart-device/pull/110)
- Update tuya CLI to v7.5.1 (https://github.com/NRCHKB/node-red-tuya-smart-device/pull/110)

## 5.0.1

- Fix error validating the creds in the view mode. This is an known issue [node-red#3420](https://github.com/node-red/node-red/issues/3420)
- Fix error validating the credentials in the view mode. This is a known issue [node-red#3420](https://github.com/node-red/node-red/issues/3420)

## 5.0.0

- Updated TuyaAPI to `7.3.0`
- Added support to store device Id and device Key as credentials [#77](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/77)
- Added support to store device-id and device-key as credentials [#77](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/77)
- Changed the default find timeout value to 10 seconds
- Renamed `tuya smart device generic` node to `tuya smart device hub`
> Thanks to [foxylion](https://github.com/foxylion) for suggesting the crendentials feature
> Thanks to [foxylion](https://github.com/foxylion) for suggesting the credentials feature
## 4.1.1

Expand All @@ -37,51 +49,51 @@
## 4.1.0

- Added CONTROL commands as input (CONNECT, DISCONNECT, RECONNECT)
- Seperate output node for device status and client status
- Separate output node for device status and client status
- Dynamically set the find and retry timeout (Not saved permanently in the config)
- Disable auto connect on start

## 4.0.2

- Added support for both data and dp-refresh event [#54](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/54)
- Added support for both data and dp-refresh event [#54](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/54)

## 4.0.1

- Renamed data event to dp-refresh (Tuya 7.1 changes)

## 4.0.0

- Update to Tuya 7.1.0. Closes [#51](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/51)
- Update to Tuya 7.1.0. Closes [#51](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/51)

## 3.1.0

- Added support for catch node. If there a catch node in the flow, the tuya smart device node will not throw any error to the debug window. Implementing [#47](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/47)
- Added support for catch node. If there is a catch node in the flow, the tuya smart device node will not throw any error to the debug window. Implementing [#47](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/47)

## 3.0.2

- Fixes [#43](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/43)
- Fixes [#43](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/43)

## 3.0.1

- Fixes protocol default value not set for existing nodes

## 3.0.0

Fixes [#35](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/35)
Fixes [#39](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/39)
Fixes [#35](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/35)
Fixes [#39](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/39)

- Optimized code

## 2.0.0

Fixes [#33](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/33)
Fixes [#33](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/33)

- Tuya api library updated to 6.1.1
- No more null data payload on json undefined error. :)

## 1.2.1

Fixes [#25](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/issues/25)
Fixes [#25](https://github.com/NRCHKB/node-red-tuya-smart-device/issues/25)

## 1.2.0

Expand Down
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# 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](https://img.shields.io/npm/v/node-red-contrib-tuya-smart-device)
![NPM](https://img.shields.io/npm/dm/node-red-contrib-tuya-smart-device)
![Build and Publish package](https://github.com/vinodsr/node-red-contrib-tuya-smart-device/workflows/Build%20and%20Publish%20package/badge.svg)
![Build and Publish package](https://github.com/NRCHKB/node-red-tuya-smart-device/workflows/Build%20and%20Publish%20package/badge.svg)
![License](https://img.shields.io/github/license/vinodsr/node-red-contrib-tuya-smart-device)

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

![image](./img/sample.png)

Expand All @@ -31,9 +33,9 @@ A node-red module which helps you to connect to any 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 setup Tuya Protocol Version
- Ability to set up Tuya Protocol Version
- Ability to listen to both `Data` and `DP-Refresh` event
- Can store deviceId and deviceKey as crendentials
- Can store deviceId and deviceKey as credentials
- Better error handling
- Better log handling

Expand All @@ -45,17 +47,17 @@ Instructions for getting the device id is available [here](https://github.com/co
>
> [https://github-wiki-see.page/m/iRayanKhan/homebridge-tuya/wiki/Get-Local-Keys-for-your-devices](https://github.com/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 instructiions
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](./changelog.md)
Get more details about latest version changes in the [CHANGELOG.md](CHANGELOG.md)

# Setup

[(Back to top)](#table-of-contents)

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 setup the node, you can then use input to send any command to the device as per the tuya standards.
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

Expand All @@ -71,8 +73,8 @@ Once you setup the node, you can then use input to send any command to the devic

> 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 send. One possible scenario is
> `ERROR -> CONNECTING -> CONNECTED`. again if ERROR occurs , then the state is send out of the 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

Expand All @@ -82,15 +84,15 @@ You can refer the [example flow](./examples/latest.json) to get started

- **I am getting "Can't find device error"**

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

1. Make sure the device is powered on
1. Make sure the Device ID / IP / Key are correct
1. 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.
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.
`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.

Expand All @@ -108,4 +110,4 @@ MIT License - Copyright (c) 2020 Vinod S R

[(Back to top)](#table-of-contents)

Your contributions are always welcome! Please have a look at the [contribution guidelines](CONTRIBUTING.md) first. :tada:
Your contributions are always welcome! Please have a look at the [contribution guidelines](CONTRIBUTING.md) first.
26 changes: 15 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
{
"name": "node-red-contrib-tuya-smart-device",
"version": "5.3.0",
"name": "@nrchkb/node-red-tuya-smart-device",
"version": "0.1.0",
"description": "A node-red module to interact with the tuya smart devices",
"repository": "https://github.com/vinodsr/node-red-contrib-tuya-smart-device",
"repository": "https://github.com/NRCHKB/node-red-tuya-smart-device",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Vinod S R",
"author": "Tadeusz Wyrzykowski <[email protected]> (https://github.com/Shaquu)",
"license": "MIT",
"homepage": "https://github.com/vinodsr/node-red-contrib-tuya-smart-device",
"homepage": "https://github.com/NRCHKB/node-red-tuya-smart-device",
"keywords": [
"node-red"
"node-red",
"tuya",
"nrchkb"
],
"node-red": {
"version": ">=2.5.0",
"version": ">=3.0.0",
"nodes": {
"tuya-smart-device": "src/tuya-smart-device.js",
"tuya-smart-device-generic": "src/tuya-smart-device-generic.js"
}
},
"dependencies": {
"tuyapi": "~7.5.1"
"tuyapi": "~7.5.2"
},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
}
}
Binary file removed src/icons/device.png
Binary file not shown.
Binary file added src/icons/tuya.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4b69b8b

Please sign in to comment.