Page 1 of 1

Hotwater controll by time and temperature

Posted: Monday 16 April 2018 9:26
by kre10
Hello i have SONOFF TH16 and connect my boiler for hotwater
and i need to control temperature at day and night for economy electricity.
but blocky not work correct and run on or off every minute. and i think not run when i need on rule.
can we help with script

Re: Hotwater controll by time and temperature

Posted: Monday 16 April 2018 12:14
by waaren
kre10 wrote: Monday 16 April 2018 9:26 Hello i have SONOFF TH16 and connect my boiler for hotwater
and i need to control temperature at day and night for economy electricity.
but blocky not work correct and run on or off every minute. and i think not run when i need on rule.
can we help with script
in dzVents: something like this ?

Code: Select all

 --[[ 
    th15Test
    checkFirst() available in dzVents > 2.3.0
]]-- 
 
return { 
    on = { timer = { 'at 06:00-22:00 every 5 minutes'},
          },

    execute = function(dz,_)
        if dz.devices("HotWater:temp").temperature <= 40 then 
            dz.devices("HotWater:Relay").switchOn().checkFirst()
        elseif dz.devices("HotWater:temp").temperature >= 50 then
            dz.devices("HotWater:Relay").switchOff().checkFirst()
        end
end
}

Re: Hotwater controll by time and temperature

Posted: Monday 16 April 2018 12:40
by Domosapiens
Kre10, some remarks:
- Nested IF is not allowed (remove the outer IF)
- Use the IF with the blue star when ELSE is involved (correct for your inner IF)
- use a Dummy Switch Device and let it switch ON at 6 and switch OFF at 22hr (with the Timer of the device)
- combine this Dummy Switch in the IF part and in the ELSEIF part
- make sure the Blockly is of the type "Devices"

No need for scripts !

Re: Hotwater controll by time and temperature

Posted: Monday 16 April 2018 12:49
by jkimmel
in dzVents: something like this ?

Code: Select all

 --[[ 
    th15Test
    checkFirst() available in dzVents > 2.3.0
]]-- 
 
return { 
    on = { timer = { 'at 06:00-22:00 every 5 minutes'},
          },

    execute = function(dz,_)
        if dz.devices("HotWater:temp").temperature <= 40 then 
            dz.devices("HotWater:Relay").switchOn().checkFirst()
        elseif dz.devices("HotWater:temp").temperature >= 50 then
            dz.devices("HotWater:Relay").switchOff().checkFirst()
        end
end
}

What will the state of the relay be from 22:00 to 06:00?

Re: Hotwater controll by time and temperature

Posted: Monday 16 April 2018 21:21
by kre10
i need to control temperature for daytime from 06:00-22:00 - 50C and from 22:00 to 06:00 - to max or 70C maximum
but when i test dzVents script not work correctly, i mean doesn't turn on switch but my temp is 30C. when i test

Re: Hotwater controll by time and temperature

Posted: Monday 16 April 2018 23:21
by kre10

Re: Hotwater controll by time and temperature

Posted: Wednesday 18 April 2018 18:07
by Denny64
I think this is the right way with blockly:

If Time ≥ 06:00 And Time ≤ 21:59 And HotWater: temp ≤ 40 And HotWater: Relay = Off
Set HotWater: Relay = On
Else If Time ≥ 06:00 And Time ≤ 21:59 And HotWater: temp ≥ 50 And HotWater: Relay = On
Set HotWater: Relay = Off
Else If Time ≥ 22:00 And Time ≤ 05:59 And HotWater: temp ≤ 70 And HotWater: Relay = Off
Set HotWater: Relay = On
Else If Time ≥ 22:00 And Time ≤ 05:59 And HotWater: temp ≥ 70 And HotWater: Relay = On
Set HotWater: Relay = Off