return luup.is_night() creates error in lua for scenes and events

I have added

return luup.is_night()

to the Luup section of my scene to prevent it running at night. (Day and Night plugin is installed)

This is what is in my Luup section of the scene:

[code]return luup.is_night()

luup.call_action(“urn:micasaverde-com:serviceId:HomeAutomationGateway1”, “RunScene”, {SceneNum = “85”}, 0)[/code]

with this I get error in lua for scenes and events after the reload (in the top blue box of UI5)

without the return night() I do not get that error.

What am I doing wrong ?

Your’e not allowed any statements after a return in the same block of code.

You will have to refactor with an if statement.

This has, by the way, nothing to do with the DayNight plugin.

Ok that explains the error. Not sure how to do the if statement in there, but I think I can just get rid of the

luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "85"}, 0)

and call that from the advanced section, PLEG run scene 85. That would probably the easiest option. I think that’s all the above does, not sure why I did put that in Luup rather than call PLEG to run the scene. But its been there for a long time so cant remember what I did there