I got a couple of register booster fans not even knowing they were Tuya devices. I thought they were bascailly self contained.
Anyway, since I discovered they are Tuya I figured there are ways I can automate them that the devices themselves do not support (e.g. auto switch between cool and fan mode when the AC shuts off).
Installing and configuring the Tuya binding went without too much of a problem. I had to manually enter the IP address for the devices (weirdly the devices report a 165 IP inside the app) and the API version (3.5 worked). But the one Channel I need isn’t there in the OH add-on, changing the mode. I can only turn it on/off, enable/disable the child lock, set the temp and get the thermometer reading. I cannot set the fan speed either.
It says in the docs that one can add a Channel but it’s kind of vague and does not really provide any information about how I would discover that dp property for the Channel.
So how do I discover this DP property?
And if this is not going to work like I want with the binding, is there any experience with rustuya-bridge? Could I expect that to be more thorough in finding all the control points?
Or maybe this is it and that’s all the API allows even though all the controls I do need are available in the app. It could save me a day’s worth of experimenting if anyone can provide a little guidance.
Thanks!
Edit 1: Immediately upon posting I discovered in the Tuya Developer Platform there is a “Standard Instruction” and a “DP Instruction” option. So I might be closer to an answer than I thought. More to follow…
Edit 2: I can see all the control points but still can’t figure out how to discover what the DP number is for each one short of trial and error. There seems to be no rhyme nor reason to the numbering. Do I really need to wireshark this or capture the network logs from the browser?
The answer is no. In the Tuya Developer Platform hover over “Cloud” and choose “API Explorer”. Make sure IOT Core is selected at the top and go down to Device Control → Query Properties. Paste in the device ID and the resulting JSON will include the DP numbers for each Channel. For example:
{
"result": {
"properties": [
{
"code": "switch",
"custom_name": "",
"dp_id": 1,
"time": 1785090872807,
"type": "bool",
"value": true
},
{
"code": "mode",
"custom_name": "",
"dp_id": 2,
"time": 1785090872807,
"type": "enum",
"value": "FAN"
},
{
"code": "temp_indoor",
"custom_name": "",
"dp_id": 9,
"time": 1785098576999,
"type": "value",
"value": 66
},
{
"code": "fan_speed_enum",
"custom_name": "",
"dp_id": 12,
"time": 1785090872807,
"type": "enum",
"value": "4"
},
{
"code": "child_lock",
"custom_name": "",
"dp_id": 14,
"time": 1785090872807,
"type": "bool",
"value": false
},
{
"code": "temp_set",
"custom_name": "",
"dp_id": 45,
"time": 1785090872807,
"type": "value",
"value": 65
},
{
"code": "fan_cool_max_enum",
"custom_name": "",
"dp_id": 101,
"time": 1785090872807,
"type": "enum",
"value": "10"
},
{
"code": "brightscreen_set",
"custom_name": "",
"dp_id": 102,
"time": 1785090872807,
"type": "enum",
"value": "on"
},
{
"code": "fan_cool_min_enum",
"custom_name": "",
"dp_id": 103,
"time": 1785090872807,
"type": "enum",
"value": "1"
},
{
"code": "fan_heat_max_enum",
"custom_name": "",
"dp_id": 104,
"time": 1785090872807,
"type": "enum",
"value": "10"
},
{
"code": "fan_heat_min_enum",
"custom_name": "",
"dp_id": 105,
"time": 1785090872807,
"type": "enum",
"value": "1"
},
{
"code": "temp_set_1",
"custom_name": "",
"dp_id": 106,
"time": 1785090872807,
"type": "value",
"value": 82
}
]
},
"success": true,
"t": 1785099656290,
"tid": "1881507d893511f1925d82fbf7d4d33a"
}
To find the accepted values for the enums and ranges for the numbers navigate to Cloud → open your project → Devices → Debug Device next to the device you want information about → Device Debugging. That will show you all the valid enums and ranges for each DP.
What I don’t know is whether I need to redescover the Things or what.
So far:
- make sure the devices are in DPInstruction mode
- discover all the DP numbers for each “channel”
- discover the enum values and ranges for each channel
- create Channels for the missing ones (I’ve not done this yet, to be continued)
Edit 3: Rediscovering the Thing still only listed the four Channels. But adding the missing Channel I need worked. Woohoo!
