Zone Heating with floorheating

Moderator: leecollings

Post Reply
dizzeenl
Posts: 31
Joined: Wednesday 14 November 2018 23:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Dordrecht
Contact:

Zone Heating with floorheating

Post by dizzeenl »

For the ones interested here is my script to manage the heating in my house. Control the central heater to allow specific room heating.

In short
- one script to control the floorheating pump, if the temp sensor attached on the inlet tube reaches the desired temp, the pump wil get activated.
- another script to control heating in the different rooms (2) with different modes (off, passive, active seperate or active both rooms)

Specifications
- The floorheating will be disbaled (pump will not be activated) if the roomtemperature is below/equal to setpoint and another room is activated
- The room activation temperature can be activated bij the knob in the room itself but also with a virtual switch
- With this code activating the central heating without any valves open should be avoided. If the CH is active the pump floorheating or at least one valve is fully opened.



Devices / Hardware
- OTGW plugin
- Remeha Home plugin (optional)
- Virtual Sensors
- Fibaro Heat
- Eurotronic spirit
- Relais switch with temp sensor (Qubino Flush)
overview.png
overview.png (222.09 KiB) Viewed 825 times
stoomdiagram verwarming.pdf
(74.15 KiB) Downloaded 38 times
(OUTDATED)

The code is working, but still in development for further improvement

02 [H] Regeling vloerverwaming

Code: Select all

-- VERSION 22-12-2022
return {
        active = true,
        on = {
            devices = {'[H] Vloerverwarming','[T] Vloerverwarming',' [H] Brander','[H] Centrale Verwarming','[H] Radiator Kinderkamer','[H] Radiator Slaapkamer' },
           -- timer = {'every minute'}
        },
        data = {
            temperatures = { history = true, maxItems = 2}
        },
    logging = {
		level = domoticz.LOG_INFO, 				
		marker = 'CH VV'
	},
        	execute = function(domoticz, item)
        
        local dz = domoticz	    
        
	    local VV = domoticz.devices('[T] Vloerverwarming')
	    local CV = dz.devices('[H] Centrale Verwarming')
	    local pump = domoticz.devices('[H] Vloerverwarming')
	    local override_1 = domoticz.devices('[H] Radiator Kinderkamer')
	    local override_2 = domoticz.devices('[H] Radiator Slaapkamer')
	    local WKsp = dz.utils.round(dz.devices('[H] Woonkamer Setpoint').setPoint,1)
	    local WKtp = dz.utils.round(dz.devices('[T] Woonkamer').temperature,1)
	    
-- MAKE HISTORY OF TEMP        
       if item.name == VV.name then dz.data.temperatures.add(VV.temperature) end 
            local prev = dz.utils.round(dz.data.temperatures.getOldest().data,1) 
            local last = dz.utils.round(dz.data.temperatures.getLatest().data,1)
            -- dz.notify("vvtemp","last "..last.."     previous "..prev,dz.PRIORITY_NORMAL)
  
 -- ##HEATER NOTIFICATION
if (item.name == '[H] Brander' and item.active) then
         	dz.notify("Brander","is AAN",dz.PRIORITY_NORMAL)	
	    end
          
-- ##PUMP CONTROL by 
  if override_1.levelName ~= "Open" or override_2.levelName ~= "Open" then
       -- pomp aan wanneer verwarming aan
        if (pump.inActive and VV.temperature > 35 and CV.state == 'On' and (last > prev) and (WKsp > WKtp)) then -- and domoticz.devices('[H] Noodverwarming KK').inActive then
           pump.cancelQueuedCommands()
           pump.switchOn().checkFirst()
            dz.notify("Vloerverwarming","Ingeschakeld",dz.PRIORITY_NORMAL)
       end
        -- pomp uit bij lage temp circuit
       if pump.active and (VV.temperature < 28 or CV.state == 'Off' and (last <= prev) and (WKsp <= WKtp)) then
            pump.cancelQueuedCommands()
           pump.switchOff().checkFirst()
            dz.notify("Vloerverwarming","Uitgeschakeld",dz.PRIORITY_NORMAL)	
        end
 end

-- actie wanneer verwarming boven aan   

    if (item.name == override_1.name and override_1.levelName ~= "Off") or (item.name == override_2.name and override_2.levelName ~= "Off") then
     pump.switchOff().checkFirst()
    end
--[[
if (item.name == override_1.name and override_1.levelName ~= "Open") or (item.name == override_2.name and override_2.levelName ~= "Open") then
            dz.notify("Vloerverwarming","Vrij gegeven",dz.PRIORITY_NORMAL)
else
            pump.switchOff().checkFirst()
            dz.notify("Vloerverwarming","Geblokkeerd",dz.PRIORITY_NORMAL)
end
--]]

--[[
if item.isTimer and CV.state == 'Off' and override_1.state == 'On' and override_1.lastUpdate.minutesAgo > 50 then
        dz.notify("Vloerverwarming","Gedeblokkeerd (auto)",dz.PRIORITY_NORMAL)
        override_1.switchOff()
    end
]]--
-- ##IDLE CONTROL       
    if item.isTimer and pump.lastUpdate.hoursAgo > 20 then
            pump.cancelQueuedCommands()
            pump.switchOff().checkFirst().afterMin(5)
            pump.switchOn().checkFirst().forMin(5)
            dz.notify("Vloerverwarming","antivastloop",dz.PRIORITY_NORMAL)	
        end
end
}	
02 [H] Verwarming secundair

Code: Select all

--[[ http://192.168.7.6:9002/json.htm?type=command&param=udevice&idx=1768&svalue=40
--dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=00')
-- VERSION 230161
Fixed loop with codeblocker in active section (loop when boost and active VV)
added code to avoid loop with data.loop
seperated AAN statebased and tempbased to avoid double messages
]]--

return {
        active = true,
        on = {
            devices = {'[H] Radiator Kinderkamer','[T] Kinderkamer','[H] Radiator Slaapkamer','[T] Slaapkamer','[H] Forceer verwarming kinderkamer','[H] Kinderkamer Setpoint', '[H] CV Modus', '[H] Vloerverwarming' },
            timer = {'every minute'}
        },
    
    data = {
            temperatures_K = { history = true, maxMinutes = 5}, -- store temperatures to calculate increases
            temperatures_S = { history = true, maxMinutes = 5}, -- store temperatures to calculate increases
            codeblocker1 = {initial = 0}, -- blocks sections of code when Central Heating is active and no OTGW-command is permitted
            boostcmd = {initial = 0}, -- selection of codes to define action while in Boost (switch slector in the beginning, send OTGW command afther)
            syncset = {initial = 0}, -- synchronisation between the radiator knob and modus switches
            loop = {initial = 0}, -- avoid crash when system gets in loop
            cvmod = { history = true,  maxItems = 2 } -- store precious CV mode
            
            },
    logging = {
		level = domoticz.LOG_INFO, 				
		marker = 'CH KK'
	},
        execute = function(domoticz, trigger)
       local dz = domoticz
       -- local Time = require('Time') 9/6/23 SEEMS NOT TO BE USED
       -- local t = Time() 
       local CV = dz.devices('[H] Centrale Verwarming')
       local CVP = dz.devices('[P] CV master')
       local tempWK = dz.devices('[T] Woonkamer').temperature
       
       local radK = dz.devices('[H] Radiator Kinderkamer')
       local setpK = dz.devices('[H] Kinderkamer Setpoint') 
       local tempK = dz.devices('[T] Kinderkamer').temperature
       
       local radS = dz.devices('[H] Radiator Slaapkamer')
       local setpS = dz.devices('[H] Slaapkamer Setpoint') 
       local tempS = dz.devices('[T] Slaapkamer').temperature
       
       local VV = dz.devices('[H] Vloerverwarming') 
       local modus = dz.devices('[H] CV Modus') 
       local WKSp = dz.devices('[H] Woonkamer Setpoint').setPoint

-- RECORD HISTORY
if trigger.isTimer then
    dz.data.temperatures_K.add(tempK)
    dz.data.temperatures_S.add(tempS)
    
end

-- dz.data.codeblocker1 = 0

-- STORE PREVIOUS CV-MODE state
if trigger.name == modus.name then
    dz.data.cvmod.add(modus.state)
end

-- CHECK IF OFF MODUS IS CORRESPONDING WITH RADIATORS
if trigger.isTimer then
    if (modus.state == 'Off' and (radK.state ~= 'Off' or radS.state ~= 'Off')) then
        radK.switchSelector('Off')
        radS.switchSelector('Off')
    end
    if (modus.state == 'Active K' and (radS.state ~= 'Off')) then
        radS.switchSelector('Off')
    end
    if (modus.state == 'Active S' and (radK.state ~= 'Off')) then
        radK.switchSelector('Off')
    end
end 


-- MAKE HISTORY OF TEMP  AND ACT      
            local last_K = dz.utils.round(dz.data.temperatures_K.getLatest().data,1)    -- set local current data (temp) reading
            local prev_K = dz.utils.round(dz.data.temperatures_K.getOldest().data,1)    -- set local previous data (temp) reading
            local last_S = dz.utils.round(dz.data.temperatures_S.getLatest().data,1)    -- set local current data (temp) reading
            local prev_S = dz.utils.round(dz.data.temperatures_S.getOldest().data,1)    -- set local previous data (temp) reading
            local prev_CVm = dz.data.cvmod.getOldest().data -- set local previous CM Modus
            
            dz.log("PREV = " ..prev_K.. ' & ' ..prev_S)
			dz.log("LAST = " ..last_K.. ' & ' ..last_S)
			dz.log("SETP = " ..setpK.setPoint.. ' & ' ..setpS.setPoint)
			dz.log("WK = " ..dz.utils.round(dz.devices('[T] Woonkamer').temperature,1).. " / "..dz.devices('[H] Woonkamer Setpoint').setPoint)
			dz.log("Syncset = " ..dz.data.syncset)
			dz.log("Codeblock = " ..dz.data.codeblocker1)
			dz.log("Loop = " ..dz.data.loop)
			dz.log("boostcmd = " ..dz.data.boostcmd)
			dz.log("CVmodus = curr:" ..modus.state.. " | prev:"..prev_CVm)

-- ACT ON VERWARMING MODE SETTINGS
local WKtemp = dz.utils.round(dz.devices('[T] Woonkamer').temperature,1)
local WKsetp = dz.utils.round(dz.devices('[H] Woonkamer Setpoint').setPoint,1)

-- AVOID LOOP in HEATING PROCES
if modus.lastUpdate.secondsAgo < 4 or radK.lastUpdate.secondsAgo < 4 or radS.lastUpdate.secondsAgo < 4 then
    dz.data.loop = dz.data.loop + 1
elseif modus.lastUpdate.secondsAgo > 4 or radK.lastUpdate.secondsAgo > 4 or radK.lastUpdate.secondsAgo > 4 then
    dz.data.loop = 0
end

if dz.data.loop > 6 then
      dz.notify('[H] Boven','LOOP DETECTED',dz.PRIORITY_HIGH)
      -- /json.htm?type=command&param=events&evparam=list
      
      
      dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=events&evparam=updatestatus&eventid=44&eventstatus=0')
       dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=events&evparam=updatestatus&eventid=46&eventstatus=0')
       modus.switchSelector('Off')
       radK.switchSelector('Off')
       radS.switchSelector('Off')
       dz.data.codeblocker1 = 0
       dz.data.boostcmd = 0
       dz.data.syncset = 0
       dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=events&evparam=updatestatus&eventid=44&eventstatus=1').afterSec(10)
       dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=events&evparam=updatestatus&eventid=46&eventstatus=1').afterSec(10)
       
else
     
-- AUTO ACTIVE/PASSIVE BASED ON FLOOR CV P 1/2
        if (((WKtemp < WKsetp) and WKtemp > 10) or VV.state == "On") and (modus.state ~= "Off" and modus.state ~= "Passive") and dz.data.codeblocker1 == 0 then 
            dz.data.codeblocker1 = 1
            dz.notify('[H] Boven','Inactief, CV is aan',dz.PRIORITY_NORMAL)
    
    elseif ((WKtemp >= WKsetp) and VV.state == "Off") and dz.data.codeblocker1 == 1 then 
            modus.cancelQueuedCommands()
            dz.data.codeblocker1 = 0
            dz.notify('[H] Boven','Vrijgegeven ('..dz.variables('prev_CVmodus').value..')',dz.PRIORITY_NORMAL)
        end


-- ACT ON RADIATOR MODE SETTINGS [2] 
-- als radiator kinderkamer input en nog geen code uitgevoerd synchroniseer met "mode"
        if trigger.name == radK.name and dz.data.syncset == 0 then   
            dz.data.syncset = 1
            if radK.levelName == "Off" then
                if modus.levelName ~= "Off" then modus.cancelQueuedCommands() modus.switchSelector('Off') end
               -- dz.notify('[H] kinderkamer','UIT',dz.PRIORITY_NORMAL)
            
            elseif radK.levelName == "Auto" then
                if modus.levelName ~= "Passive" and modus.levelName ~= "Active K" and modus.levelName ~= "Active K+S" then 
                    modus.cancelQueuedCommands() modus.switchSelector('Active K') 
                end
                -- dz.notify('[H] kinderkamer','AUTO',dz.PRIORITY_NORMAL)
            
        elseif radK.levelName == "Open" then
            end 
            
        end 
-- als radiator slaapkamer input en nog geen code uitgevoerd synchroniseer met "mode"
        if trigger.name == radS.name and dz.data.syncset == 0 then   
            dz.data.syncset = 2 -- CHANGING FROM 2 TO 1 TO AVOID LOOP??
            if radS.levelName == "Off" then
                if modus.levelName ~= "Off" then modus.cancelQueuedCommands() modus.switchSelector('Off') end
               -- dz.notify('[H] kinderkamer','UIT',dz.PRIORITY_NORMAL)
            
            elseif radS.levelName == "Auto" then
                if modus.levelName ~= "Passive" and modus.levelName ~= "Active S" and modus.levelName ~= "Active K+S" then 
                    modus.cancelQueuedCommands() modus.switchSelector('Active S') 
                end
                -- dz.notify('[H] kinderkamer','AUTO',dz.PRIORITY_NORMAL)
            
        elseif radK.levelName == "Open" then
            end 
            
        end 
        
        
        
-- START MODUS REGULATION [3]
-- OFF-state
    if modus.state == "Off" then
        if trigger.name == modus.name and (radK.levelName ~= "Off" or radS.levelName ~= "Off") and dz.data.syncset == 0 then 
            dz.notify('[H] Boven','UIT',dz.PRIORITY_NORMAL)
            radK.cancelQueuedCommands() 
            radK.switchSelector('Off') 
            radS.cancelQueuedCommands() 
            radS.switchSelector('Off') 
            
            dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
            dz.data.syncset = 1 end
            
-- ACTIVE K-state
    elseif modus.state == "Active K" then
        if radK.levelName == "Off" and dz.data.syncset == 0 then 
            radK.switchSelector('Auto')
            if radS.levelName ~= "Off" then 
            radS.switchSelector('Off') 
            dz.data.syncset = dz.data.syncset+1 end
            
        end 
        -- SETPOINT CHANGE: STARTHEATING       
        if radK.levelName == "Auto" and dz.data.codeblocker1 == 0 and (setpK.setPoint-last_K) >= 0.3 and (last_K <= prev_K) then -- avoid loop with codeblocker !
                radK.cancelQueuedCommands()
                radK.switchSelector('Open')
                dz.notify('[H] kinderkamer','VERWARMING AAN',dz.PRIORITY_NORMAL)
        end


    -- AUTO HEATING OPTION, CONTROL SETPOINT
        if radK.levelName == "Open" then
            if (setpK.setPoint-last_K) >= 0.3 and dz.data.codeblocker1 == 0 then
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=1')
                    if (setpK.setPoint-last_K) >= 2 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=80')
                    elseif (setpK.setPoint-last_K) >= 1 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=70')
                    elseif (setpK.setPoint-last_K) >= 0.3 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=60')
                    end
            else
              radK.cancelQueuedCommands()
                --dz.data.syncset = 2
                radK.switchSelector('Auto') --.afterSec(5) -- TEST LOOP 3-2-2023 added syncset 2
               -- dz.notify('[H] kinderkamer','VERWARMING STANDBY',dz.PRIORITY_NORMAL)
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
               
            end
    end

-- ACTIVE S-state
    elseif modus.state == "Active S" then
        if radS.levelName == "Off" and dz.data.syncset == 0 then 
            radS.switchSelector('Auto')
            dz.data.syncset = 1 
        if radK.levelName ~= "Off" then 
            radK.switchSelector('Off') 
            dz.data.syncset = dz.data.syncset+1
        end
            
        end 
        
        -- SETPOINT CHANGE: STARTHEATING       
        if radS.levelName == "Auto" and dz.data.codeblocker1 == 0 and (setpS.setPoint-last_S) >= 0.3 and (last_S <= prev_S) then -- avoid loop with codeblocker !
                radS.cancelQueuedCommands()
                radS.switchSelector('Open')
                dz.notify('[H] Slaapkamer','VERWARMING AAN',dz.PRIORITY_NORMAL)
        end


    -- AUTO HEATING OPTION, CONTROL SETPOINT
        if radS.levelName == "Open" then
            if (setpS.setPoint-last_S) >= 0.3 and dz.data.codeblocker1 == 0 then
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=1')
                    if (setpS.setPoint-last_S) >= 2 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=80')
                    elseif (setpS.setPoint-last_S) >= 1 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=70')
                    elseif (setpS.setPoint-last_S) >= 0.3 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=60')
                    end
            else
              radS.cancelQueuedCommands()
                --dz.data.syncset = 2
                radS.switchSelector('Auto') --.afterSec(5) -- TEST LOOP 3-2-2023 added syncset 2
               -- dz.notify('[H] kinderkamer','VERWARMING STANDBY',dz.PRIORITY_NORMAL)
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
               
            end
    end
    
    
-- ACTIVE K&S-stat
    elseif modus.state == "Active K+S" then
        if radK.levelName == "Off" or radS.levelName == "Off" and dz.data.syncset == 0 then 
            if radK.levelName ~= "Open" then radK.switchSelector('Auto') end
            if radS.levelName ~= "Open" then radS.switchSelector('Auto') end
            dz.data.syncset = 1 
        end 
        
        -- SETPOINT CHANGE: STARTHEATING       
        if radK.levelName == "Auto" and dz.data.codeblocker1 == 0 and (setpK.setPoint-last_K) >= 0.3 and (last_K <= prev_K) then -- avoid loop with codeblocker !
                radK.cancelQueuedCommands()
                radK.switchSelector('Open')
                dz.notify('[H] kinderkamer','VERWARMING AAN',dz.PRIORITY_NORMAL)
        end
        if radS.levelName == "Auto" and dz.data.codeblocker1 == 0 and (setpS.setPoint-last_S) >= 0.3 and (last_S <= prev_S) then -- avoid loop with codeblocker !
                radS.cancelQueuedCommands()
                radS.switchSelector('Open')
                dz.notify('[H] slaapkamer','VERWARMING AAN',dz.PRIORITY_NORMAL)
        end


    -- AUTO HEATING OPTION, CONTROL SETPOINT
        if radK.levelName == "Open" or radS.levelName == "Open" then
            if ((setpK.setPoint-last_K) >= 0.3 or (setpS.setPoint-last_S)) and dz.data.codeblocker1 == 0 then
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=1')
            if (setpK.setPoint-last_K) >= 2 or (setpS.setPoint-last_S) >= 2 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=80')
            elseif (setpK.setPoint-last_K) >= 1 or (setpS.setPoint-last_S) >= 1 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=70')
            elseif (setpK.setPoint-last_K) >= 0.3 or (setpS.setPoint-last_S) >= 0.3 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=60')
            else
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
            end
        end

            if (setpK.setPoint-last_K) < 0.3 then
                    radK.switchSelector('Auto') --.afterSec(5) -- TEST LOOP 3-2-2023 added syncset 2
            end
            if (setpS.setPoint-last_S) < 0.3 then
                    radS.switchSelector('Auto') --.afterSec(5) -- TEST LOOP 3-2-2023 added syncset 2
            end
    
    end 
    --[[ 
        if radK.levelName == "Open" then
            if (setpK.setPoint-last_K) >= 0.3 and dz.data.codeblocker1 == 0 then
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=1')
                    if (setpK.setPoint-last_K) >= 2 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=80')
                    elseif (setpK.setPoint-last_K) >= 1 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=70')
                    elseif (setpK.setPoint-last_K) >= 0.3 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=60')
                    end
            else
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
               
            end
        elseif radS.levelName == "Open" then
            if (setpS.setPoint-last_S) >= 0.3 and dz.data.codeblocker1 == 0 then
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=1')
                    if (setpS.setPoint-last_S) >= 2 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=80')
                    elseif (setpS.setPoint-last_S) >= 1 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=70')
                    elseif (setpS.setPoint-last_S) >= 0.3 then
                        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=CS=60')
                    end
            else
                dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
               
            end    
    end
    
        if radK.levelName == "Open" and (setpK.setPoint-last_K) < 0.3 or dz.data.codeblocker1 == 0 then
              radK.cancelQueuedCommands()
                --dz.data.syncset = 2
                radK.switchSelector('Auto') --.afterSec(5) -- TEST LOOP 3-2-2023 added syncset 2
               -- dz.notify('[H] kinderkamer','VERWARMING STANDBY',dz.PRIORITY_NORMAL)
        end
        if radS.levelName == "Open" and (setpS.setPoint-last_S) < 0.3 or dz.data.codeblocker1 == 0 then
              radS.cancelQueuedCommands()
                --dz.data.syncset = 2
                radS.switchSelector('Auto') --.afterSec(5) -- TEST LOOP 3-2-2023 added syncset 2
               -- dz.notify('[H] kinderkamer','VERWARMING STANDBY',dz.PRIORITY_NORMAL)
        end
    
    ]]--
 -- END active K + S   
    elseif modus.state == "Passive" then
        dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=0')
        if trigger.name == modus.name and dz.data.syncset == 0 then 
            if radK.levelName ~= "Auto" then
             radK.cancelQueuedCommands() radK.switchSelector('Auto') dz.data.syncset = 1 
            end
            if radS.levelName ~= "Auto" then
             radS.cancelQueuedCommands() radS.switchSelector('Auto') dz.data.syncset = 1 
            end
    end
    
    elseif modus.state == "Reset" and trigger.name == modus.name then
        --dz.openURL('http://127.0.0.1:9002/json.htm?type=command&param=sendopenthermcommand&idx=7&cmnd=GW=R')
        modus.switchSelector("Off")
        dz.openURL('http://192.168.7.6:9002/json.htm?type=command&param=udevice&idx=57&svalue=15')
        CVP.switchOff()
        CVP.switchOn().afterSec(15)
        dz.data.codeblocker1 = 0
        modus.switchSelector(dz.variables('prev_CVmodus').value).afterSec(3)
        dz.notify('CV','RESET',dz.PRIORITY_NORMAL)
        
    elseif modus.state == "T" and trigger.name == modus.name then
        modus.switchSelector(dz.variables('prev_CVmodus').value).afterSec(3)
        dz.openURL('http://192.168.7.6:9002/json.htm?type=command&param=udevice&idx=57&svalue=15')
        dz.notify('CV','T correct',dz.PRIORITY_NORMAL)

    end 

        
-- SCHEDUALED SWITCH OFF HEATING
   if trigger.isTimer and modus.state ~= "Off" and dz.time.matchesRule('at 07:00') then
    modus.switchSelector('Off') -- off
    dz.notify('[H] Verwarming','UIT (timer)',dz.PRIORITY_NORMAL)
    end

if dz.data.syncset == 1 then dz.data.syncset = 0 
elseif dz.data.syncset >= 2 then dz.data.syncset = dz.data.syncset-1 --3-2 TEST avoid loop 
end


end -- END OF LOOP DETECTION
end
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest