Page 1 of 1

Turning on switch based on two thermostats

Posted: Thursday 19 November 2020 11:45
by blader18
Hi guys,
Simple question here.
I have two thermostats. How can I create a condition to enable one switch if one of the thermostat is above a X temperature and the second thermostat is above Y themperature?

Thanks in advance.

Re: Turning on switch based on two thermostats

Posted: Thursday 19 November 2020 13:00
by waaren
blader18 wrote: Thursday 19 November 2020 11:45 Hi guys,
Simple question here.
I have two thermostats. How can I create a condition to enable one switch if one of the thermostat is above a X temperature and the second thermostat is above Y themperature?

Thanks in advance.
You probably need scripting to do that in domoticz.
Using dzVents it could look like below example

Code: Select all

return 
{
    on = 
    {
        devices = 
        {
            'thermostat1', -- change your thermostat name
            'thermostat2', -- change your thermostat name
        }
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- set to domoticz.LOG_ERROR when all ok
        marker = 'multiple thermostats',
    },
    
    
    execute = function(dz)
        local thermostat1 = dz.devices('thermostat1') -- change your thermostat name
        local thermostat2 = dz.devices('thermostat2') -- change your thermostat name
        local mySwitch = dz.devices('mySwitch') -- change your switch name
        
        local xTemperature = 10
        local yTemperature = 20
        
        if thermostat1.setPoint > xTemperature and thermostat2.setPoint > yTemperature then
            mySwitch.switchOn().checkFirst()
        end
    end
}