Hi Waaren,
Thank you for your script, also works for me!
Small question: If the door/window is still open and "somebody or a scheduled task" will change set point on thermostat, what could be done to reinforce the value again to 15°C?
I tryed like that but without success

with another elseif:
Code: Select all
execute = function(dz, item)
local delay = 10
local toon = dz.devices('Toon Thermostaat')
local door = dz.devices(doorContact)
if item.isDevice then
dz.log('Contact ' .. item.name .. ' state is ' .. item.state, dz.LOG_DEBUG)
if item.state == 'Open' and dz.data.lastSetpoint == -99 then
dz.emitEvent(scriptVar).afterSec(delay)
elseif item.state ~= 'Open' and dz.data.lastSetpoint ~= -99 then
toon.updateSetPoint(dz.data.lastSetpoint)
dz.data.lastSetpoint = -99
end
else
if door.state == 'Open' and dz.data.lastSetpoint == -99 then
dz.data.lastSetpoint = toon.setPoint
toon.updateSetPoint(15)
elseif door.state == 'Open' and toon.setPoint ~= 16 then
dz.log('!!!DEBUG only, when last elseif was called' , dz.LOG_DEBUG)
toon.updateSetPoint(15)
end
end
Thx for your advice