TREATLIFE wifi Smart Dimmer Plug - 2 sockets success with localtuya

In case anyone else is looking at this wifi plug I just wanted to confirm that it works with Home Assistant using localtuya. I’m guessing it would work for the main Tuya integration as well.

First I set it up in the Tuya app and got the device id/key with tuya-cli. I added a static IP in my router. I upgraded to the 4.0 version of localtuya so I could use the UI config and it found the device automatically, I just needed the local key. You do need to configure which dps go to which functions. Here’s an example of the dps I had and some notes on what I found them to be:

{
  '1': true,  //(plug 1 on/off)
  '2': 797,  // plug 1 % min to 1000 = min/10% to 100%
  '3': 183,  //plug 1 minimum level out of 1000
  '4': 'led',  //plug 1 dimming mode: led, incandescent, halogen
  '6': 0,  //unknown, couldn't get it to change
  '7': true,  //(plug 2 on/off)
  '8': 795,  // plug 2 % min to 1000 = min/10% to 100%
  '9': 183,  //plug 2 minimum level out of 1000
  '10': 'led',  //plug 2 dimming mode: led, incandescent, halogen
  '12': 0,  //unknown, couldn't get it to change
  '21': 'relay' //LED indicator - 'none' when the led should be on when plug is off, 'relay' when it's on when plug is on
}

So in the config I added a light with the ID=1, brightness = 2, minimum brightness = 0 (I’m relying on the device to have it’s minimum already set so it will give me a nice out of 100% on the slider), maximum brightness = 1000. Make sure you uncheck “don’t add another entity” so you can add the second plug with ID=7, brightness = 8.

I’m using this for inline vent fans but the fan entity doesn’t seem to support a % speed in localtuya. I’ll have to wrap with a helper.

This is the plug I’m talking about:

Hi, how do you figure out the dps? I’m trying to do this with other localtuya devices.

It’s possible they’ve changed something since then - a DP20 smart dimmer plug I just received from amazon (mfg 6/2023) is only seen by the Treatlife app, and isn’t visible to the Tuya Smart app at all. Thus it can’t be linked to a Tuya IoT account and you can’t get a key/secret for the device, so you can’t use tuya-api, so you can’t add it to the localtuya integration in HA.

Just a heads up in case anyone can confirm, or if I’m just being dumb. I will probably just desolder the WB3S module and solder in a ESP12 with esphome in place of it.