Description for MQTT DPS topics for subdevices (cid) behind Tuya Gateway

This commit is contained in:
lehanspb
2023-02-15 12:16:10 +03:00
parent eb800133a0
commit 47734e03d0

View File

@@ -1,9 +1,10 @@
# tuya-mqtt # tuya-mqtt
# !!!! Important Note !!!! # Note
This project is currently in maintainance mode. No further enhancements to this project are planned and will not be planned for the future unless someone out there is interested in becoming the new maintainer. Please do not open issues to request new features, new device support, etc, as they will likely be closed with no comment. I will try to support existing functionality, but even this will likely be on a very limited basis. If you are interested in maintaining this project, please post [here](https://github.com/rospogrigio/localtuya/issues/194).
I have decided to step away from this project as I've made the personal decision to rid myself of any Tuya Wifi based devices (I'm down to only 4 at this point, and they are all easy to replace or at least flash with Tasmota). This decision was made due to the fact that Tuya continues to make it more and more difficult to control their devices locally. While I don't blame them for this, these devices were only interesting to me because of this local control and thus I can no longer meet my personal goals with Tuya devices (at least the Wifi ones) so I will no longer be purchasing/using them going forward. I'm not a developer and I'm new to nodejs.
I just need to get data from Zigbee devices behind Tuya Wireless Gateway and the ability to control them using MQTT commands.
I forked this repository [TheAgentK](https://github.com/TheAgentK/tuya-mqtt) and made some changes.
# About # About
This project is a bridge that allows locally controlling IOT devices manufactured by Tuya Inc., and sold under many different brands, via simple MQTT topics. It effectively translate the Tuya protocol to easy to use topics. This project is a bridge that allows locally controlling IOT devices manufactured by Tuya Inc., and sold under many different brands, via simple MQTT topics. It effectively translate the Tuya protocol to easy to use topics.
@@ -150,6 +151,32 @@ tuya/dimmer_device/DPS/2/command <-- accepts 1-255 for controlling brightness l
**!!! Important Note !!!** **!!! Important Note !!!**
When sending commands directly to DPS values there are no limitation on what values are sent as tuya-mqtt has no way to know what are valid vs invalid for any given DPS key. Sending values that are out-of-range or of different types than the DPS key expects can cause unpredictable behavior of your device, from causing timeouts, to reboots, to hanging the device. While I've never seen a device fail to recover after a restart, please keep this in mind when sending commands to your device. When sending commands directly to DPS values there are no limitation on what values are sent as tuya-mqtt has no way to know what are valid vs invalid for any given DPS key. Sending values that are out-of-range or of different types than the DPS key expects can cause unpredictable behavior of your device, from causing timeouts, to reboots, to hanging the device. While I've never seen a device fail to recover after a restart, please keep this in mind when sending commands to your device.
## DPS Topics for devices behind Tuya Gateway
In addition to the DPS Key topics, it's possible to use the DPS for devices behind Tuya Gateway.
'cid' - is the subdevice id.
This example demostrates DPS values and commands for Tuya Smart Thermostat Radiator Valve behind Tuya Gateway:
Thermostat mode:
tuya/zgw1/1a24fkfffe6b4e24/dsp/4/state --> {"4":"auto"}
Possible values: auto/temp_auto/holiday/manual/comfort/eco/BOOST
tuya/zgw1/dps/command <-- {"dps": 4, "set": 4, "cid": "1a24fkfffe6b4e24"}
Temperature Setpoint:
tuya/zgw1/1a24fkfffe6b4e24/dps/2/state --> {"2": 220}
Where 220 - 22.0 Celsius
tuya/zgw1/dps/command <-- {"dps": 2, "set": 220, "cid": "1a24fkfffe6b4e24"}
Current Temperature:
tuya/zgw1/1a24fkfffe6b4e24/dps/3/state --> {"3": 225}
Where 225 - 22.5 Celsius
Valve percent:
tuya/zgw1/1a24fkfffe6b4e24/dps/109/state --> {"109": 30}
Where 30 - 30%
tuya/zgw1/dps/command <-- {"dps": 109, "set": 40, "cid": "1a24fkfffe6b4e24"}
## Issues ## Issues
Not all Tuya protocols are supported. For example, some devices use protocol 3.2 which currently remains unsupported by the TuyAPI project due to lack of enough information to reverse engineer the protocol. If you are unable to control your devices with tuya-mqtt please verify that you can query and control them with tuya-cli first. If tuya-cli works, then this script should also work, if it doesn't then this script will not work either. Not all Tuya protocols are supported. For example, some devices use protocol 3.2 which currently remains unsupported by the TuyAPI project due to lack of enough information to reverse engineer the protocol. If you are unable to control your devices with tuya-mqtt please verify that you can query and control them with tuya-cli first. If tuya-cli works, then this script should also work, if it doesn't then this script will not work either.