Say you have a dzVents script for switching lights and you have several triggers for both switching them on and switching off. In the execution part of the script, how do you know which trigger was actually triggered? Do you have to do a manual check with hard-coded values that was it the trigger e.g. for switchig the lights off at 09:00?
For now I have done like this:
Code: Select all
...
timer = {
'at sunrise',
'at 05:30',
}
...
execute = function(domoticz, triggeredItem, info)
local gardenLights = domoticz.devices(122)
local Time = require('Time')
local currentTime = Time()
...
...
if (currentTime.matchesRule('at 05:30')) then
gardenLights.switchOn()
elseif (currentTime.matchesRule('at sunrise')) then
gardenLights.switchOff()
end
end
Regards,
Peik