I have an Evohome zone and some Z-Wave thermostats. This kind of works ok, but only the first IF, not the second. What I'm doing wrong?
Basically I can override the temperature from either the Evohome or the Z-wave virtual thermostat. When I override from Evohome it works, but when I override from the virtual thermostant, only the Evohome part triggers.
Code: Select all
--[[
Heating override
]]--
return {
on = { devices = { 'Downstairs', 'Downstairs Thermostat'} }, -- EvoHome trigger or Virtual Thermostat
execute = function(domoticz, Thermostat)
local DownEV = Thermostat.setPoint -- Evohome zone Thermostat
local oldTemp = domoticz.variables('recordTempDown').value -- user variable to record last set temperature
local DownTRV = Thermostat.setPoint -- setpoint of Virtual thermostant
if DownEV ~= oldTemp and domoticz.variables('updateBusy').value == 0 then
domoticz.variables('updateBusy').set(1) -- I'm busy
domoticz.devices('Downstairs Thermostat').updateSetPoint(DownEV)
domoticz.variables('recordTempDown').set(DownEV)
print ("***************** Virtual Thermostat Down UPDATED!! to: " ..DownEV.." ********************")
domoticz.variables('updateBusy').set(0) -- Not busy anymmore
elseif
DownTRV ~= oldTemp and domoticz.variables('updateBusy').value == 0 then
domoticz.variables('updateBusy').set(1) -- Set to busy
local myZone = domoticz.devices('Downstairs') -- Evohome zone
local untilDateTime = os.date("!%Y-%m-%dT%TZ",os.time()+7200) -- current time + 2 hours
myZone.updateSetPoint(DownTRV,"TemporaryOverride",untilDateTime)
domoticz.variables('recordTempDown').set(DownTRV)
print ("************ SETPOINT Evohome zone updated " .. myZone.name .. " to: " .. DownTRV .. " , until: " .. untilDateTime .. " *******")
domoticz.variables('updateBusy').set(0) -- Not busy anymore
end
end
}