
Thanks to the Sonoff 4CH Pro R2, I am embarking on the creation of a multi-area electric heating control managed by pilot wire; objective, order all this since Jeedom.

Finally, I add a Sonoff Dual, on the same principle, to add one more area. But for simplicity, this additional area will not be treated in this tutorial, the principle being identical to the rest.
Operating principle
Necessary equipment
- A Sonoff 4Ch PRO
- A Sonoff DUAL (optional if you want a 3rd zone)
- A Raspberry PI 2 (or any other version of Raspberry PI that supports Jeedom)
- A DIM 220vAC/5vDC rail power supply (or any other system to power the raspberry)
- A manual switching box (historical system or Jeedom) by Zone (optional)
Table of Contents |
Software configuration of the Sonoff 4CH
Flashing the Sonoff is essential
For this, I made a Article on how to flash the 4CH Pro R2. There are several tutorials on the web for flashing Sonoffs, I had not found explanations for the R2 version of the 4CH PRO, so I spotted the GPIO0 and proposed a method, here it is: Flash the Sonoff 4CH Pro R2
How it works for what you want to do (Switch S6 and K5)
The Sonoff must be configured so that each relay can be controlled directly without any link between them.
It is necessary to put:
- S6=1
- K5=1111

Setting up ESP Easy
Once the flashing is complete, ESP Easy must be configured:
Config tab and Controllers tab
- The explanation of these tabs is common to all Sonoffs and is given in this article: After Flashing, connect a Sonoff to the WIFI network and link to Jeedom
Hardware tab
In Hardware, Everything must be removed (the GPIOs of the I2C interface)
![]() |
Devices tab
In Devices, The 4 relays and 4 buttons can be configured:
![]() |
- Configuring a Relays :
![]() |
- Configuring a Push button (optional):
![]() |
- Bonus, here is the configuration for the Blue Led (optional) :
![]() |
Rules tab
- The configuration of the Rules makes it possible to define the state in which the heating will be positioned in the event of a reboot of the installation.
- To put it simply, I chose to put the whole installation in comfort (so all relays at 0) .

Cabling of the Sonoff 4CH
To be able to configure the pilot wires which control the heaters, it is necessary to install 2 head-to-head diodes per area, a good diagram worth all the explanations:

- To go further, read this article: Controlling your heating with a pilot wire
- Attention, if the Jeedom and Sonoff are placed on the inverter, the two phases will have to be clearly differentiated. The phases arriving on R1 to R4 must be those of the heaters.
Setting up a Google Calendar

The Google Calendar is used to plan changes in zone status.
Note: you can do exactly the same with other calendars like Microsoft 365, just enable sharing and retrieve the link to the ICS file
![]()
To keep the tutorial simple, only two states are ordered (but nothing prevents the implementation of the OFF and Off-Freeze):
- Mode Comfort
- Mode eco
I have created a separate account for managing the heating calendar but nothing prevents you from adding two calendars to your personal Google Calendar account.

Look to the left, there are two agendas:
- Ground floor
- floor
They correspond to the two areas I command.
The details of each area are as follows:


You have to wonder why I used such long sentences for each state and not a simple " eco or Comfort. As you will understand later, this makes it possible to distinguish the areas on the Jeedom screen but also to have understandable change-of-state information without reprocessing it.
On the agenda: floor, has two states:
- The heating of the top will pass on Eco
- The heating from the top will pass on Comfort
On the "R" agendaez de Chaussée, has two states:
- Bottom heating will pass on Eco
- The bottom heating will pass on Comfort
Configuring Jeedom's ESPEASY Plugin
Jeedom uses the ESPEASY plugin to link to equipment managed by ESP Easy.
![]()
When flashing Sonoff equipment and configuring ESP Easy, you have to think about configuring a control which sends the plug-in changes to the status of the devices. This configuration is explained in this Article.
Addition of ESPEASY equipment Controls Heating 1
![]() |
In this example, there are two pieces of equipment because I have the Sonoff 4Ch PRO and the Sonoff DUAL, for simplicity, I will only talk about the first device. Controls Heating 1.
Here are his orders:
![]() |
Note: : For the same configuration on a Sonoff Dual, GPIO5 and GPIO12 should be used, cf. the bonus on this page for relays 1 and 2.
Configuring Virtuals in Jeedom
In Jeedom, via the Virtual plugin, I created 6 virtual ones:
![]() |
The virtual Automatic heating

This virtual allows state changes to be blocked at any time.
![]() |
The virtual Orders Floor by Calendar
This virtual is not visible on the DashBoard, it makes it possible to make the link between a change of state of an area programmed in the Google Calendar and the concrete action of change of state (via the Scenario Top by Calendar).
Assuming that the Virtual Automatic heating=0, one command of Orders Floor by Calendar will have no effect. (tested in the scenario Top by Calendar)
High Automatic State can take 4 values:
- Comfort (0)
- Excluding Freeze (1)
- Judgment(2)
- Eco (3)
![]() |
Changes in the state of the virtual High Automatic State are captured by the scenario Top by Calendar who will make the link with the virtual floor
The virtual Low Orders by Calendar works the same way.
The virtual floor
This virtual displays thecondition of the floor area, offers 4 buttons for changing the status and informs the next change planned (in the Google Calendar)

High State can take 4 values:
- Comfort (0)
- Excluding Freeze (1)
- Judgment(2)
- Eco (3)
![]() |
Note: : The last command is information retrieved in the plugin ICS Calendar (see paragraph "Configuring the ICS Calendar plugin in Jeedom")
Setting up scenarios in Jeedom
![]() |
As for the other screens, I will detail the scenarios that concern the Heating Floor, scenarios relating to the Heating Annex is not dealt with in this tutorial and Heating Ground Floor works on the same principle as the Heating Floor.
The scenario Top by Calendar
This scenario is caused by: #[Heating Floor][Orders Floor by Calendar][High Automatic State]# i.e. an event resulting from the Google Calendar.
![]() |
This scenario is not very complicated. It modifies the Virtual floor if the Virtual Automatic heating is of course 1.
The Low Scenario by Calendar works the same way.
The scenario High – Comfort
This scenario is caused by: #[Heating Floor][Etage][High State]# = 0 (reminder 0 = Comfort, see Virtual floor)
![]() |
If we want to pass the pilot wire of the Upper Zone in Comfort, you have to put Relais2=OFF and Relais1=OFF (see explanation Pilot wire)
These commands are managed by the ESPEASY plugin, they control the relays of the Sonoff 4CH PRO. (see paragraph Addition of ESPEASY equipment Controls Heating 1)
Scenarios High – Eco, High – HG, High – Off
By similarity with High – Comfort, I let you find the triggers, however, here is the combination that makes it possible to have the right position of the relays according to the desired state:
- Top – Eco: R1ON and R2ON
- Top – HG: R1ON and R2OFF
- Top – Off: R1OFF and R2ON
Scenarios Bas – Comfort, Bas – Eco, Bas – HG, Bas – Off
By similarity with Top – xxx, scenarios Bottom – xxx it is enough to replace R1 by R3 and R2 by R4
| R1 ON | R2 ON | Pilot Thread 1
(High) |
eco |
| R1 ON | R2 OFF | Off-freeze | |
| R1 OFF | R2 ON | Off | |
| R1 OFF | R2 OFF | Comfort | |
| R3 ON | R4 ON |
Pilot Thread 2 (Base) |
eco |
| R3 ON | R4 OFF | Off-freeze | |
| R3 OFF | R4 ON | Off | |
| R3 OFF | R4 OFF | Comfort |
Configuring the ICS Calendar plugin in Jeedom
![]()
This plugin will make the link between Google Calendar and Jeedom.
Refer to the plugin documentation for any installation or configuration concerns.
You have to add the two Google Calendars in this plugin, here is my screen:
![]() |
The configuration of both Remote calendars is quite simple, I cannot go back to it.
I will focus on the events, the principle is that a event (transition from one zone to another) shall trigger a control to change the condition of the heaters connected to the pilot wire of the zone in question. I will return later in this tutorial on the states of the pilot wires and how they inform the heaters.
The 4 events (2 zones x 2 states) are built in exactly the same way, I will detail The heating from the top will pass on Comfort. By similarity, you will be able to program others.
![]() |
![]() |
The order #[Heating Floor][Orders Floor by Calendar][Comfort]# is a virtual command Orders Floor by Calendar
Some photos of the realization
Memory aid
- Rotary Inter Button (LAY7)

- Cabling of the selection box



















