need a little help with motion and lightings

Finally got my motion sensor to work. I created a scene to turn on a light when there’s motion detected and turn off after 5 minutes.

However, I want the light to remain on for as long as motion is detected and only turn off if motion hasn’t been detected for 5 minutes after

on top of that I only want this scene to work 30 minutes before sunset and 30 minutes after sunrise.

I use the SmartSwitch plug-in for all my motion and door sensors to activate my lights when motion is detected. You can also setup scenes to change its settings, for example for a set of dimmable bulbs and after 9pm I have a scene run that lowers the brightness of the bulbs when motion is detected. I’m sure you could do something similar for your scenario.

cool, I just installed this and got the scene working. Not seeing how I can set it to only do this at night or sunrise/sunset

I think you could accomplish this with another scene to change the “SetOnLevel” to 0 or maybe Off (not sure which one would work) during the day. I use that variable to change the dimness of my bulbs so I don’t see why you couldn’t just change it to off.

you can add the Luup code isnight() to the scenes. It might not do it for the 30 mins before and 30 mins after, but it will be near enough

see here: [url=http://forum.micasaverde.com/index.php/topic,18679.msg141954.html#msg141954]http://forum.micasaverde.com/index.php/topic,18679.msg141954.html#msg141954[/url]

Personally i would do this with a PLEG.
Set the onetime for the motion sensor as 5 mins (300 seconds). This means means the sensor will stay tripped for 5 mins after the last motion.
Set a schedule starting with 30 mins before sunset, finishing 30 mins after sunrise, call it ‘night’ for example
Set a device property for the motion sensor. Add the motion sensor and tripped status, named ‘motion’ for example

The condition would then
(night) AND (motion)

Action would be to turn the light on.

you could then do another condition a bit more general as below. This captures any movement that might overlap the ‘night’ time.
(!motion)

Action to turn the light off.

For whatever reason, I’m having issues with both PLEG as well as smartswitch but I’ll ltake it to the proper forum.

What are the issues?

Smartswitch - was working fine for a day, the following day neither of the 2 smart switch created trigger the lights.

PLEG- I can’t create anything, after creating the scene it would disappear after awhile.