Support for Tuya devices in SmartHome projects using Node-RED.
The goal of the project is to allow using local devices supports Tuya in Node-Red
Prerequisites: Node-RED installation. For details see here.
Install via npm
$ cd ~/.node-red
$ npm install node-red-contrib-tuya-devices
then restart node-red
The Tuya devices are represented by config Nodes (single Node per device). The flow Nodes references a device node and can exists multiple times in different flows. It can be defined a project object to group and control all Tuya devices in the local network. The IP addresses of the devices will be detect automaticaly. If configured a cloud access the device capabilities will be downloded and cached localy.
Insert Tuya manager node. In the manager config form:
If the cloud configuration is correct and the manager node has received at least once a message with topic 'updateDevices' all mapped devices will be listed in the config. The device capabilities will be cached localy. With the plus button can be added a config node for every local device. This config nodes contains all setting nedded to use the device localy and can be selected in the configuration of the Tuya device nodes. The device nodes can be easy connected to dashboard ui nodes (see example below). For this the single DP must be selected or a topic must be used to select a rigth DP, e.g by using of switch node. If device capabilites exists in local cache (e.g. after once successfully loaded from cloud) the device commands can be requestet by message usung topic 'dispatchCommands' (as in examle). A whole data model for the device can be requested by message with topic 'getDataModel'.
Here an flow examle for the possible control and configuration of a Tuya multifunctional alarm device.
The software is provided as-is under the MIT license. The author cannot be held responsible for any unintended behaviours.
If you like our ideas and want to support further development, you can donate here: