
DSVT can be used for domestic hot water (DHW) production and other electric heating applications. However, in certain systems, the full available electric heating capacity is not always required.
In installations equipped with three independently switchable heating elements, heating capacity can be increased or reduced in stages according to the actual temperature demand.
For example, a heating assembly containing three 1500 W elements can provide three heating stages:
A single heating element may be sufficient to correct small temperature deviations, while additional elements can be activated following substantial hot water consumption or a larger temperature drop.
Staged control can be implemented using a separate dzVents script that operates alongside the first heating stage controlled by DSVT.
In a smaller domestic hot water tank, for example one with a capacity of approximately 150 litres, full heating power may not be necessary under all operating conditions.
With high heating power, the water surrounding the heating element may warm up faster than heat can be distributed throughout the tank, depending on its design.
If the temperature sensor is positioned unfavourably or internal water circulation is insufficient, the measured temperature may rise rapidly and then fall again as heat becomes more evenly distributed.
This can cause unnecessary heating on/off cycles.
Potential advantages of staged heating control include:
Important: the efficiency of electric resistance heating does not inherently improve when fewer heating elements are operating. The main benefits of staged control are better capacity matching and electrical load management.
Three-stage control is not limited to domestic hot water production.
For example, a properly designed electric water heating unit may contain three independently switchable heating elements, each rated at 1500 W.
In this configuration, the available heating capacities are 1500 W, 3000 W, and 4500 W.
The controller can activate the second and third heating elements according to the difference between the measured water temperature and the target temperature.
Three heating elements do not necessarily require a three-phase electrical supply, provided that the equipment is designed to support single-phase operation. However, the electrical installation must be capable of safely supplying the total simultaneous load.
Such equipment must be designed and connected with appropriate electrical and thermal protection.
DSVT can provide primary control of domestic hot water heating, including tank temperature targets and heating demand-based switching.
However, three-stage electric heating element control is a specialised supplementary function. In the solution described here, it is implemented using a separate dzVents script rather than being built directly into the DSVT plugin.
The operating principle is:
DSVT therefore remains responsible for primary heating demand control, while dzVents manages the additional electric heating capacity.
Five Domoticz devices are required:
DSVT provides a virtual temperature device named Tank current target temperature, with internal plugin Unit number 21.
Important: the dzVents script must use the actual Domoticz device identifiers (IDX), not the internal plugin Unit numbers.
The target temperature device should be enabled in Domoticz, and its availability to the script should be verified.
In the Domoticz interface, open:
Setup → More Options → Events
Create a new dzVents script and paste the code provided below.
Before saving, modify the device identifiers and control parameters to match your installation.
The configuration parameters are located near the beginning of the script:
local IDX_MASTER = 1758 local IDX_TEMP = 2262 local IDX_TARGET = 2264 local IDX_PHASE2 = 2479 local IDX_PHASE3 = 2480
The identifiers are:
The event monitoring list must also be modified:
on = {
devices = { 1758, 2262, 2264 }
}
This list determines which device changes trigger the script.
The three identifiers correspond to the DSVT-controlled primary heating stage, the actual water temperature, and the target temperature.
Whenever one of these devices changes, dzVents recalculates which heating stages should be active.
The second and third heating stages are controlled by two separate temperature difference thresholds.
The example script uses these default settings:
local DIFF_HIGH = 6 local DIFF_MID = 3 local HYSTERESIS = 1
The system calculates:
Temperature Difference = Target Temperature − Measured Water Temperature
The configured threshold for the second stage is 3°C, while the third stage uses 6°C.
Due to hysteresis, the actual activation and deactivation thresholds are different.
The switching logic uses strict inequalities, so reaching an exact threshold does not necessarily change the existing state.
Assume that the DHW target temperature is 50°C.
With the default settings, the following behaviour can be expected:
As the water temperature rises, the script switches off the additional elements according to the configured hysteresis.
If the primary DSVT heating switch turns off, the script immediately sends OFF commands to both additional heating stages.
Actual switching operations occur when dzVents is triggered by updates to the monitored devices.
Special attention must be paid to electrical and thermal safety when installing a multi-stage electric heating system.
Important requirements include:
Important: the example dzVents script is not an independent safety controller. The heating equipment must have electrical and overtemperature protection that operates independently of the software.
The script can be downloaded here: harom_fazis.lua.
Alternatively, the following code can be copied directly into a new dzVents script.
The code is based on the supplied example. The device identifiers must be adapted to your Domoticz installation.
return {
on = {
devices = { 1758, 2262, 2264 } -- monitored device IDX values
},
execute = function(domoticz, device)
------------------------------------------------------------------
-- PARAMETERS
------------------------------------------------------------------
local IDX_MASTER = 1758 -- first-stage switch IDX
local IDX_TEMP = 2262 -- actual tank temperature sensor IDX
local IDX_TARGET = 2264 -- target temperature device IDX
local IDX_PHASE2 = 2479 -- second-stage switch IDX
local IDX_PHASE3 = 2480 -- third-stage switch IDX
local DIFF_HIGH = 6 -- third-stage temperature difference
local DIFF_MID = 3 -- second-stage temperature difference
local HYSTERESIS = 1 -- switching hysteresis
------------------------------------------------------------------
-- DEVICES
------------------------------------------------------------------
local master = domoticz.devices(IDX_MASTER)
local tempDevice = domoticz.devices(IDX_TEMP)
local temp = tempDevice.temperature
local targetDevice = domoticz.devices(IDX_TARGET)
local target = targetDevice.temperature
local phase2 = domoticz.devices(IDX_PHASE2)
local phase3 = domoticz.devices(IDX_PHASE3)
------------------------------------------------------------------
-- MASTER OFF: SWITCH OFF ALL ADDITIONAL STAGES
------------------------------------------------------------------
if master.state == 'Off' then
phase2.switchOff()
phase3.switchOff()
domoticz.log("Master OFF, additional stages disabled", domoticz.LOG_INFO)
return
end
------------------------------------------------------------------
-- TEMPERATURE DIFFERENCE
------------------------------------------------------------------
local diff = target - temp
domoticz.log("Temperature difference = " .. diff, domoticz.LOG_INFO)
local function should_turn_on(th)
return diff > (th + HYSTERESIS)
end
local function should_turn_off(th)
return diff < (th - HYSTERESIS)
end
------------------------------------------------------------------
-- THIRD STAGE (DIFF_HIGH)
------------------------------------------------------------------
if phase3.state == 'Off' then
if should_turn_on(DIFF_HIGH) then
phase3.switchOn()
domoticz.log("Third stage ON", domoticz.LOG_INFO)
end
else
if should_turn_off(DIFF_HIGH) then
phase3.switchOff()
domoticz.log("Third stage OFF", domoticz.LOG_INFO)
end
end
------------------------------------------------------------------
-- SECOND STAGE (DIFF_MID)
------------------------------------------------------------------
if phase2.state == 'Off' then
if should_turn_on(DIFF_MID) then
phase2.switchOn()
domoticz.log("Second stage ON", domoticz.LOG_INFO)
end
else
if should_turn_off(DIFF_MID) then
phase2.switchOff()
domoticz.log("Second stage OFF", domoticz.LOG_INFO)
end
end
------------------------------------------------------------------
-- AUTOMATIC OFF WHEN TEMPERATURE DIFFERENCE IS SMALL
------------------------------------------------------------------
if diff < (DIFF_MID - HYSTERESIS) then
if phase2.state == 'On' or phase3.state == 'On' then
phase2.switchOff()
phase3.switchOff()
domoticz.log("Small temperature difference, additional stages OFF", domoticz.LOG_INFO)
end
end
end
}
Three-stage electric heating element control allows heating capacity to be increased or reduced according to the actual temperature difference.
DSVT manages the primary heating stage and the target temperature, while the supplementary dzVents script controls the second and third heating elements.
Independently configurable temperature thresholds and hysteresis make it possible to adapt the control strategy to the operating characteristics of the tank or electric heating equipment.
This solution allows the full available heating capacity to be activated only when a sufficiently large temperature difference makes it necessary.