How To Guides

Wifi Dimmer switch with Tasmota – Tuya Dimmer guide

Wifi Dimmer switch with Tasmota - Tuya Dimmer guide

Dimmer switches have been around for a long time, useful for those situations where you just don’t want a bulb to be at 100% brightness all the time. So what about Wifi dimmer switches that we can add to our smart home?

First of all there are two very obvious questions out the gate:

  1. Why choose a light switch over a smart bulb?
  2. Why would you want a dimmer switch?

The first one is easy, a Wifi switch rather than a bulb is great for retaining a physical switch for those who just want to push buttons manually. Sure smart bulbs can have this functionality if you push the light switch twice (assuming its in the on position) you turn it off then back on again, but that’s a pain. Wifi switches are also great for ensuring people can’t turn off your smart lights, since they are always on. Have you ever wondered why your lights didn’t turn on, only to realise someone turned it off at the switch?

The second one is more of a niche situation, my use case for this was so that I could have the bathroom lights turn on in the early hours of the morning and not be blinded, whilst retaining the aforementioned physical switch.

So what products are on the market? Surprisingly if you are in the UK (or perhaps not), there isn’t much choice of Wifi Dimmer switches. All of the ones you will find at the time of writing are based on yet another Tuya product. The US market has more options than we get over here, such as the TP-Link products. We are looking at the Tuya based products today.

This is good for us, by now we know what to expect inside! An ESP8266 of some sort.



The only things we need for this is our light dimmer switch and compatible bulb:

Important note for UK households, make sure your house wiring can support it. You need to have a neutral wire to your light switch.

Preparing the switch

Once you have the switch, it will look like this:

Go ahead and remove the front cover to take a close look at what we are working with. It unhooks very easily:

The great things about these devices is that if you need to solder, it is one of the easiest things to solder given that all the connections are on the top and are quite large and well spaced out.

I would go ahead and wire the switch up to your socket and to test that it is functioning. Replace the top cover whilst wiring to make sure nothing gets broken.

Make sure to turn mains power off where you are working! If unsure, contact an electrician!

Wiring is fairly easy, just take your time and follow the instructions.

Turn the power back on and check if it works, my model has some blue LEDs when the device is powered on:

The LED’s might be flashing, this is OK and means the device is in pairing mode.

Once installed, you can now try Tuya-Convert to see if you get the easy road or not. Follow the previous post here for how to use Tuya-Convert.

If you have managed to use Tuya-Convert, great! Skip ahead to the software section.

If Tuya-Convert did not work, we need to solder. As mentioned above, this is a great device for soldering.

Follow this guide here for how to solder. It is a different product but the procedure is the exact same. Follow up to before creating the ESPHome firmware section, we are going to be using Tasmota here instead of ESPHome.

Download the latest Tasmota from here. The standard Sonoff version is suitable for this. After you have backed up the original firmware, run this to flash your module with Tasmota:

esptool --port YOUR_COM_PORT write_flash -fs 1MB -fm dout 0x0 sonoff.bin

esptool --port /dev/YOUR_COM_PORT write_flash -fs 1MB -fm dout 0x0 sonoff.bin

Tasmota should now be installed on your wifi dimmer switch.

To confirm, power cycle the device and search for wireless networks. You should have a “sonoff-xxx” Wifi network listed.


Now that we have a base install of Tasmota installed, we need to do a little setup.

Search for Wifi networks on your laptop or phone, join the Wifi network called “sonoff-xxx”. Open your browser and navigate to which should present you with this page:

Enter your wifi details and ensure to double check them before saving. If you get them wrong you will need to reflash.

Press save, your module will reboot after a few seconds. You need to rejoin your own Wifi network at this point, then navigate to the new IP address and open the webpage which will look like this:

Navigate to the configuration menu, then configure module. Luckily for us, someone else has figured out the pinout for us. From the drop down, choose “Tuya Dimmer (54)” and hit save. The module will restart again, navigate back to Configuration, Configure module and check it looks like this:

Go back to the home/start screen and give it a test, click on the number one. Your light should activate at this point. Go ahead and test the dimming function as well to ensure that works. Make sure your bulb is dim-able!

If the test worked fine, its now time to configure MQTT for Home Assistant to be able to control it.

Go to Configuration, MQTT and fill out your MQTT server details:

You can edit the default topic field to suit your environment, you might want to give this a suitable name for where you are going to place this. This is going to be the bathroom light for me so I’ve given it then name “bathroom” so that its obvious. You can also edit the full topic field if you prefer.

Save and let the module restart. We will now edit our config file for Home Assistant.

Add the following to your configuration.yaml:

  - platform: mqtt
    name: "Bathroom"
    command_topic: "cmnd/bathroom/POWER"
    availability_topic: "tele/bathroom/LWT"
    brightness_command_topic: "cmnd/bathroom/DIMMER"
    brightness_scale: 100
    brightness_state_topic: "stat/bathroom/RESULT"
    brightness_value_template: '{{ value_json.Dimmer }}'
    state_topic: "stat/bathroom/POWER1"
    state_value_template: '{{value_json.POWER1}}'
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false
    qos: 1

If you changed your topics in the MQTT setup then make sure to change them here.

Save and restart Home Assistant.

Go to Developer tools, states and check that “light.bathroom” (or whatever name you gave it) shows up.

Well done, you have successfully added a wifi dimmer switch to your setup!

Want to support me?

If you like the content I put out and would like to support me, you can do so using the options below.

I can't state enough how much any support is greatly appreciated and will go directly back into funding new/bigger projects and website upkeep.

Tagged , , , ,
  1. ronald


    I have the same switch but some how I am unable to flash it.
    I have tried using tuya-convert as well as soldering.

    When soldering I do see that the device is in programm mode (all 3 blue leds are on and in the top also a green led.) But Unable to read flash with esptool

    Any suggestions?

    1. Lewis Barclay

      Hi Ronald,

      Did you manage to get the LEDs flashing? This is required for it to be in pairing mode! I found these ones tricky to get into pairing mode just by trial and error

  2. ronald

    I did manage to get the led flashing (by holding down the minus button for 10 seconds of maybe some more) but tuya-convert did not connect. (or better said the device did not connect to the wifi.

    I have also tried using soldering option but esptool is unable to communicate with the device..

  3. ronald

    I have found my issue.

    I needed to short two pins (in the top left corner, 4 pins on a row and connect the bottom 2)

    That puts the device in program mode (showing only 1 green light)

  4. ronald

    The problem I am facing at this time is that there is no Tuya Dimmer (54) as a module (tasmota v8.3.1) So I am looking for the correct settings 🙂

    1. Lewis Barclay

      Which version of tasmota did you install, I’m going to assume the minimal version? All you should need to do is upload the normal version (which contains more muscles by default) and it should be there

  5. au190

    Hi Ronald,

    I have the same issue, I solderd the pins to the serial, but my device would not connect 🙁
    The green led is ON.

    I tryed with Arduino IDE (flash size: 4M (1M SPIFFS) no success.
    The same config its working wiht normal ESP8266.

    Thx for any advice.

  6. Jason

    I have replaced my home router and now my YDM_WIFI_SV4 switch shows as disconnected with the up switch a lighter blue colour.

    How do I get the device reset or back into pairing mode?

    Thank you

  7. Mat

    Lewis – great post. Only a Brit would call the need for light dimming “niche” 🙂

    (I say that as a Brit who is more than used to crap Victorian bathroom plumbing, house wiring schemes that are based on wartime scarcity of copper, etc…)

    Anyway I’m building a new home and I want that architectural thing of having every light dimmable, at 40 circuits that’s a lot of dimmers. I may be going with Tuya modules located centrally. Here are my two questions.

    1) Have you ever tried to flash one of those cheap chinese dimmer modules?
    2) Would you trust them, from a safety point of view (i.e. they are not subject to the same level of regulations as here, overload protection, temperature cut-out, galvanic isolation, etc…)?

    1. Lewis Barclay

      Hey Mat!

      Sorry took so long to get back, didn’t notice this comment in the queue!

      Haha that’s very true about the dimmer reference!

      To answer the first question, this is a “chinese” module technically, it was originally a Tuya module. I’ve used this module for over a year now and now issues! As for the second question, I wouldn’t like to answer that, I’m no where near qualified enough to give my opinion!

  8. Mike


    in the pic there are 4 pin sockets at the top left… are these anthing to do with 3.3/gnd/rx/tx ? the sonoff’s seem to have these and I can nornally just put a jumper pin cable in and can totally avoid having to solder anything on theirs like this… anyone know if they are simillar? what else would they be for?

    they are not lablled on the reverse side??

    ( I hate having to solder those little things… :/ )

  9. Bob

    I was able to flash the device and I can connect and control with Tasmota. But I seem to have two issues.

    What works;
    I seem to be able to control the device from Tasmota, I have a slider which moves and I see in the console;
    so good to here. The unit also turns off fine with the toggle and shows this in the console.

    What doesn’t work;
    1. If I change the dimmer up/down via the switch, I get no output of this in the logs.
    2. When off, all lights a blue. When on, the middle one is red (for turning off I assumed). But the other two and not the same blue. I think the top button has both the blue and green led on, so is cyan? This looks odd and not right… is this meant to do this? It would be better if it was blue like the lower one and looks symmetrical. as you press the lower one, it goes red on each press, the upper one goes weird color (not red) I think because the green is on.

    1 is a real problem, 2 is cosmetic i guess, but ruins it’s look a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *