Home Home Automation Flashing Tasmota on 4CH R3 & 4CHPRO R3

Flashing Tasmota on 4CH R3 & 4CHPRO R3

No DIY? No problem

4CH R3 & 4CHPRO R3 (review) despite being on R3 revision, arrived without DIY mode in plans! That’s ok! We are used to flashing these anyway so this is what I’m going to do! I’m going to flash Tasmota on 4CH R3 & 4CHPRO R3 to make these mine. It only takes a couple of moments.

Tasmota on 4CH R3 & 4CHPRO R3

In my previous article, I mapped all the important pins of ESP8285 in case the Tasmota configs from R2 revision won’t match the new Sonoff boards. Since I’m not 100% sure what I’m going to use the 4CH R3 & 4CHPRO R3 for I will also add a female header to the board. Just in case I need to add a sensor or two in the future. There is plenty of space inside – so let’s do that.

For this job you will need:

  • FTD programmer (this one is great)
  • soldering iron (I used YIHUA 992DA+ also check the TS80 out!)
  • jumper cables and female header (standard pitch)

Since Tasmotizer, flashing procedure is super simple. All pins needed are exposed on the PCB so I can flash Tasmota on 4CH R3 & 4CHPRO R3 without any hassle.

FTD12324CHR34CHPROR3
VccVccVcc
GNDGNDGND
GNDButton 1Button 1
RXTXTX
TXRXRX

Buy FT232RL Serial adapter

Buy it using these links to support NotEnoughTech.

Do not power on the device from mains. FTD1232 is more than capable of powering the ESP8285. Make sure to connect all pins correctly. Despite the similarities, the 4CH R3 & 4CHPRO R3 dev pads are reversed.

To put 4CH R3 & 4CHPRO R3 into flash mode, pull out GND or Vcc pin press and hold Button1 (relay 1) and power on the device. The WiFi LED should be turned off. I tried to make a backup with Tasmotizer, but I noticed that Tasmotizer would hang once the backup image was generated. If this happens to you, simply Abort at 100% – you should see the .bin backup file already in your folder.

Restart the process and this time, DO NOT select the backup option – Tasmotizer should continue as normal. The process will only last a couple of moments. If you cannot connect to the board – double-check the polarity of RX and TX.

Once Tasmota on 4CH R3 & 4CHPRO R3 is present, you can restart the Sonoff board (this time without pressing down the button) and use Tasmotizer Configuration to provide WiFI and MQTT credentials and pick the correct template module for your board. Tasmota on 4CH R3 & 4CHPRO R3 use 4CH &4CHPRO configs respectively.

4CH R3 & 4CHPRO R3 in NodeRED

Now that boards are truly mine, I will show you how to control the relays and replicate basic functions of the eWeLink app. I’m going to use MQTT for this, but you can also connect via REST API. Please note that RF component on 4CHPRO R3 is completely separate and the paired remote survived the firmware reflash.

Just note that I swap my topic (4CHPRO) and prefix (cmnd|stat|tele) around in Tasmota MQTT configuration.

Controlling Relays

The basic control is trivial. Tasmota takes the following payloads to toggle the relays: ON|OFF 1|0 true|false. To control the relay you have to pass the msg.payload to appropriate MQTT topic:

//relay1
msg.payloyad = true;
msg.topic = "4CHPRO/cmnd/POWER1";
return msg;
//relay2
msg.payloyad = true;
msg.topic = "4CHPRO/cmnd/POWER2";
return msg;

and so on. To get the relay status you can subscribe to 2 different topics depending on the scope of the feedback that you are interested in.

"4CHPRO/stat/RESULT"  //JSON updates from all 4 relays
"4CHPRO/stat/POWER1" //string update from relay 1
//request status update 
"4CHPRO/cmnd/POWER0" //submit an empty payload

Now that we have basics complete, let’s move to more advanced features!

Inching and interlocking

Inching [turn it on|off, wait some time, toggle it back]is simple in concept, but slightly more difficult in practice thing to do. Fortunately, I have it already covered in my previous article (see how easy it is now when you have a bunch of boring stuff made already?) so it’s as simple as dragging the node in the right place.

I’m dealing with 4 relays so I have to use for inching nodes. I modified the code to match the NodeRED 1.1 release and included the timer in the Setup of each function node so you can have independent inching timers for each channel.

Interlocking [turn on relay, turn off others] the biggest issue I had with this setup was updating the switches. I wish there was a way to simply update the state of the switch without sending the payload each time.

To make it work, only valid payloads are passed over to MQTT node. By valid, I mean payloads that doesn’t have “feedback” as topic. This way I’m able to differentiate the messages originating from the 2nd outcome, and preventing lops from happening.

var object1 = {};
var object2 = {};
var object3 = {};

var functionOutput2 = {};

return [ [object1, object2, object3], functionOutput2];

There is a way of issuing multiple payloads by the same function node. To do that you have to return the array of objects. I used this to send the false|true payloads to specified by MQTT topics.

if(msg.topic !== "feedback"){
//relay 1 OFF
    var r1 = {payload: false, topic:"4CHPRO/cmnd/POWER1" };
//relay 2 OFF
    var r2 = {payload: false, topic:"4CHPRO/cmnd/POWER2" };
//relay 3 OFF
    var r3 = {payload: false, topic:"4CHPRO/cmnd/POWER3" };
//relay 4 ON
    var r4 = {payload: true, topic:"4CHPRO/cmnd/POWER4" };

    var msg2 = {payload: false, topic: "feedback"}; 
    
return [[r1, r2, r3, r4], msg2];
}

Timers

I’m glad I wrote about this previously as well as timers are a pain in the neck to implement. You can deploy the dashboard timer to control when the relay goes on and off. It uses schedex node which you will need to install to make it work.

If you need more than one timer, you will need to edit some code to make the timers unique (just the timer ID variable. This way, you can have timer for each channel.

Alexa and Google Assistant

Tasmota on 4CH R3 & 4CHPRO R3 can be controlled by Alexa or Google Assistant. I described both methods in the past extensively, so if you read the Alexa in NodeRED and Google Assistant in NodeRED you will have no problems applying the skills yourself.

In a nutshell, you have to create and name 4 devices, one for each relay. You can refer to the relays by name by calling smart assistant commands "Turn the X on|off".

Final thoughts

Flashing Tasmota on 4CH R3 & 4CHPRO R3 takes about 10 min with all soldering required. Since there are no plans for DIY, I didn’t even blink and both units had been flashed as soon as finished my review. If you got the 4CHPRO R3 you can still get the benefit of eWeLink app through RF433 and Sonoff RF bridge (review). Down the line, I want to have more than one 3D printer, so I will use 4CHPRO to control the power remotely. Let me know what would you use these for in this Reddit 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

Awesome time with Wio Terminal

0
Wio Terminal from SeeedStudio is a great all-in-one development board that doesn't require soldering skills to get started with.

Flashing Tasmota on Sonoff ZigBee Bridge

0
How to flash Tasmota on Sonoff ZigBee Bridge to enable it for NodeRED and Home Assistant

Flashing Tasmota on Novostella smart bulb & floodlights

0
Flashing Tasmota on Tasmota on Novostella smart bulb & floodlights - it's quick simple and rewarding - here is how to use lights in NodeRED

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?