Dumb Scene Question

Hi Everyone:

Sorry for a rather dumb question, but I can’t logically figure out how to best do this.

-I have an entryway light that is programmed to be on from sundown to midnight.
-I just installed a motion sensor at the entry and have it set to alert me when tripped 24 hours a day.
-I have things now set such that if the motion sensor trips after midnight, it will turn the porch light on for a few minutes.

Question: How do I get it to stop tripping the light after sunrise? I still want to be notified of motion 24 hours a day, but I do not want the light turned on by the motion sensor again until the following midnight rolls around.

Many thanks!

You will find an example of how to do this with Lua code in this thread. Look for the example using luup.is_night() or the DayTime plugin.

Assuming you will be adding other automation logic, you should also look at the Program Logic Event Generator (PLEG) plugin. See PLEG Basics for an introduction.

Rex-

Thanks so much - that other thread is very helpful.

This is my first foray into LUA. If I am undertstanding correctly, I am going to go into the trigger for the scene where th emotion sensor trips and activates the light and click the link for “Luup Event” and paste the following in:

return luup.is_night()

That should do it, @Handyman.

Rex - thanks so much. I also noted on the other thread that I can set my own start end times with the code below (pasted into the same place I presume?) I will try this instead…

local pStart = “22:30” – Start of time period
local pEnd = “06:15” – 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

Rex - thanks so much. I also noted on the other thread that I can set my own start end times with the code below (pasted into the same place I presume?)
Yes. Exactly where you put the other code.

In your original post, you wanted the morning time to be sunrise. If you still want that, the following small modification will set the end time to sunrise with a +/- minutes offset.

local pStart = "22:30" -- Start of time period local pEnd = 0 -- End of time period, minutes offset from sunrise 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 mEnd = math.floor( (luup.sunrise() % 86400) / 60 ) + pEnd 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