We have moved at community.getvera.com

Author Topic: Timer AND sensor scenes  (Read 2907 times)

Offline Frasier

  • Full Member
  • ***
  • Posts: 196
  • Karma: +1/-1
Timer AND sensor scenes
« on: August 02, 2011, 09:50:53 am »
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?

Offline mcvflorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1755
  • Karma: +11/-3
Re: Timer AND sensor scenes
« Reply #1 on: August 02, 2011, 10:11:21 am »
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:

Code: [Select]
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:
    http://wiki.micasaverde.com/index.php/Luup_Declarations#scene
and here:
    http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_is_night
« Last Edit: August 02, 2011, 10:15:31 am by mcvflorin »

Offline Frasier

  • Full Member
  • ***
  • Posts: 196
  • Karma: +1/-1
Re: Timer AND sensor scenes
« Reply #2 on: August 02, 2011, 04:30:50 pm »
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?
 

Offline mcvflorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1755
  • Karma: +11/-3
Re: Timer AND sensor scenes
« Reply #3 on: August 03, 2011, 04:25:08 am »
It will surely be added in a future release.