Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage all Tuya devices with node-red #139

Closed
msillano opened this issue Dec 30, 2023 · 1 comment
Closed

Manage all Tuya devices with node-red #139

msillano opened this issue Dec 30, 2023 · 1 comment

Comments

@msillano
Copy link

msillano commented Dec 30, 2023

For the development of TuyaDAEMON I have collected a series of information that I believe may be of general interest.

  1. Most Tuya-branded devices are controllable using the tuya-smart-device node. All you need is the deviceID, the localKey, and knowing the DPs and behavior of the device.

  2. Some devices CANNOT be controlled locally with "tuya-smart-device" because they do not have a stable WiFi connection (typically battery-operated WiFi sensors). In these cases, you can use Tuya 'OpenAPI' via REST with node-red. Requires Tuya credentials and deviceID. Available as TuyaDAEMON extension and also as node-red library.

  3. OpenAPI can be used only in polling. It is not possible to use it for asynchronous events generated by devices (e.g. alarms). One solution is the HW/SW trigger mechanism (designed for TuyaDAEMON), which allows bidirectional communications between SmarlLife Automation and node-red. Available as TuyaDAEMON extension and also in lite version.

  4. Many WiFi products without the Tuya logo are built by various manufacturers (Ikea, Philips, Siemens...) with their own APP, but were developed using Tuya. Some of these products CAN be managed with SmartLife. Unfortunately, this needs to be verified on a case-by-case basis (Tuya communication).

  5. Even some ZigBee devices produced without Tuya compatibility can be associated with a ZigBee-Tuya hub (e.g. thermometers for Xiaomi's HomeKit APP).

A) how to find deviceID, and localKey:
1. deviceID only: in SmartLife, Device Info
2. use Tuya IoT Development Platform for Tuya credentials
3. use tuyapi_cli wizard
4. use OpenAPI: 'Query Device Details' (preferred)

B) How to Find DPs.
The simplest solution is to use the 'Send Properties' API (see here)

C) The study of the behavior and quirks of a device is greatly aided by the Log (max 7 days) present in 'Tuya Development Platform' (see here)

Caveat: Tuya OpenAPI and Automation are not very stable. Tuya occasionally changes the structure of Tuya Cloud; the latest change (June 20, 2023) made it necessary to update all Automation due to a change in the name of a condition. A change of deviceID also invalidates the Automation.

I hope this information helps someone

@vinodsr vinodsr pinned this issue Dec 31, 2023
@vinodsr
Copy link
Owner

vinodsr commented Dec 31, 2023

Thanks @msillano for the information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants