My goal is to have only allow a scene to run between 21:30 to sunrise. Using the sample code I think I figured out how to do it but I’m not quite sure. Does the below code look right?
local pStart = “21:30”
local pEnd = 0
local allow = true
local mStart = math.floor( (luup.sunrise() % 86400) / 60 ) [color=red]+ pStart --I don’t need this because I want it to run all the way to sunrise, right?[/color]
local hE, mE = string.match(pStart,“(%d+)%:(%d+)”)
local mEnd = (hE * 60) + mE
local tNow = os.date(“*t”)
local mNow = (tNow.hour * 60) + tNow.min
if mEnd >= mStart then
return (((mNow >= mStart) and (mNow <= mEnd)) == allow)
else
return (((mNow >= mStart) or (mNow <= mEnd)) == allow)
end
Thanks