Not sure if this works but idea of this script is:
The 'Zwembadpomp' turns on between 12.00 and 16.00
If I'm going to swim then I want to turn off the 'Zwembadpomp', that goes manually. If I turn it off manually (probably somewhere between 12:01 and 16:00) the 'Zwembadpomp' has to turn on between 20:00 and 23:59.
Code: Select all
return { on = { timer = { "at 12:00",
"at 16:00",
"at 20:00",
"at 23:59",
}},
execute = function(dz)
local Zwembadpomp = dz.devices(47)
if dz.time.matchesRule("at 12:00") then
Zwembadpomp.switchOn()
elseif dz.time.matchesRule("at 16:00") then
Zwembadpomp.switchOff().checkFirst()
end
if Zwembadpomp.lastUpdate.minutesAgo < 479
and Zwembadpomp.lastUpdate.minutesAgo > 240
and dz.time.matchesRule("at 20:00") then
Zwembadpomp.switchOn()
elseif dz.time.matchesRule("at 23:59") then
Zwembadpomp.switchOff()
end
end
}