What RexBeckett is pointing to is the ‘Multiple Condition’ code fragment here (http://forum.micasaverde.com/index.php/topic,18679.msg142204.html#msg142204) Specifically the CheckTime() function. You may need to customize/tweak that code a little bit. Set the end time to 9PM and eg the start time to 9AM. Between 9AM and 9PM lights will go 100%, between 9PM and 9AM lights will not change.
Use the CheckTime() function in the Luup part of your ‘when movie stops lights back to 100%’ scene to determine if it is past 9PM, if so that code will return a false condition and your scene will not run.
If you want the lights to go from eg 20% to 50%, create a 2nd scene the same as your 1st one and swap start and end times to set condition to True. So between 9PM and 9AM lights will go from 20% to 50% instead of to 100%. That way depending on the time, either scene 1 or scene 2 will run.
[quote=“BOFH, post:4, topic:182617”]What RexBeckett is pointing to is the ‘Multiple Condition’ code fragment here (http://forum.micasaverde.com/index.php/topic,18679.msg142204.html#msg142204) Specifically the CheckTime() function. You may need to customize/tweak that code a little bit. Set the end time to 9PM and eg the start time to 9AM. Between 9AM and 9PM lights will go 100%, between 9PM and 9AM lights will not change.
Use the CheckTime() function in the Luup part of your ‘when movie stops lights back to 100%’ scene to determine if it is past 9PM, if so that code will return a false condition and your scene will not run.
If you want the lights to go from eg 20% to 50%, create a 2nd scene the same as your 1st one and swap start and end times to set condition to True. So between 9PM and 9AM lights will go from 20% to 50% instead of to 100%. That way depending on the time, either scene 1 or scene 2 will run.[/quote]
makes sense
just tried what you said
i put
local function checkTime()
local pStart = "09:00" -- Start of time period
local pEnd = "21:00" -- End of time period
local allow = true -- true runs scene during period, false blocks it
local hS, mS = string.match(pStart,"(%d+)%:(%d+)")
local mStart = (hS * 60) + mS
local hE, mE = string.match(pEnd,"(%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
end
into the LUUP section, but the lights still jump to 100% when i stop the movie.
You are not returning the value from the CheckTime() function back to the scene.
Scroll down the original example I provided and check the line way at the bottom
[quote=“BOFH, post:6, topic:182617”]You are not returning the value back to the scene.
Scroll down the original example I provided and check teh line way at the bottom
return checkTime()[/quote]
thanks, right before you posted i saw the error in the GUI.
everything is working now
thanks again
Best Home Automation shopping experience. Shop at Ezlo!