Timer AND sensor scenes

I want to set up a scene when at night Vera turns on an appliance module for a period of time if a Everspring SP103 detects motion - a relatively common scenario I would imagine.

I was hoping to do this with one scene: using a timer that activates ‘after sunset’ and then using an ‘event’ of the SP103 to turn on the applicance module. When I tried it out the SP103 activated the appliance module ok but it seems to ignore the time of day. Is there a way of setting up a single scene so that the event trigger (motion sensor tripped) AND timer must both be active?

I presume the other solution is to set up two scenes which arm & disarm the SP103 at dusk & dawn and then the 3rd scene which activates the appliance module when the armed SP103 is triggered? Just seems like a lot of scenes for a simple function?

Create your scene to turn on the light if the motion sensor is tripped and add this Lua code in the scene’s Luup tab:

return luup.is_night()

This checks if it’s night based on your location and if it’s night, the scene will run, otherwise the scene won’t run.

You can find more info here:
[url=http://wiki.micasaverde.com/index.php/Luup_Declarations#scene]http://wiki.micasaverde.com/index.php/Luup_Declarations#scene[/url]
and here:
[url=http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_is_night]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_is_night[/url]

Thanks!! This works a treat.

It’s a pity this functionality is not selectable direct from the scene options rather than relying on expert knowledge for such a common scenario.

Is it on a list for a future release?

It will surely be added in a future release.