HomeHome AutomationUsing Sonoff Tasmota software

Using Sonoff Tasmota software

Adding Tasmota experience to Sonoff devices.

Encouraged by the latest ESP hacks and your comments, I decided to take a look at the Sonoff Tasmota software too. I love to learn by trial and error and writing custom code for ESP based devices is a perfect way of experimenting and learning new skills, but sometimes you just want to add extra functionality to the device without writing a new driver each time. Sonoff Tasmota software is just that. If you wonder what can you do with the Tasmota Sonoff – take a look at the NEST-alike thermostat project.

Sonoff Tasmota software

The Sonoff Tasmota software can be flashed on most of the Sonoff devices. I’m going to use Sonoff Basic, which is, well… pretty basic. Out of the box, this $5 switch does 1 thing: turns the relay on and off. It has an Android/AppleOS support and integration with Alexa and Google Home.

Buy FT232RL Serial adapter

Buy it using these links to support NotEnoughTech.

This pretty basic gadget has an ESP8266 brain. This means, there is so much more potential inside that case. Before we get to the software part, take a look at the Sonoff Hacking guide where I show you how to backup and flash custom software.

The main advantages of the Sonoff Tasmota software include:

  • full local network compatibility
  • support for MQTT protocol
  • support for HTTP request
  • the utilisation of extra GPIO pins (GPIO14 on Sonoff basic)
  • support for most common sensors
  • OTA updates
  • Belkin WeMo and Phillips Hue emulation
  • Timers
  • Domoticz integration

As you can see, the list is impressive for free software that you can simply download off the internet. There is something missing on this list. There is no native integration for Alexa or Google Home. While this is a bummer (I’m pretty sure a commercial release of Sonoff Tasmota would include the licence for that), a bit of IFTTT tinkering will enable both.

Flashing Sonoff Tasmota

Easy Flash with Tasmotizer

Use the latest Tasmotizer Guide to flash and configure your tasmota device. It will save you time and headaches. Once flashed, send a config file (see that tutorial for details) with device configuration or follow the details below to configure your Sonoff manually.

This should take less than a minute. Once the firmware is flashed, disconnect the serial programmer and power the Sonoff Basic using the power cable (note that you won’t be able to get to the configuration page with the serial (RX/TX) connected.

Sonoff Tasmota Setup and configuration

To put the Sonoff Basic into the configuration mode you have to press the button four times (quickly, until the light is flashing). There is more than one function of the button, here is the breakdown:

Button press x timesFunctionLED behaviour
1toggle the relay ON/OFFblinks twice
2toggle the 2nd relay ON/OFF (if available)blinks twice
3Smart WiFi config using the Android appLED blinks
4Set Sonoff in AP modeLED blinks
5WPS setupLED blinks
6restarts the Sonoff 
7OTA download of firmwaresteady lit up
40secFactory reset 

Pick your way of adding the WiFi credentials and the Sonoff config page will be available under:

http://xxx.xxx.xxx.xxx/cn      //fill in the xxx with your Sonoff's IP

From there, things are pretty straightforward. Pick a menu, add your details, rinse and repeat until you are done.

Every menu option is clear and self-explanatory, you should not have any problems with the configuration. It’s worth noting your MQTT configuration, so you could set up the controls in NodeRED.

MQTT control

The full list of commands is available here. In a nutshell, to control the Sonoff device via MQTT protocol you have to configure the MQTT topics correctly.

%topic%  (sonoff)
sonoff/cmnd/power1   //controlling relay1 

Full topic
sonoff/stat/RESULT   //receiving status message

The query submitted back via MQTT looks like this:


HTTP control

It is also possible (despite the MQTT being the default control protocol to control the Sonoff device with the HTTP requests. The requests will contain the username and password if you locked the Sonoff Tasmota web interface with it.

Here is an example:

xxx.xxx.xxx.xxx = Sonoff's IP
Power = command type
TOGGLE = value

USERNAME,PASSWORD = use your web access credentials
xxx.xxx.xxx.xxx = Sonoff's IP
Power = command type
TOGGLE = value

The response given will contain a JSON object with the current device state. If you want to learn more about JSON I have the basic tutorial for you.

Sonoff Tasmota  – Google Home and Alexa integration

While the smart speaker functionality isn’t there, you can simply add the Alexa and the Google Home integration to your NodeRED setup. You can use IFTTT to send a web request, which in turn will transform your spoken command in a webhook.

Google Home, Sonoff Tasmota & IFTTT

Create an IFTTT trigger with a word phrase (don’t use Sonoff name, Google thinks you are saying “song off“):

Turn the switch $

And link this to a webhook:


with a JSON type message:


Then use the HTTP POST (in) node in your NodeRED setup. The message containing ON/OFF will be stored under msg.payload.sonoff and you can use a function node to convert this for the full URL to control the Sonoff device:

var x = msg.payload.sonoff;
msg.url = "https://sonoff_IP/cm?cmnd=Power%20"+ x;
return msg;

Alexa, Sonoff Tasmota and NodeRED alexa-home node.

The alexa-home node is great, as you can add the devices very quickly. Log in and create a new device (ON/OFF) and drop the node into the NodeRED setup. The default message from the alexa-home is true/false – so I’m going to use switch node to monitor these replies and issue a correct URL for the HTTP POST request.

Buy Sonoff Basic R3

Buy it using these links to support NotEnoughTech.


Sonoff Tasmota firmware is a very quick and painless way of controlling Sonoff devices. It takes moments to set up and support for the MQTT and HTTP makes it compatible with most of the automation hubs. If you can live with the 3rd party smart speaker support you will be very happy with the transition to Tasmota based firmware.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services


Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

To server or not to server? That's a very silly question!

Best Automation Projects

Tuya SDK for beginners: Intro to Tuya Cloud API

Working with Tuya Cloud API. A guide to Cloud automation for beginners, get started with REST!

NEST your old thermostat under $5

Nest-ing up your older thermostat under $5

DIY Smart Washing Machine – for about 15 bucks!

Learn how to add washing machine notifications to your Google Home on the cheap

Nora – Google Assistant in NodeRED

Integrate Google Assistant with NodeRED thanks to Nora - NodeRED home automation

Things they don’t tell you about IKEA Trådfri

There are things you should know about IKEA Tradfri before you make your purchase

Smart Home

SwitchBot Lock: Smart security in seconds

Smart lock that takes 15 min to install and 2 years to enjoy on a single charge: SwitchBot Lock

“Secret” Zigbee2MQTT Dashboard

Zigbee2MQTT Dashboard
I can't believe no one told me about this sooner. After 2 years, I'm making sure you are not left in the same as me, cave - use Zigbee2MQTT Dashboard.

Smart Socket – IFREEQ [Tuya Expo edition]

Thanks to Tuya Expo, you can browse 100s of products that won't break your home automation budget - let's start with IFREEQ Smart Plug

Never mind Evvr Smart Switch, look at that panel!

Evvr Smart Switch brings 2 part module to enable no-neutral ZigBee and Z-Wave connections to your wall switches turning them smart without compromise!

Aqara TRV will support Matter!

Aqara just released Aqara TRV - their ZigBee 3.0 thermostatic radiator valve to control your heating - with... Matter support