You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering how to set multiple DPS in one request? F.e. i want to turn on a dimmer and set the dimming value in the same request. The devices support the following format i got from Googling around:
{multiple: true,data: {'1': true,'2': 50}}
Any thoughts?
Thanks!!
The text was updated successfully, but these errors were encountered:
Great question! I think there may be a feature request here for a simple combined function call... hum...
You could use set_value(dps_index,value) but would need to do that for each DPS value (2 calls for your example). To send it in one packet, you can build the payload yourself and send it using this:
importtinytuya# Connect to the deviced=tinytuya.OutletDevice(DEVICEID, DEVICEIP, DEVICEKEY)
d.set_version(3.3)
# Generate the payload to send - add all the DPS values you want to change herepayload=d.generate_payload(tinytuya.CONTROL, {'1': True, '2': 50})
# Send the payload to the deviced._send_receive(payload)
NOTE: For some devices, it will not like this and you will get a timeout when you try to send the payload. Those devices require you to send two separate commands. My Gosund dimmer switch is one of those and requires that I send two commands, one for '1' for on/off and one for '3' for the dimmer. Also, keep in mind that the DPS value range for brightness may not be a 1-100, it could be 25-255 or 10-1000. At least that is the case for my devices (my Gosund is 25-255). The above code snip I ran against my smartbulbs without any problem (they accepted multiple DPS values).
Hi,
I was wondering how to set multiple DPS in one request? F.e. i want to turn on a dimmer and set the dimming value in the same request. The devices support the following format i got from Googling around:
{multiple: true,data: {'1': true,'2': 50}}
Any thoughts?
Thanks!!
The text was updated successfully, but these errors were encountered: