HomeHome AutomationFlashing 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 with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

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

client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image

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

Tuya SDK for beginners: Intro to Tuya Cloud API

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

NEST your old thermostat under $5

0
Nest-ing up your older thermostat under $5

Sonoff Zigbee Bridge – review

0
Sonoff line up will soon include Sonoff Zigbee Bridge and more Zigbee sensors - here is the first look

DIY Smart Washing Machine – for about 15 bucks!

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

Nora – Google Assistant in NodeRED

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

Smart Home

I damaged the cheapest Smart Socket with power metering for you

0
Sonoff S60 has an exeptional price for a smart socket with a power meter - I decided to check it out and see how flashable it is

The end of Tasmota? Sonoff SwitchMan M5 Matter

0
These are one of the least expensive Matter devices to automate your lights. Will Sonoff SwitchMan M5 Matter put an end to Tasmota?

Meros TRV to the rescue?

0
I got my hands on another TRV - this time from Meross. I heard good things about the brand so I wanted to see if Meross TRV would be good to manage smart heating.

Aqara brings Thread sensors but…

0
Aqara brings new Thread sensors to their ecosystem. First sensors to support Matter this way are Aqara Motion and Light Sensor P2 and Aqara Contact Sensor P2

Multi-lights for your ceiling from Aqara

0
This is the biggest light I held in my hands so far. It's ZigBee and it comes from Aqara - meet Aqara Ceiling Light T1M