rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.83k stars 544 forks source link

Need some help setting up a Treatlife Tuya device #1278

Open reypm opened 1 year ago

reypm commented 1 year ago

I have a Treatlife Smart Ceiling Fan Control and Dimmer (DS03-1) and I am trying to set up both light and fan controls without the IoT Cloud since my account is in a Basic Tier and I am unable to use it anymore. I must say that before my account got unusable for what I have mentioned before this device worked like a charm meaning it is fully functional and has no issues with it.

If I am not wrong I should be able to integrate my device and HA using this localtuya integration without the need to have Tuya IoT in between, if that is the case I have all the information needed to register the device and I did it as follow ...

  1. Add a new device.
  2. Pick a device from the list (it has a static IP address assigned).
  3. Enter the required information such as Name and Local Key and leave the rest untouched.
  4. In the next screen select fan for the Platform. image
  5. In the next screen left everything as it is and just put a friendly name. image
  6. Then added a second entity which is the light since I do know this switch can control the fan and the light independently.
  7. Again left everything as it is and just put a friendly name (I guess that some values there depend for example on what light bulbs I have and so on but that is not important at this moment I can play with that later on). but ... which ID value should I have chosen? I pick 9 because is the other one that says true however no idea what I am doing, to be honest (maybe it will be good to add a small description of what this ID and or terms like DP means to newcomers like me) image

The Light switch works perfectly I can turn it on/off the light, however, the fan does not since switching it to on/off does not start the fan. What I am missing here? Whatever you need to help me out let me know :) and I will attach it to this

At this point, I have messed up with something because the fan does not turn on not from the Tuya Mobile App not from the switch by manually pressing the button 😱

Here is some info that might help:

./test.py <my_device_id> 192.168.11.44 <device_key>
INFO:localtuya:localtuya version 1.0.0
INFO:localtuya:Python 3.9.6 (default, Oct 18 2022, 12:41:40)
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
INFO:localtuya:Using pytuya version '10.0.0'
INFO:localtuya:Detecting list of available DPS of device <my_device_id> [192.168.11.44], protocol 3.3.
DEBUG:localtuya.pytuya:[eba...h1m] Sending command 10 (device type: type_0a)
DEBUG:localtuya.pytuya:[eba...h1m] Sending payload: b'{"gwId":"<my_device_id>","devId":"<my_device_id>","uid":"<my_device_id>","t":"1675800495"}'
DEBUG:localtuya.pytuya:[eba...h1m] Command 10 waiting for sequence number 1
DEBUG:localtuya.pytuya:[eba...h1m] Dispatching message CMD 10 TuyaMessage(seqno=1, cmd=10, retcode=0, payload=b"\x11\xd8\x92;\x96\r\xcf\xd7S\x8c\xd6\xbb\xff\x1aJ`\xe7-)\xd7\xbeP\x85\x80^'\x84\xff_\xc6\x84\xa1\xd5=jI\xf1\xccT\x0e\xb4j\xde\xfc\xfd\xcb\x17\xfbI\x97\xd8\xb6\xb7\x1a\x92\xd5\x17\x0c0g\x1f\xcb\xe8\xe2Hu\xe9\x17\xcaK\xdb\xdf\xd5(\xed\xb5j\xa6q ", crc=1028997126, crc_good=True)
DEBUG:localtuya.pytuya:[eba...h1m] Deciphered data = '{"dps":{"1":true,"3":"4","9":true,"10":1000,"105":100,"106":"mode1","108":1}}'
AVAILABLE DPS ARE [{'1': True, '3': '4', '9': True, '10': 1000, '105': 100, '106': 'mode1', '108': 1}]
INFO:localtuya:COMPLETE response from device eba85e59e9ce9ef1f4ph1m [192.168.11.44].

**** deviceInfo returned OK ****

TuyaDebug (Tuya DPs dump) [1.0.0]

Device eba85e59e9ce9ef1f4ph1m at 192.168.11.44 key **************** protocol 3.3 dev_type type_0a:
    DPS [1] VALUE [True]
    DPS [3] VALUE [4]
    DPS [9] VALUE [True]
    DPS [10] VALUE [1000]
    DPS [105] VALUE [100]
    DPS [106] VALUE [mode1]
    DPS [108] VALUE [1]
Akshue commented 1 year ago

I have a similar issue. My 4 fan switches are the only control issues that I have in my ~200 device house. Same switch.

I can control the fan fine with TuyaV2 app.

When I add via localtuya, I can see the light/switch portion just fine (using DPS 9-10) However, the fan stays basically invisible. I add it (using 1-3), but it does not show up in the device info.

If I add just the fan and ignore the light, it actually makes the entire switch go "missing" - to the point where the only way to zero it out is to manually edit the files in .config. No device, no entities, but I cannot re-add it in localtuya/HA.

I'm really close to just pulling them from the wall and installing tasmota on these. (Should be able to access the right pins)