have a scene not run fully at a specific time

what i am trying to do is this:

when my kids watch a movie i have the lights dim to about 20%, when the movie stops it goes back to 100%

what i am trying to do is not have the lights go back to 100% if it is past 9PM

is there an easy way to do this?

Have a look at Conditional Scene Execution.

i don’t see anything in there to do what i am looking for

i don’t want the the light to go past say 50% brightness if it is past 9PM

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.

am i doing something wrong with the code?

You are not returning the value from the CheckTime() function back to the scene. :slight_smile:
Scroll down the original example I provided and check the line way at the bottom

return checkTime()

[quote=“BOFH, post:6, topic:182617”]You are not returning the value back to the scene. :slight_smile:
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