How could I stop a scene which is running?

How could I stop a scene which is running?

Unless you’re doing something exotic, scenes do not continue to ‘run’ so much as just run and finish. The scene generally leaves your HA system in a different state. If you want to change that state, run another scene (for example.)

I’ve wondered about this too. I have a scene that turns on my bedroom lights, and dims the downstairs ones. And a few minutes later, it kills the downstairs lights.

Twice last weekend I hit that button by mistake and ran that scene in the middle of the day >:(

Maybe I shouldn’t’ have the scene do this, but I’d be interested in stopping in mid-scene.

One solution to that is to refactor the scene into two: one immediate, one delayed. The delayed scene could check for an ‘abort’ condition (which might be that a switch has reverted to its original position or some such thing.) Multiple delays in scenes are not, on the whole, a great idea.

Since this is posted in the Scripting section: You could use LUA global variables to accomplish this. Global variables do not survive a reboot, but in this case, the delayed part of the scene also would not survive the reboot, so you could go ahead and use it.

What I do is set the global variable, then set a timer to reset that global value after a short duration. Then in the main LUA code, if that variable is set I do something different.

For example, my garage light is on a timer. If I press the on switch twice within 10 seconds, the on time is doubled (and tripled if I press it a third time). If it is pressed after the 10 seconds has elapsed, the timer time is just reset to the full amount of time. Of course this is all done in LUA code. I believe the code is documented somewhere around here.

Of course that only works if you do all of the delayed actions in LUA and do not use the delays that are part of the graphical scene definition.

PLEG can also be used for these more complicated scenes. And the actions do survive a Vera reboot.

Yep I just confirm for myself today that luup ignores those delays. I got around it by using the delay and the advanced tab to call the device action I want.

Sent from my iPad using Tapatalk

I have a running scene in case of alarm. There are several bulbs that light up in a certain order and siren works. It takes about 3 minutes. It is very unpleasant for me that I can not do anything during this time. What can I do?

If the scene is made up of several events separated with delays, one idea would be to attach luup to each of the timed events that will cancel it in the case of a virtual switch is turned on/off.

so if you inadvertently trip the scene, you can go to your mobile phone and turn off (or on) the virtual switch. Any subsequent event which has not yet fired and tied to that scene could then be ‘cancelled’.

I do the same thing, but use a global variable instead of a Virtual Switch. Global variables take less memory, and if Vera reboots and the global value is lost, my delays will also be lost so the problem is moot.

Be sure to initialize the Global Variable in the Lua start up code.

You could set a “bOkayToProceed” (for example) to 1 in the activating scene. Then each subsequent event checks to see if “bOkayToProceed” is still 1. If not, stop. Then all you need is a way to reset “bOkayToProceed”. On my scenes that are manually activated, I simply check the “bOkayToProceed” value, and either reset it to 0 or start the sequence.