iRayanKhan/homebridge-tuya

Fighting to get a TreatLife DS03 working

jlg89 opened this issue ยท 14 comments

jlg89 commented

I'm hitting a wall with the TreatLife DS03. Followed the instructions at
https://github.com/codetheweb/tuyapi/blob/master/docs/SETUP.md#listing-tuya-devices-from-the-tuya-smart-or-smart-life-apps-highly-recommended
and was able to get "Device(s) registered!" with the id/ip/localKey/name parameters:

[
  {
    id: 'ebce47a28178981b87jzyj',
    ip: '47.211.204.20',
    localKey: "wF9Z}lz-?wVQ~-'l",
    name: 'Ceiling Fan Dimmer Switch DS03'
  }
]

however, when I plug them into the homebridge-tuya config, I'm getting

[4/27/2023, 9:06:13 AM] [homebridge-tuya] wF9Z}lz-?wVQ****, key for Master Bedroom Lights & Fan (ebce47a28178981b87jzyj), is not a valid key.
[4/27/2023, 9:06:13 AM] [homebridge-tuya] No valid configured devices found.

My config looks like this:

                {
                    "type": "fanLight",
                    "name": "Master Bedroom Lights & Fan",
                    "id": "ebce47a28178981b87jzyj",
                    "key": "wF9Z}lz-?wVQ~-'l",
                    "manufacturer": "TreatLife",
                    "model": "DS03"
                }

What am I doing wrong?

FWIW by doing several "tuya-cli get" commands, I was able to work out the various settings for this switch...but even after digging through the wiki and issues I can't find a resource that tells me how to convert this data into a working config.json.

1   fan power
3   fan speed, 1 - 4
9   light power
10  light dimmer, 140 - 1000
105 "min dimmer" value (configured in app)
106 mode1 (configured in app)
108 always 1?

I'll be happy to write up a how-to for the wiki for this device, if I can ever get it working. What a royal pita, whew.

Originally posted by @jlg89 in #154 (comment)

jlg89 commented

I ended up using homebridge-tuya-platform, which isn't local control, but at least it works. Once the thing is in HomeKit, it works OK, but getting it into HomeKit is a massive pain.

For the record: If you're considering this type of device for HomeKit, just don't. Find a device that supports HomeKit natively. The only reason I'm fighting through getting this particular switch working is that I need a single-gang smart switch that has both fan speed control and light dimming control, and there just isn't much out there. If I could fit a double-gang box on the wall in this spot, it would have been easier to do that than go through all this rigamarole just to get one stinking switch working.

@jlg89 if you need a config that works, here's mine, I've got multiple units working:

{ "type": "FanLight", "name": "Fan Light Switch", "manufacturer": "Treatlife", "model": "Ceiling Fan Dimmer Switch DS03", "id": "your_id", "key": "your_key" }

Note that Tuya is assigning new local keys that are not working with the current version of the plugin, that's probably your issue.

@jlg89 if you need a config that works, here's mine, I've got multiple units working:

{ "type": "FanLight", "name": "Fan Light Switch", "manufacturer": "Treatlife", "model": "Ceiling Fan Dimmer Switch DS03", "id": "your_id", "key": "your_key" }

Note that Tuya is assigning new local keys that are not working with the current version of the plugin, that's probably your issue.

I installed some new lights today and have been pulling my hair out all day trying to get them configured. The first thing I noticed when I went to get the new local keys is that they started including symbols like "<" and "((", etc. I really hope this is something that can be addressed.

jlg89 commented

Just a quick follow-up. The free account at iot.tuya.com only lasts a month, at which point the "official" tuya-homebridge plugin stopped working...so I had to give local setup another shot. Thanks to the wiki, the working config from @skumancer , and #409 (comment) I was able to finally get it working.

jlg89 commented

Closing. No longer fighting, now we're FanLighting. I've even added a second DS03 to the mix. Woohoo!

hi guys I can't get this to work I get this error @skumancer

[7/17/2023, 12:11:35 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'Brightness': characteristic was supplied illegal value: number -11 exceeded minimum of 0. See https://homebridge.io/w/JtMGR for more info.
[7/17/2023, 12:11:37 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'Brightness': characteristic was supplied illegal value: number -11 exceeded minimum of 0. See https://homebridge.io/w/JtMGR for more info.
[7/17/2023, 12:11:41 PM] [homebridge-tuya] This plugin generated a warning from the characteristic 'Brightness': characteristic was supplied illegal value: number -11 exceeded minimum of 0. See https://homebridge.io/w/JtMGR for more info.
[Tuya DEBUG] decrementing this._connectionAttempts, currently 2
[Tuya DEBUG] decrementing this._connectionAttempts, currently 1
[Tuya] Socket had a problem and will reconnect to Fan Light Switch (Error: ERR_PING_TIMED_OUT)
[Tuya DEBUG] after error setting _connect in 5000ms
[Tuya DEBUG] executing _connect after 5000ms delay
[Tuya DEBUG] reconnect called for Fan Light Switch
[Tuya] Sending first query to Fan Light Switch (3.4)
[Tuya] Disconnected from Fan Light Switch

jlg89 commented

Try adding a dpBrightness default to your config:

https://github.com/iRayanKhan/homebridge-tuya/wiki/Supported-Device-Types#simple-dimmers

The "ERR_PING_TIMED_OUT" could also indicate a network issue; can you ping the switch using its IP address?

I think this might more the problem

Fan Light Switch has a different type (1 vs undefined)

@jlg89 What API version are your DS03 switches running? I think the issue is the API version used at the time it was manufactured.

My controllers work fine with TuyaWeb, but even though I'm able to get my older smart plugs working, the DS03 isn't. After doing some troubleshooting, I think the problem is that this plugin hasn't been updated to support the Tuya API 3.4 yet, as referenced in issues #379, #395.

I have a smart outlet (using 3.1) working with TuyaLan, but my DS03 (using 3.4) isn't.

[TuyaLan] Discovered Test Outlet (012002842c3ae831f872) identified as Outlet (3.1)
[Tuya DEBUG] reconnect called for Test Outlet
[TuyaLan] Connected to Test Outlet
[Tuya] Sending first query to Test Outlet (3.1)
[TuyaLan] Ready to handle Test Outlet (Outlet:3.1) with signature {"1":true,"2":0}

TuyaLan] Discovered Office Fan (ebd871fb7c22a7aea83xnd) identified as FanLight (3.4)
[Tuya] Changing ping gap for Office Fan to 9s
[Tuya DEBUG] reconnect called for Office Fan
[Tuya] Discovery ended.
[TuyaLan] Connected to Office Fan
[Tuya] Sending first query to Office Fan (3.4)
[Tuya] Disconnected from Office Fan

[Tuya DEBUG] decrementing this._connectionAttempts, currently 2
[Tuya DEBUG] decrementing this._connectionAttempts, currently 1
[Tuya DEBUG] decrementing this._connectionAttempts, currently 2
[Tuya DEBUG] decrementing this._connectionAttempts, currently 1
[Tuya] Socket had a problem and will reconnect to Office Fan (Error: ERR_PING_TIMED_OUT)
[Tuya DEBUG] after error setting _connect in 5000ms
[Tuya DEBUG] executing _connect after 5000ms delay
[Tuya DEBUG] reconnect called for Office Fan
[Tuya] Sending first query to Office Fan (3.4)
[Tuya] Disconnected from Office Fan
[Tuya DEBUG] decrementing this._connectionAttempts, currently 2
[Tuya DEBUG] decrementing this._connectionAttempts, currently 1
[Tuya] Socket had a problem and will reconnect to Office Fan (Error: ERR_PING_TIMED_OUT)

jlg89 commented

@jlg89 What API version are your DS03 switches running? I think the issue is the API version used at the time it was manufactured.

Mine are all working now.

#408 (comment)

Sorry, I could have phrased my comment better. I'm curious which version your switches are using, because I'm using the config that you were able to get working, but it doesn't seem to work with my switches.

Based on some of the other issues I referenced, I think the problem could be that this plugin hasn't been updated yet to support the newer protocols, and I'm wasting my time trying to get local control working. But if your switches are also running 3.4, there must be something I'm missing with my config.

jlg89 commented

Sorry, I misunderstood. Looks like both of mine are on 3.3.

I am on "current_version": "3.3.19", and still not working...I give up!

I was able to figure it out based on searching the logs (posted in my original comment)

[TuyaLan] Discovered Test Outlet (012002842c3ae831f872) identified as Outlet (3.1)
TuyaLan] Discovered Office Fan (ebd871fb7c22a7aea83xnd) identified as FanLight (3.4)

The outlet is using 3.1, and FanLight is using 3.4. If you have 3.4 or above, local control isn't going to work until it gets updated.