I’d like to ignore a trigger if it occurs within +/- 10 minutes of sunrise. How can I do that?
One possibility: make a virtual switch, have a scene turn it on 10 minutes before sunrise, then another scene turn it off twenty minutes later.
Then your action can test the virtual switch in its Luup code and return false of the switch is on. Or use PLEG to do the same thing.
Hi,
This code should make the scene run only if it is starting out of the +/-10 minute window around the sunset time :
local diffSunsetTime = os.time()-luup.sunset()
if ((diffSunsetTime > -600) and (diffSunsetTime < 600)) then
return false
else
return true
end
Should it? If so, the docs on luup.sunset() are wrong, because they imply that after sunset it is supposed to give you the timestamp of tomorrow’s sunset.