Writing a scene to endlessly loop Action

I have been with my Vera 3 for about 2 years now, but put it down besides basic turning various lights on/off in my house. I came back to it last month only to have a totally new user interface. I had this scene in the old version which essentially did a set of actions over and over indefinitely. I am having a hard time trying to mimic that request for the new UI for Vera. I am running Version1.7.388 .

Can anybody help me with my request for a simple unlimited repeater at the end of the scene, essentially looping the scene over and over and over and over again?

What does the repeated scene do? Does it use Luup code or just normal device actions with delays? How did you get it to loop previously?

It uses just normal device actions with delays. Here is the logic I had last time for the old UI:

Scene 1 Turn on x and after y minutes Turn OFF - Trigger when x turns ON

Scene 2 Turn off x and after y minutes Turn ON - Trigger when x Turns OFF

The old UI wasn’t as user friendly as the newer one, but i’m still having issues setting up this infinite loop…

You know your infinite loop will stop if Vera is Restarted … you will have to manually trigger the switch to get it started again.

Richard is right - this would not survive a restart.

The most robust way to achieve this would be using the Program Logic Event Generator (PLEG) plugin. PLEG automatically restarts its timers if Vera restarts.

If you want to do it using scenes, you could try triggering a scene with a schedule for every y minutes and adding Lua code to toggle the device state. This would not be as precise as PLEG following a restart but it should at least self-start.

At this point, I have to babysit the Vera and every few hours I re-trigger the device which runs the scene to make sure it runs correctly… I know there has to be a more robust way through code and setting things up to make it solid and reliable. sigh

I know zero about LUA Code, looks like i’ll have to start diving into it and get a better understanding. Wish we could just go back to the simpler UI :slight_smile:

Thanks for responding Guys, its appreciated.

The following code, placed in the Luup tab of a scene, will toggle the state of Z-Wave switch device number 123 every time it is run. Change the first line to match your actual device number. The scene does not require any device actions to be selected.

If the device you are controlling is not a Z-Wave switch, let us know what it is and we can give you the appropriate code.

local dID = 123 -- Device ID of your Z-Wave Switch local status = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status",dID) if status == "1" then luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=0},dID) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=1},dID) end

If you create a trigger for the scene with an appropriate periodic (interval) schedule, it should save you having to babysit your Vera.

Thanks for the code, I will input and see how it reacts. Is there an Editor I can download for the Luup language?

Is there an Editor I can download for the Luup language?

You can use any text editor. Notepad++ is very good and free.

If you want something that can test your code, there are a few choices:

Lua for Windows will run on your PC. It is good for basic Lua but does not support Vera’s luup functions. It is free.

ZeroBrane Studio for Vera is a powerful Integrated Development Environment for Lua. It runs on Windows or MAC but runs your Lua code directly on Vera so it supports the luup functions and can see your devices. It is excellent but requires a paid licence.

LuaTest runs on Vera and provides simple editing functions and the ability to test code directly in the same environment as scene Lua code. It isn’t a patch on ZeroBrane but it is designed specifically to create and debug code for scenes. Disclosure: I wrote it.