scene motion sunset

Hi All,
Im have now read posts here in the forum (and other forums as well) and I cant understad how to make a simple scen… I know newbie…

This is what I try to do:
when motion is trigged by my aeotec 4 in1 sensor I would like to switch on a lamp but only after sunset (and stop when its sunrise).

I tried PLEG but all guids i find using UI5 ind it looks very different.
I tried to add luup code

I cant get it to work …

I have a veralite UI7 (1.7.855)
installed pleg 8.11 and PLC 8.19

//Fat

There is lots of information to be found if you know the right terms to search for!

Try this post for a useful introduction to Conditional Scene Execution.

PLEG is, indeed, another option.

Thanks akboober,
I tried to use “return luup.is_night()” in my scene but it didnt work.
I add it to my working scene (working day and nigh) under “Also, execute the following Luup code:”

Did i do anything wrong did I missed anything?

//Fat

That should work, assuming the scene does what you want when you trigger it manually (ie. the action to turn on the light) and that your trigger from the Aeotec is set up correctly in the first place.

When you said:

I tried to add luup code

I cant get it to work …

what exactly happened (or not) ?

One thing you could add to your Lua code before the return statement is

luup.log "scene code got to this point OK"

and check for the in Vera’s log.

The scens works “perfect” when motion is triggerd the lamp is switched on (turns off after 5 min, as I want)
When I added the return luup.is_night() in option execute the following Luup code: , and trigger the scene manual it runs and switch on my lamp (did this when it was not night :))

I will look in to the log file.
Thank you for quick response!

//Fat

There are TWO places you can add the LUA code … and they will have different behaviors.

  1. There is a TRIGGER level LUA … this will cancel ONLY the trigger it is attached to, i.e. the Motion trigger.

  2. There is a SCENE level LUA … this will cancel ANY requests, even manually invoked requests.

Now i got it to work!!
Added it to the scene, also rebooted the vera.
Thank you all for your help!

//Fat