Skip to content

HOWTO get a DPs dump

Pierre Ståhl edited this page Dec 15, 2020 · 9 revisions

It is possible to get the dump of all DPs with the following method.

Note: the device might be able to accept only one connection at a time. If this is the case, close all Tuya apps (and/or disconnect the mobile phones running them) before trying.

Using tuyadebug.tgz package

Download the tuyadebug.tgz package, extract it and run the test.py script passing it the correct parameters. The script will detect all the available DPs of the device and report their current values (i.e., the "DPs dump"). See the example below for an example of execution of the script and the expected output:

./test.py <deviceID> <IPaddress> <localKey> 

INFO:localtuya:localtuya version 0.0.19
INFO:localtuya:Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
[...]
DEBUG:localtuya.pytuya:decrypted result='{"devId":"<deviceID>","dps":{"1":false,"7":true,"9":0,"15":0,"18":0,"19":0,"20":2218,"26":0}}'
AVAILABLE DPS ARE [{'1': False, '7': True, '9': 0, '15': 0, '18': 0, '19': 0, '20': 2218, '26': 0}]
INFO:localtuya:COMPLETE response from device <deviceID> [<IPaddress>].

**** deviceInfo returned OK ****

TuyaDebug (Tuya DPs dump) [1.0.0]

Device <deviceID> at <IPaddress> key <localKey> protocol 3.3 dev_type type_0a:
    DPS [1] VALUE [False]
    DPS [7] VALUE [True]
    DPS [9] VALUE [0]
    DPS [15] VALUE [0]
    DPS [18] VALUE [0]
    DPS [19] VALUE [0]
    DPS [20] VALUE [2218]
    DPS [26] VALUE [0]

Changing value of a datapoint

It is possible to manually change the value of a datapoint using the localtuya.set_dp service. An example call looks like this:

service: localtuya.set_dp
data:
  device_id: 11100118278aab4de001
  dp: 1
  value: False