Configure LUUP scene to be continuously running after startup

I have written a LUUP scene that I need to be continuously running. Right now, I have a start up code which calls the scene to run once when the Vera is reloaded. And the scene only runs once when I manually run it.

The problem I’m having is that I need to be constantly updating delay times and device states, and hence need the scene continuously running to keep track (i.e. if no motion is detected for 15 min, turn off lights). That was a super simple example of what I’m trying to accomplish, otherwise I would just use triggers. However, the scene I’m attempting to run is too complex to use the GUI triggers, so does anybody know how I can accomplish this in LUUP?

Thanks!

You need to write a function that, as it finishes, schedules itself to be called again in (say) one minute. Search the forum for “luup.call_delay” to find examples.

Thanks! If anyone else is having trouble with this, here is my code. I added this to the Lua Startup tab:

luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "Reload", {}, 0) PROGRAM_CONTROLLED_SCENE="5" luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum=PROGRAM_CONTROLLED_SCENE }, 0) luup.log("VERA Scene..Started UP!!!")

And to continuously call the scene every 60 seconds, I put in the scene LUUP code:

function restartScene() luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum=13 }, 0) end luup.call_delay("restartScene",60,nil,true)