Home Home Automation Flashing Tasmota on Sonoff POW R2

Flashing Tasmota on Sonoff POW R2

Make it yours!

It was a matter of moments before I decided to ditch the eWeLink app and flash Tasmota on Sonoff POW 2. If you are interested in off the box functionality, take a look at the hands-on post. I’m going to turn my soldering iron on and start hacking. We all knew this was coming.

Modifying PCB on Sonoff POW 2

I have to give it to the ITEAD guys, they made a splendid job in making this Sonoff board hackable. All you have to do is to add the female header or male pins to the dev pads and you are off to the races.

I had female headers available so I picked a 1×6 header and soldered it neatly to the board. It’s a 5 min job, even if you have to wait for your soldering iron to heat up. It used to be the case, but not any more thanks to YIHUA 992DA+.

I’m sure you have noticed neatly labelled pins on the PCB. For a moment, I wondered where is GPIO00, which is needed for Tasmota, but a quick inspection of the ESP8266EX on the PCB reveals that the pin is mapped to the physical button! Awesome!

Flashing Tasmota on Sonoff POW 2

Tasmotizer tool makes flashing a breeze, so use this guide to flash the firmware and configure Tasmot for Sonoff POW 2. I would strongly recommend, that you back up your firmware first and rename it to match the device you are backing up. Consider using a permanent pen to mark your device accordingly (inside the enclosure?) as the backup of the firmware is device-specific.

DO NOT connect the Sonoff POW to mains during the operation. FTD1232 is more than capable to keep the ESP8266 alive for the flash.

Sonoff POWFTD1232
VCC3.3V (or VCC)
GNDGND
RXTX
TXRX

Buy Sonoff POWR2

Buy it using these links to support NotEnoughTech.

Using Tasmota on Sonoff POW 2

If the flash has been successful and you didn’t configure Tasmota on Sonoff POW R2 it will advertise as new AP. Connect to it and load the configuration page. The device’s IP should be 192.168.4.1 but double-check this in the WiFi manager. You are looking for the gateway IP address.

The first configuration mage will ask you for the WiFi credentials. Fill that in and wait for the Sonoff to reboot. Remember, at this point, your Sonoff POW R2 will have a new IP assigned to it by the router. In the tasmota screen, go to Configuration/Configure Module and select the Sonoff POW R2 (or POW if you are using older board). This will map the buttons, lights and power consumption details.

MQTT

It’s the most convenient (but not only) connection protocol for your Sonoff, visit Configuration/Configure MQTT to connect to your broker. I recommend the following changes:

  • client ID
  • topic
  • reverse %prefix%/ %topic%/ to %topic%/%prefix%/

I’m swapping the topic and prefix around as I find it more convenient to read. Don’t worry too much about this, as the correct topic format is visible in the Console option in the Tasmota firmware. Copy it from there to your MQTT setup.

The MQTT topics will depend on your configuration, so you have to adjust the topics in my examples. I have included some basic flows in my NodeRED, so you can see how you can trigger the relay and how you can intercept the state and power use data.

The MQTT rate of data is set by default to 300 sec. If you need the energy info posted more often, check out the Configuration/Configure Logging menu and adjust the Telemetry value.

HTTP

MQTT is not the only way to control the device. You can do so with HTTP endpoints. If you want to secure the HTTP endpoints with a password (which you should), visit the Configuration/Configure Other, menu. To create the HTTP POST Request use the format below.

https://xxx.xxx.xxx.xxx/cm?cmnd=Power%20TOGGLE 
xxx.xxx.xxx.xxx = Sonoff's IP
Power = command type
TOGGLE = value

https://xxx.xxx.xxx.xxx/cm?&user=USERNAME&password=PASSWORD&cmnd=Power%20On USERNAME,PASSWORD = use your web access credentials in sonoff settings
xxx.xxx.xxx.xxx = Sonoff's IP
Power = command type
On = value

//Get power info
https://xxx.xxx.xxx.xxx/cm?&user=USERNAME&password=PASSWORD&cmnd=Status%208
USERNAME,PASSWORD = use your web access credentials in sonoff settings
xxx.xxx.xxx.xxx = Sonoff's IP
Status = command type
8 = value

In this post, you will find the list of all commands that you can issue. The list is long and the commands listed can take more than one parameter. 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.

Conclusion

Tasmota on Sonoff POW R2 is the way to go! I’m going to use the new device for 2 projects. One Sonoff POW R2 will drive my 3D Printer and provide power use calculations for each print in my mobile notifications project. The other one will monitor my washing machine, as I’m constantly forgetting about it. What other uses could you think of? Let me know in the Reddit discussion thread.

Project Download

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

PayPal

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

Patreon

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

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated in style with crypto-currency

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?

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

Best Automation Projects

ESP8266 WIFI lights under $5

0
Your Sonoff device can't do this!

Free wireless doorbell (Amazon Dash button hack)

0
The most terrifying situation I can imagine* is missing a parcel

New Amazon Dash Buttons

0
You can teach new buttons old tricks!

ESP8266 ceiling light – demo

0
Testing the ESP8266 as a WIFI light controller

Try Tasker and Raspberry Pi for your home automation needs!

0
Raspberry Pi can help you with your Tasker profiles

Smart Home

Adding Sonoff sensors in Zigbee2MQTT and other systems

0
Can you use Sonoff sensors in Zigbee2MQTT and other ecosystems? Trying Tuya, Xiaomi, IKEA Tradfi and CC2531

Sonoff Zigbee sensors

0
I'm checking out Sonoff ZigBee sensors by ITEAD - what's the budget sensors like?

Exciting changes in NodeRED 1.1.0

0
Exciting changes in NodeRED 1.1.0 - you can update your installation now and explore new features yourself.

Flashing Tasmota on 4CH R3 & 4CHPRO R3

0
Flashing Tasmota on 4CH R3 & 4CHPRO R3 takes only a couple of minutes and you can enjoy the custom firmware and NodeRED setup

Sonoff 4CH & 4CHPRO joins R3 revision

0
Everything you need to know about Sonoff 4CH & 4CHPRO and the new re