Conditional Scene Trigger

This is probably easy. I am using UI7 and have a scene that I want to run only at night (when I open my front doors, turn the hallway lights on, wait a minute and turn off).

return luup.is_night()

does the job. I know how the command work. If it is night, return true. Now, where does this code go? When I make the scene does this go under “Also, execute the following Luup code:” or somewhere else? Does this even work anymore?

Thanks!

It goes in the LUA for a scene,

Before a scene executes the commands (Actions) for the scene … it runs any LUA code for the scene.,
If that code does not exist or it returns true or nothing .,. than the actions are run.
If that code exists AND it returns false then the actions are NOT run,

Perfect. The language made me think that it “also” executes the code at the end, not before.

Thank you!

I am trying to use

return luup.is_night()

in the Luup section of my scene, so that the scene can only run when its night. I am on UI5 though, and have the day night plugin.

I get a error message error in lua for scenes and events ?

So what is the error message?

error in lua for scenes and events

at the top where all the error messages are displayed