Sonoff RF With Tasmota Firmware in Homeassistant

If you have dabbled in Home Automation you’ve probably heard of Sonoff.  They make all manner of home automation devices.  I’ve been largely ambivalent towards them as I prefer Z-Wave devices and hackable outlets to power most of my home automation needs.   But I kept READING ABOUT THEM.  Everywhere you turn on the Home Automation sites people are talking about Sonoff and something called “Tasmota Firmware”.

I decided to see what all the fuss was about and ponied up the requisite $11 for a Sonoff RF from Amazon.  I’ve been on a 433 MHz device kick lately and I like the fact that radio controlled devices can work even when the network goes down.  As long as a Raspberry Pi is on that delivers that radio burst…….BOOM……the lights go on and off.

So I got one just to play with.  The interesting thing to me is that not only is it 433 MHz radio controlled it also works with WiFI and if you flash it with Tasmota Firmware it will do MQTT as well.   Okay, I’m getting slightly impressed here.

Well, that’s the thing.  You have to flash it.  There are all manner of videos and tutorials out there but I like to keep it simple.  To do this you need:

Ok, one thing I haven’t explained is WHY do you want to flash the firmware to Tasmota?  Actually the stock firmware works fine and works with a smart phone app.  That’s fine and dandy but suppose you get a Sonoff, then a LIFx smart bulb or Phillips Hue, then something else.  Pretty soon you have a bunch of apps that don’t really interface with each other.   Flashing the firmware makes it easier (in my opinion) to incorporate into my Home Automation software, HomeAssistant.

So after you install Arduino IDE and download the Source Code.zip file you need to unzip the file and move it to where Arduino can find the libraries it needs.  (Also I’m working on the assumption that you’ve used Arduino before and know how to flash an Internet of Things (IoT) chip.

Anyway navigate to the Sonoff Tasmota folder > lib and then copy everything inside that folder and move it to the Arduino Library folder.

The folder location on my Mac is Documents > Arduino > Libraries.  Just dump all those folders there.

Now go back to your unzipped source code folder and open the sonoff folder and then double click the sonoff.ino file.T

This part is optional but necessary and it makes things easier I think. Now click on the tab that says my_user_config.h and look through the file and add your wifi network SSID and password, also configure your MQTT server data here if you like.   Then when you flash it will automatically hook up to your network and you can start to configure it.  At a minimum you should add your wifi credentials, if not you won’t be able to find it to configure it.

sonoff Arduino (click to enlarge)

So now your sonoff.ino file is open and configured you now have to prepare to write the file.  Configure Arduino like this by going to the Tools Menu:

Almost there.  The only thing missing is your port.  You’ll have to plug the FTDI in to the computer and then figure out which Port is the one the FTDI is and then UNPLUG THE FTDI.

The next thing I should note is that before you flash the Sonoff make double damn sure it is NOT PLUGGED INTO THE WALL if you have already wired it up.  Flashing the chip while have 110v connected is a nice way to burn some stuff up.  DON’T DO IT.

Okay, now that the FTDI is UNPLUGGED you can hook the FTDI to your Sonoff board.

The bottom of the Sonoff board is labelled.  Make sure to hook it up correctly.

First make sure the jumper of the FTDI device is on the pin for 3.3 volts.

 

Now for the Sonoff end:

It’s not too hard.  See the four empty holes in the middle of the board.  They are from left to right…..GND, TX, RX, 3.3v

The only kicker here is that on the Sonoff you need to swap the TX and RX lines.  Think about it. If you hooked TX to TX and RX to RX stuff would just bang and clang together.   When you transmit something it has to be received and vice versa.  Hook it up like this:

Done deal.  No need to solder the pins in, just apply light pressure to hold them in place.  It will work, I promise.   Now that the FTDI is wired to the Sonoff you need to push down on the black button on the Sonoff THEN plug it into the computer.

 

Again, hold down the black button, plug in the FTDI and hit the UPLOAD button in Arduino.  The bottom of the page will show your progress.  Once you hit 100% you can unplug and you have a flashed Tasmota firmware Sonoff.

Arduino uploading (click to enlarge)

Yeah!  In my config I set a static IP address on my wireless network of 192.168.20.141. Plug that into your browser (your IP will likely be different).  You might have to find your Sonoff IP address by using an app like Fing.

Here’s my config page.  From here you should be able to toggle the sonoff to the on and off position and of course at this point the Sonoff input must be wired up and plugged into the wall socket.  This is what the config page looks like in the browser window. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Wow!  Cool beans.  Here’s a video of me using it with a remote and with MQTT code and on WiFi.

 

 

2 thoughts on “Sonoff RF With Tasmota Firmware in Homeassistant

  1. Bruce

    Excellent stuff, John. So much electronics everywhere, but at 73, I may “have missed the boat”! But I”ll keep reading your blogs. Keep them coming.

    Reply
  2. Guillaume Magnier

    Hello,

    I’ve just finished to flash my Sonoff RF and I don’t understand how to receive RF Signal.
    What is the configuration for this device in Tasmota ? How activate the RF receiver ?

    Thanks

    Reply

Leave a Reply

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