My Heating system

Moderator: leecollings

Post Reply
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

My Heating system

Post by emme »

Ciao,

I wish to share my way to get heating working in my house.
I do have a cetralized heating system that provide hot water for 16 hours per day form October 15 to April 15
I do have radiators in every room and I wanted to have Domoticz controls the temp.

I use several protocols to handle all datas (zwave, rfxcom, mysensors) but at a script leel it does not matter so far.

The logic by which I run the script is quite simple
Check the actual temp, compare with the wanted and act the valve by consequence if outside the setted delta.
In case a widow in the room is opened for a certain amount of time, then switch off the valve until it goes back closed

I have a setpoint for each room with the desired temperature
I have a configured table with the name of each room and for each room with the following requirements
- Temperature sensor for the actual temperature
this can be a table too if you have more than 1 device... if so, the temp is calculated as a math avarage

- Valve setPoint (valve actuator)
- setPoint name of desired temperature
- deltaT compensator (in the range of this value no action are made)
- Valve setpoint for OFF Temp (see valve min. value)
- Valve setpoint for MIN Temp
- Valve MAX Temp (see valve min. value)
- Valve min Step value (see valve step value)
- Temperature offset (compensate difference between real and wanted temp)
- Room window magnet
- time (in min) to switch off the valve

I also added a BOOSTER unction: if there is deltaT higher than a certain value (mine is set to 10) rise the valve setpoint higher than the step configured

here is my script:

Code: Select all

local roomAdjust  = {}
roomAdjust['Room']    = { {'TEM_Room_1', 'TEM_Room_na'},     'SPC_Room',    'TEMP-Room',    0.3, 4, 7, 28, 0.5, 0, 'MAG_Room_Window',    15 }
roomAdjust['Room2']   = {{'TEM_Room2_1',     'SPC_Room2',    'TEMP-Room2',    0.3, 4, 7, 28, 0.5, 0, 'MAG_Room2_Window',    15 }
local tRif   = 0
local stpAct = 0
local stpNew = 0
local dBoost = 10 --BOOSTER: se il setpoint scende oltre i 10° di delta con la TVoluta al raggiungimento della temperatura risale più rapidamente

return {
	on = {
		timer = { 'every 3 minutes on -15/4,15/10-'	},
	    },
	
	logging = {
        level = domoticz.LOG_INFO,
        marker = "[TEMP-KEEPER] ==> "
        },
    
	execute = function(dz, tmrNull)
        for roomId, roomInfo in pairs(roomAdjust) do
            if type(roomInfo[1]) == 'table' then 
                local tTot = 0
                for k = 1, #roomInfo[1] do
                    tTot = tTot + dz.utils.round(dz.devices(roomInfo[1][k]).temperature,1)
                end 
                actTemp = tTot / #roomInfo[1]
                dz.log('['..roomId..']'..' ambiente con più sonde temperature, indicazione media: '..tostring(actTemp)..'°C')
            else
                actTemp = dz.utils.round(dz.devices(roomInfo[1]).temperature,1)
            end 

            if dz.devices(roomInfo[3]).levelName == 'Off' then
                tWnt = 4
            else
                tWnt = tonumber(dz.devices(roomInfo[3]).levelName)
            end 
            
            tRif   = dz.utils.round(actTemp,1) + roomInfo[9]
            stpAct = dz.devices(roomInfo[2]).setPoint
            stpNew = stpAct
            finSts = dz.devices(roomInfo[10])
            if finSts.state == 'On' and finSts.lastUpdate.minutesAgo > roomInfo[11] then
                if stpAct ~= roomInfo[5] then
                    dz.log('['..roomId..']: Finestra di riferimento aperta, spegnimento Termo!!')
                    dz.devices(roomInfo[2]).updateSetPoint(roomInfo[5])
                end
            elseif math.abs(tRif - tWnt) > roomInfo[4] then
                dz.log('['..roomId..']:T rilevata: '..tRif..'  T impostata: '..tWnt..'  Delta: '..(tRif - tWnt))
                if tRif > tWnt then
                    stpNew = stpAct - roomInfo[8]
                    if stpNew < roomInfo[6] then stpNew = roomInfo[6] end 
                elseif tRif < tWnt then
                    if (tRif - stpAct) > dBoost then  
                        stpNew = dz.utils.round(stpAct + ((tWnt - stpAct ) / 2), 0)
                        dz.log('['..roomId..']: Booster Up '..stpAct..' ==> '..stpNew)
                    else
                        stpNew = stpAct + roomInfo[8]
                    end 
                    if stpNew > roomInfo[7] then stpNew = roomInfo[7] end 
                end 
            
                if stpAct ~= stpNew then
                    dz.log('['..roomId..']:Intevento sul termostato, da '..stpAct..' a '..stpNew)
                    dz.devices(roomInfo[2]).updateSetPoint(stpNew)
                end 
            end
        end 
	end
}
this runs for all winter time and I have been really confident with it
hope you enjoy it too :P :P

ciao
M

P.S.
I was considering the presence too (if none at home then move to a specific value), but due to the central system working hours I did have to remove it due to the inability to gain the loosed °C back in a short period of time
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest