Page 1 of 1

Group thermostats

Posted: Tuesday 15 August 2017 18:53
by anasazi
Hi,

Version: 3.8153
Platform: Windows Server 2012 R2
Hardware: Z-Stick gen 5

In my home I have 9 Danfoss LC-13 thermostats and 3 of them are in the same room.
I need your help to figure out how to group these 3 thermostat so that I only controll one (or a dummy) and the other 2 updates to the same setpoint.
My goal is to be able to change the setpoint both trough the webgui, ios app and on the thermostats itself.

I want to use Lua for this and I have tried some script but none is working the way I want.
I have tried to convert this script to Lua but I can not control it on the thermostats without creating a loop:

http://www.domoticz.com/forum/viewtopic ... om#p107929

Code: Select all

if($s['livingZ'] !=$RSetliving)
{
    lg('Danfoss livingZ was '.$s['livingZ'].',nieuw='.$RSetliving);
    ud($i['livingZ'], 0,$RSetliving,'RlivingZ',2000000);
}
if($s['livingZZ']!=$RSetliving)
{
    lg('Danfoss livingZZ was '.$s['livingZZ'].',nieuw='.$RSetliving);
    ud($i['livingZZ'],0,$RSetliving,'RlivingZZ',2000000);
}
if($s['livingZE']!=$RSetliving)
{
    lg('Danfoss livingZE was '.$s['kamerZ'].',nieuw='.$RSetliving);
    ud($i['livingZE'],0,$RSetliving,'RlivingZE',2000000);
}



And this script: viewtopic.php?f=6&t=4347&start=40

Code: Select all

sp1Name    = 'SP Bagni'     -- Nome set Point Virtuale
spR1       = 23                      -- Valvola Fisica 1
spR2       = 82                      -- Valvola Fisica 2
T1         = otherdevices[sp1Name]   -- Lettura Temperatura SetPoint Virtuale

commandArray = {}
   if devicechanged[sp1Name] then
      commandArray[#commandArray + 1] = {['UpdateDevice']=spR1..'|0|'..tostring(T1)}
      commandArray[#commandArray + 1] = {['UpdateDevice']=spR2..'|0|'..tostring(T1)}
   end
return commandArray

Has someone been able to group thermostat and control the setpoint from gui, ios and on the thermostat?
Any help with this would be appreciated...
Thanks!

Re: Group thermostats

Posted: Tuesday 15 August 2017 21:59
by heggink
Kind of. I had a challenge in that my nest thermostat wasn't as smart as Google envisaged. It switched on whenever it felt like it. What I did was to create a dummy thermostat with its own schedule. Whenever it changes, a script triggers the real thermostat to copy its settings. Also, when I return home, it sets the nest to the dummy temp. I think you can do something similar. I did run into some issues where the script would not trigger on the dummy change but dzvents and blockly works fine.

Re: Group thermostats

Posted: Wednesday 16 August 2017 12:02
by anasazi
Hi,

Is it possible for you to share the code for dzvents and image of the Blockly code?

Thanks!

Re: Group thermostats

Posted: Wednesday 16 August 2017 17:21
by mivo
Hi,

I am using this dzVents script for thermostats control by master virtual setpoint device:

Code: Select all

local LOGGING = true

local devicesSlave = { -- List of slave thermostat devices
    'setpoint 1',
    'setpoint 2'
}

return {
    active = true,
    on = {
        devices = {
            'Virtual Setpoint' -- Setpoint virtual master device
        }
    },
    execute = function(domoticz, device, triggerInfo)
  
        -- variables
        local newSetpoint = device.setPoint -- get new setpoint
    
        if LOGGING then
            -- debug logging
            domoticz.log('New Setpoint: ' .. newSetpoint)
        end
    
        -- iterate and change setpoint of devices in list 
        for idx, dev in pairs(devicesSlave) do
            -- assign device to variable 
            local deviceSet = domoticz.devices(dev)

            -- check if not already set
            if deviceSet.setPoint ~= newSetpoint then
                domoticz.log(dev .. ' setting to: ' .. tostring(newSetpoint))
                deviceSet.updateSetPoint(newSetpoint)
            else
                domoticz.log(dev .. ' already set: ' .. tostring(newSetpoint))
            end
        end
    
    end
}