I've been writing a Dzvents script for my house. It's quite simple but I think it works for my situation. It is the second script I ever write in lua or dzvents and I'm not a programmer.
The goal is: Keep using the timers of Domoticz and make the rooms not too smart. If I need to heat a room, I need to turn on the heating myself and at a pre set time (using standard domoticz timer) domoticz will turn the room setpoint back to its "basic" temp.
The script I wrote will turn on the boiler when one of the rooms is in need of heat.
For the living room (Woonkamer) there is an additional temp meter and the valves are switched "on" or "off" according to the need of heat.
In the other rooms the valve is also the setpoint and thermometer so I can use the standard thermostat function of the valve.
Do I miss something in this script or can I do any improvements?
Code: Select all
local HYSTERESIS = 0.2 -- temp has to drop this value below setpoint before boiler is on again
return {
on = {
devices = {
'Woonkamer temp',
'Slaapkamer temp',
'Groenekamer temp',
'Woonkamer thermostaat',
'Slaapkamer thermostaat',
'Groenkamer thermostaat'
}
},
execute = function(domoticz, switch)
if
domoticz.devices('Woonkamer temp').temperature < (domoticz.devices('Woonkamer thermostaat').setPoint - HYSTERESIS)
or
domoticz.devices('Slaapkamer temp').temperature < (domoticz.devices('Slaapkamer thermostaat').setPoint - HYSTERESIS)
or
domoticz.devices('Groenekamer temp').temperature < (domoticz.devices('Groenekamer thermostaat').setPoint - HYSTERESIS)
then
domoticz.devices('CV_Relais').switchOn()
else
domoticz.devices('CV_Relais').switchOff()
end
if
-- The living raoom has two valves, a separate temp sensor and setPoint
-- Set the valves to Boost when there is a heat request.
domoticz.devices('Woonkamer temp').temperature < (domoticz.devices('Woonkamer thermostaat').setPoint)
then
domoticz.devices('WK voor Thermostat Mode').updateMode('Boost')
domoticz.devices('WK achter Thermostat Mode').updateMode('Boost')
-- Only when the boiler is on and there is no heat request in the living room the valves will be closed. This to save teh moter and batteries
elseif
domoticz.devices('Woonkamer temp').temperature > (domoticz.devices('Woonkamer thermostaat').setPoint) and domoticz.devices('CV_Relais').state == 'On'
then
domoticz.devices('WK voor Thermostat Mode').updateMode('Off')
domoticz.devices('WK achter Thermostat Mode').updateMode('Off')
end
end
}
4 Eurotronics Spirit valves (2 in the livingroom, 1 in each bedroom)
1 relay on the to switch the central heating system
1 zwave temp sensor in the livingroom