I'm working out a system to automate the lights in my kitchen. I think I've managed to create a timer that triggers at 30 minutes before sunset AND at 17:30 AND at 20:00, but now I want to check which of the above statements triggered my script. I checked the wiki but there are so many options and possibilities that I can't find what I need. See also below example:
Code: Select all
return {
on = {
timer = {
'30 minutes before sunset',
'at 17:30',
'at 20:00'
}
},
execute = function(domoticz, timer)
domoticz.log('Timer event was triggered by ' .. timer.trigger, domoticz.LOG_INFO .. ' at time ' .. domoticz.time)
local keuken_ledstrip_koof = domoticz.devices("Keuken_ledstrip_koof")
if domticz.time >= "20:00" then
keuken_ledstrip_koof.cancelQueuedCommands()
keuken_ledstrip_koof.dimTo(10)
elseif keuken_ledstrip_koof.level == 0 then
keuken_ledstrip_koof.dimTo(15)
end
end
}
Code: Select all
if level_prev > 0 then
keuken_ledstrip_koof.cancelQueuedCommands()
if domoticz.time >= "20:00" then
keuken_ledstrip_koof.dimTo(level_prev+20)
else
keuken_ledstrip_koof.dimTo(level_prev+30)
end
keuken_ledstrip_koof.dimTo(level_prev).afterSec(30)
end
Kind regards,
Falco