Execute Scenes/Actions/Luup code when system mode changed?

Hi everyone,

I’ve been working with my VeraEdge for about a month now. I get the gist of a lot of it, I think. I haven’t put together a huge number of complex scenes or anything (yet), but this is just a start and I figure the system will grow with time.

Right now I’ve got the system setup in such a way that I can control the garage door, monitor cameras, and be alerted when things aren’t how they’re supposed to be.

What I’d like to be able to do, though, is setup some method of executing Luup code when the system mode is changed to ‘Home’ from anything else (and really, do this kind of thing for all modes, when they’re selected.)

Example: Today my wife accidentally set the mode to vacation with her thumb after previously setting it to Home. She let the dogs out, and when they came back in, the system thought it was in Vacation mode, and let the sirens loose.

I was at the computer at work, logged in, and turned the siren off, but why is it that there’s nowhere for me to do this by default when the system is set into Home mode? I anticipated this situation happening, and I have looked into setting up virtual switches, but those don’t act as switches that I can flip in the Mode configuration page. Multiswitch, Virtual Switch apps didn’t help. Is there some configuration setting within these virtual devices that I can use to make Vera think that it’s an actual hardware device, rather than some software? If I can get to that point, then I can use this as a starting point for my quest to use Luup coding to do things in one place, for each mode.

If anyone out there has managed to find some way for this to happen, please let me know how you did it!

Thank you!

Based on my preliminary testing, this is possible.

I’m assuming that on the “Configure Preset modes” page, Vera has essentially hard coded a few device types (light swithces, locks, thermostats) to be made available in the “What to do when this mode is set” section.

So what should work, is to create a new virtual device using one of those standard device types but apply your own implementation file. The implementation file itself could essentially do “nothing” (and then rely on a scene to create your actual actions), or you could put the lua for the actions you want within the device itself.

This virtual device with a custom implementation will show up in the Modes page as long as it is based on one of the standard device types (such as a light switch, lock, etc.)

Attached is a shell of an implementation file for a binary light device. If desired, put custom lua code in where specified in the file prior to uploading. You can have different code for the on and off actions. Instead of editing the file you could alternatively just react to the device’s on/off action by creating a scene and putting your “actions” there.


  1. Upload the I_CustomSample1.xml file (modified or unmodified) to Vera.

  2. Next, create the virtual device:

[ul][li]Go to Apps…Develop Apps…Create Device[/li]
[li]Enter in a name for this virtual device in the description field[/li]
[li]For Upnp Device Filename, enter → D_BinaryLight1.xml [/li]
[li]For Upnp Implementation Filename, enter → I_CustomSample1.xml (or you can rename this file before you upload it and put that new file name here) [/li]
[li]Restart the lua engine. (This may need to be done a couple times in my experience.) [/li]
[li] Refresh your browser.[/li][/ul]

  1. You should see the new “light” device on your devices list, and you should also see it on the Modes page where you can instruct vera to turn on or off the light when entering a mode. So for a given mode (in your case “Home”), set this new light device to “turn on.”

  2. If you did not put in any custom code in the I_.xml file, just go to the scene editor and create a scene that runs when this device is turned on (or off)…Select exposed device actions, use the advanced editor actions, or custom Lua, etc.

(Edit: modified for clarity)


I’m looking for the same thing.
Why don’t we have the possibility to launch a scene from the mode panel ?
It’s very limited to Vera’s people point of view, which is very restrictive.
Isn’t the thing about home control to enable all scenarios based on your own imagination, and not limited to boxes’ creators view ?

Please , just list all scene in the mode panel, and let us activate what we want !


You can use the house mode plugin with the Vera house mode UI to execute Luup code when the house mode change.