Flashing the Sonoff POWR3 with Tasmota

DezeStijn5 mins read

The Sonoff POWR3

I love being able to control power on a circuit using a smart relais.

I already have some Shelly Pro devices in my home. But they are limited to 16A per channel. And while that is sufficient for lighting circuits, which are protected with a 16A breaker here in Belgium, it doesn’t suffice for 20A socket circuits.

I want to automate a circuit going from my house to some sockets outside so that I can either “lock” them to prevent people stealing energy or use them for e.g. automated Christmas lights. So I needed a smart relais capable of at least 20A. Another option would’ve been something like a Shelly Pro EM and a contactor, but that would’ve been a bit too clunky and more expensive.

Luckily, Sonoff have a device that can do power metering and has a relais capable of handling 25A (5,500W): the Sonoff POWR3.

Sonoff POWR3
Sonoff POWR3

Flashing with Tasmota

The Sonoff POWR3 comes with the default Sonoff firmware. This includes support for Google Assistant, Alexa and even Home Assistant.

I just prefer to use open source firmware which works locally, doesn’t need or attempt to call a cloud, and won’t be bricked remotely. That’s why I’ll flash the device with Tasmota.

Luckily, Sonoff have made it extremely easy to wire up the POWR3 to your flasher 🚀

Sonoff POWR3 opened up
Sonoff POWR3 exposing GPIO

All you will need are:

Connecting the POWR3

First of all: make sure the POWR3 is NOT connected to mains or you’ll blow your FTDI up.

Hook your FTDI up to the POWR3 as follows:

POWR3FTDI
3V3VCC
GNDGND
ETXRX
ERXTX

GPIO connected to the POWR3
GPIO on the POWR3
GPIO connected to the FTDI
GPIO on the FTDI

Note that black and brown are interchanged between these 2 pictures ;)

Flashing the POWR3

Now plugin the FTDI in your computer whilst holding the FLASH button to boot up the ESP in flash mode.

Then start tasmotizer and select the correct port (e.g. ttyUSBx on Linux or COMx on Windows).

It’s best to take a backup of the current flash, in case you’d ever want to return to it’s stock configuration. We’ll wipe the flash before flashing, so there’re won’t be a return path afterwards.

The tasmota-4M binary will fit on the POWR3 because it has 4MB of flash, but the regular tasmota.bin suffices for this installation.

Tasmotizer settings
Tasmotizer settings

If everthing is configured correctly, you can go ahead and press Tasmotize!.

Setting up Tasmota

Connecting the POWR3 to your WiFi network

Once you power cycle the –now flashed– Sonoff POWR3, it should start broadcasting a WiFi network with the SSID tasmota_XXXXXX-#### (where XXXXXX is a string derived from the device’s MAC address and #### is a number). Connect with your computer or smartphone to this network.

You’ll likely receive a pop-up stating you need to login onto the network, or your browser will automatically open. If not, open your browser and go to http://192.168.4.1 to open the Tasmota Web Config.

Select your WiFi network from the list, or type the SSID manually, along with the password in its respective textbox.

Pressing Save will restart the device and have it connect to your network. If successful, the Tasmota WiFi network will dissappear and the device will appear on your network.

The Tasmota Web UI should now also display the IP address of the device and will likely redirect you to it. If not, and the device is still connected over Serial to your computer, you can press the Get IP button in Tasmotizer to retrieve the device’s IP address. Otherwise, you’ll have to look in your routers DHCP Lease table

Configuring Tasmota

Now we need to tell Tasmota how to read the power metering data and how to control the relais. The easiest way to do this is using a pre-configured template.

Go to Configuration > Configure Other and past the following template in the text box:
{"NAME":"Sonoff POWR3","GPIO":[32,3072,0,3104,0,0,0,0,256,320,0,1,1,1],"FLAG":0,"BASE":43}

Check the Activate box and press Save.

The device will reboot and on the “home page” you’ll now see the power metering information as well as a On/Off toggle button for the relais.

Power calibration

I have yet to confirm the accuracy of the measurements right after flashing.

If you notice incorrect readings or just want to be sure your device is properly calibrated, you can follow this Tamosta guide on Power Monitoring Calibration.

To do this, you’ll need something with a consistent load (e.g. a decent incandescent light bulb) and preferably something that can accurately measure the power draw (like a multimeter or a power metering socket).

Connecting with Home Assistant

MQTT broker

To connect Tasmota device to your Home Assistant instance, you first need to setup a MQTT broker. This is outside the scope of this blog post, but I covered this already in my HA Container series as well as a Getting started with Shelly article.

Tasmota MQTT config

Go back to Configuration > Configure Other and check MQTT Enable.

Then fill in the MQTT broker information. Host, User and Password should be the only fields you need to update. Only change the other fields if you know what you’re doing.

See the Home Assistant documentation for more infomation.

Add device to Home Assistant

Saving this config, your POWR3 should no send updates to your MQTT broker which will cause Home Assistant to auto-detect it.

Go the the Settings > Devices & services, find the detected Tasmota config and click Add. Add the device to the correct Area and press Finish.

And you’re all set!

Now you can control the Sonoff POWR3 from Home Assistant. Use it in automations, e.g. to turn on Christmas lights in the evening and off again at night, or use it to turn on a heater when you have sufficient solar production. Plenty of stuff you can do now.

Enjoy!