Page 1 of 1

How to setup a heating plan with dzVents?

Posted: Friday 15 November 2019 10:38
by burnersk
In the past week, I have had setup a heating plan for my new radiator thermostats with the Blockly event engine.
However, I quickly discovered that Blockly with its limitation (or better simplifications) cannot handle a more complex heating plan. Further more, it is not possible to change the thermostat mode in Blockly at all.

A quick search turned out that I should use the dzVents event engine. But with the various snippts available, I could not get me familar with dzVents.

Could someone help me translate the below described logic into a dzVents script? I saw many dzVents snippets with generalization, meaning I understand the scripts in that way that "all devices of a certain type" will be updated instead of a single specific device. However, I need to select the thermostats individually. There are thermostats, that are not part of this heating plan, so they must not be affected by this heating plan.

I have the following hardware with their "devices":
  • Radiator thermostat (Eurotronic Spirit Z-Wave Plus) "Wohnzimmer Heizung" (NodeID 12 0x0c)
    • Thermostat Mode "Wohnzimmer Heizung Modus" (Idx 79 ID 00000C01 Unit 1): "Off", "Heat", "Heat Eco", "Full Power", "Manufacturer Specific"
    • SetPoint for Heat "Wohnzimmer Heizung Modus Heat" (Idx 80 ID 0000C01 Unit 1)
    • SetPoint for Heat Eco "Wohnzimmer Heizung Modus Heat Eco" (Idx 81 ID 0000C0B Unit 1)
  • Radiator thermostat (Eurotronic Spirit Z-Wave Plus) "Badezimmer Heizung" (NodeID 13 0x0d)
    • Thermostat Mode "Badezimmer Heizung Modus" (Idx 91 ID 00000D01 Unit 1): "Off", "Heat", "Heat Eco", "Full Power", "Manufacturer Specific"
    • SetPoint for Heat "Badezimmer Heizung Modus Heat" (Idx 92 ID 0000D01 Unit 1)
    • SetPoint for Heat Eco "Badezimmer Heizung Modus Heat Eco" (Idx 93 ID 0000D0B Unit 1)
  • Virtual switch "At Home" (Idx 105 ID 000140B9 Unit 1)
The Z-Wave configuration tables for the radiator thermostat can be found here: https://eurotronic.org/wp-content/uploa ... iew_V5.pdf

The virtual switch is "On", when I am at home; otherwise, it is "Off". The virtual switch is controlled by an event that is working as intended.

I would like to setup the following logic as an dzVents event script:
  • On workdays at 05:00 (24h), "Wohnzimmer Heizung" and "Badezimmer Heizung" shall preheat their rooms to 22°C and 24°C.
  • On workdays at 08:30 (24h), both "Wohnzimmer Heizung" and "Badezimmer Heizung" shall chill their rooms to 19°C.
  • On workdays at 15:00 (24h), "Wohnzimmer Heizung" and "Badezimmer Heizung" shall preheat their rooms to 22°C and 20°C.
  • On workdays at 22:00 (24h), both "Wohnzimmer Heizung" and "Badezimmer Heizung" shall chill their rooms to 18°C.
  • On weekends at 07:30 (24h), "Wohnzimmer Heizung" and "Badezimmer Heizung" shall preheat their rooms to 22°C and 24°C.
  • On weekends at 10:30 (24h), "Badezimmer Heizung" shall chill their room to 20°C.
  • On weekends at 22:00 (24h), both "Wohnzimmer Heizung" and "Badezimmer Heizung" shall chill their rooms to 18°C.
  • Despite nighttime chilling (22:00), all other chilling events shall be deferred until I leave home. But they shall be discarded when a later time-event have triggered. There shall be only one deferred time-event (the most recent).
The SetPoints here described are only for the thermostat mode "Heat Eco". In the event that I manually change the thermostat mode to "Heat" or anything else, the SetPoints shall still update the "Heat Eco"-SetPoints, but effectively does nothing until I manually switch the thermostat mode back to "Heat".

Further more, I would like to have a simple On/Off (virtual) switch that when in "On" state sets the thermostat mode to "Heat", and in "Off" state sets the thermostat mode to "Heat Eco".

Re: How to setup a heating plan with dzVents?

Posted: Monday 18 November 2019 1:04
by waaren
burnersk wrote: Friday 15 November 2019 10:38 In the past week, I have had setup a heating plan for my new radiator thermostats with the Blockly event engine.
However, I quickly discovered that Blockly with its limitation (or better simplifications) cannot handle a more complex heating plan.
Please have a look at this ' proof of concept' script. It's untested because I do not own these type of setPoints / thermostats.
Script uses the setSelector which is available in dzVents 2.4.22 and the 'Off' level is defined in the selector. If you use a previous dzVents version or the Off level is not defined the you should change the values to the appropriate level-number.

Code: Select all

-- heating plan [ dzVents >= 2.4.22 ]

local workdays = 'mon, tue, wed, thu, fri'
local weekend  = 'sat, sun' 

local timer1 = 'at 05:00 on ' .. workdays
local timer2 = 'at 08:30 on ' .. workdays
local timer3 = 'at 15:00 on ' .. workdays
local timer4 = 'at 22:00 on ' .. workdays
local timer5 = 'at 07:30 on ' .. weekend 
local timer6 = 'at 10:30 on ' .. weekend 
local timer7 = 'at 22:00 on ' .. weekend 

return 
{
    on = 
    {   
        timer = { timer1, timer2, timer3, timer4, timer5, timer6, timer7 },   
        devices = { 'At Home', 'setMode' },-- virtual switch to set selector      
    },
        
    logging = { level = domoticz.LOG_DEBUG },   
    
    data = { deferredTemp = { initial = {} }},

    execute = function(dz, item)
        _G.logMarker =  _G.moduleLabel
        
        local wohnzimmerModus = dz.devices(79)   -- selector
        local wohnzimmerHeat = dz.devices(80)    -- setPoint
        local wohnzimmerHeatEco = dz.devices(81) -- setPoint
        
        local badezimmerModus = dz.devices(91)   -- selector
        local badezimmerHeat = dz.devices(92)    -- setPoint
        local badezimmerHeatEco = dz.devices(93) -- setPoint
        
        local atHome = dz.devices(105) -- switch
        local isHome = atHome.state == 'On' -- switch
        local setMode = dz.devices('setMode') -- virtual switch to be created
        
        local heatPlan = 
        {
            [timer1] = { 22, 24 },
            [timer2] = { 19, 19 },
            [timer3] = { 22, 20 },
            [timer4] = { 18, 18, 'guarded' },
            [timer5] = { 22, 24 },
            [timer6] = { -1, 20 },
            [timer7] = { 18, 18, 'guarded' },
        }
      
        local function setSetPoints(wz, bz, guarded)
            if guarded and guarded == 'guarded' and isHome then
                deferredTemp.wohnzimmer = wz
                deferredTemp.badezimmer = bz
                return -- No setPoint action now
            end
            if wz > 0 then wohnzimmerHeatEco.updateSetPoint(wz) end
            if bz > 0 then badezimmerHeatEco.updateSetPoint(bz) end
        end
        
        local function setSelectors(level)
            wohnzimmerModus.switchSelector(level)  -- levelNames only available in version >= 2.4.22 and when 'Off' defined 
            badezimmerModus.switchSelector(level)     -- otherwise use levelNumber
        end
        
        -- Main
        if item.isTimer then
            dz.data.deferredTemp = {} -- reset any deferred temp settings
            for key, value in pairs(heatPlan) do      
                if dz.time.matchesRule(key) then setSetPoints( value[1], value[2], value[3]) end
            end
        elseif item == atHome and not(isHome) then
            setSetPoints ( ( dz.data.deferredTemp.wohnzimmer or -1 ), ( dz.data.deferredTemp.badezimmer or -1 )) 
        elseif item  == setMode and item.active then   -- item = setMode device
            setSelectors('Heat')  -- levelNames only available in version >= 2.4.22 and when 'Off' defined otherwise use levelNumber
        elseif item == setMode then
            setSelectors('Heat Eco')  
        end
    end
}

Re: How to setup a heating plan with dzVents?

Posted: Wednesday 20 November 2019 0:00
by mm148881
I have 5 Eurotronic spirit zwave plus radiator thermostats at home. In the last few days I have been using dzvents and Lua to setup a scheduler for them in combination with 5 temperature sensors and a few virtual switches, which can in some case overule the scheduler. Not what you really want, but I would like to make a few remarks about the Eurotronic thermostats and blockly.

First, in my opinion the "Heat Eco" mode is completely useless in a programming environment, it is usefull only if manually you want to put a radiator in economy, which is just set it to the temperature of the eco mode - 18 C according to the zwave panel for my thermostats. If you are using dzvents or blockly, just use "Heat" and change the setPoint to what you want, just ignore the "Heat Eco". Second, if you ignore the eco mode, you can write a blockly code for your schedule. If I remember correctly you can set up an "if" block which depends also on one or more switch you have in your system. It gets of course complicated and you will have to overcome a few bugs (blockly has quite a few) on nested ifs. All of this is quite feasable, at least in my opinion.

Re: How to setup a heating plan with dzVents?

Posted: Thursday 14 January 2021 21:28
by jursat
How do you solve the switching on and off of the boiler?

Re: How to setup a heating plan with dzVents?

Posted: Saturday 16 January 2021 16:27
by Maxx
I use the "Secure Ketel Schakelaar Z-wave" to control my boiler.

On/Off only, no opentherm or other protocol