This is an advanced scene scenario (requiring Indigo 7.4+), based on the basic scenes How-To, with some additional functionality. It is sometimes desirable to return a light or other device to a previous state when a “scene” is turned off. In this How-to, we'll describe how to restore the lights in a scene to their state prior to the scene getting activated. This How-to level of difficulty is Moderate.
Earlier versions of this how-to required scripts - but with Indigo 7.4+, you can do it completely through the UI.
To recap the scenes scenario: Joe has some nice wall sconce lights in his TV room that are controlled by an SwitchLinc and a table lamp connected through an ICON Lamp Module. He also has just installed some X10 controllable window shades (an X10 ON command lowers them, an X10 OFF command raises them in this example). He has a ControLinc that he wants to set up so that when he hits Button 1 ON, the sconces dim to 20%, the table lamp turns off, and the window shades go down. Here's the difference between the basic scenario and this one: when he hits Button 1 OFF, the sconces, the table lamp, and the window shades will return to their previous state. In other words, the room will look like it did before he pressed the Button 1 ON. This scenario will require Indigo 4.0 Pro since we'll need to use some AppleScript.
This scenario isn't really too difficult, but it does require a Python script, which we will provide here:
Variable List from the Window menuNew… button to create a new variableYou now have 3 variables, named “sconce_previous”, “lamp_previous”, and “shades_previous”. These variables will hold the state that those devices were in prior to setting them to what they need to be for the scene.
So, now we need to create 2 trigger actions so that when Joe presses the right buttons on his ControLinc, the actions listed in the scenario above happen correctly. The first one will be for the On command:
TRIGGERS in the outline view on the left side (we're going to make theseNew… button above the trigger listINSTEON Command Received from the Type: popupDevice radio button beside From: if not already checkedDeviceOn on the popup next to Received:, and Button/Group 1 on the popup next to thatActions tab (you can skip Condition for this example)Variable Actions→Insert Device State into VariableDevice popup, select your sconce deviceEdit Action Settings… if one didn't automatically pop up), select brightness for the state and sconce_previous for the variableSave buttonAdd New button at the lower left to add another action - don't worry, the one you just created isn't gone, it's just hidden - you can see all actions by clicking the Show All button and you can cycle through all actions using the Prev and Next buttons next to Show:.onOffState) for the state assuming that you're using a on/off (relay) device to control your shadesAdd New button at the lower left side of the dialog againDevice Actions→Light/Appliance Controls→Set Brightness from the Type: popupDevice: popupAmount:Add New button againDevice Actions→Light/Appliance Controls→Turn Off from the Type: popupDevice: popupAdd New button againControl Light / Appliance from the Type: popupTurn On from the Action: popupDevice: popupThat's it! So, to recap, what we did was create a trigger action that will fire when “Button 1 ON” on the ControLinc is pressed. It executes 4 actions: runs a script that saves the state of each device into variables, sets the brightness of the sconces to 20%, turns off the table lamp, and lowers the blinds by sending them an ON command (note, if they are already down, nothing will happen). So, how do we reverse the process? Read on…
As you may have guessed, we need to create another trigger like the one above, except it reverses the process:
TRIGGERS in the outline view on the left side (we're going to make theseNew… button above the trigger listINSTEON Command Received from the Type: popupDevice radio button beside From: if not already checkedDeviceOff on the popup next to Received:, and Button/Group 1 on the popup next to thatActions tab (again, skip Condition for this example)Device Actions→Light/Appliance Controls→Match Brightness to Variable from the Type: popupsconce_previous from the Variable: popupDevices: listSave buttonAdd New button at the lower left to add another actionDevice Actions→Light/Appliance Controls→Match Brightness to Variable from the Type: popuplamp_previous from the Variable: popupDevices: listSave buttonAdd New button at the lower left to add another actionDevice Actions→Light/Appliance Controls→Match On State to Variable from the Type: popupshades_previous from the Variable: popupDevices: listSave buttonYou've now created two scenes for Joe's TV room: one he'll use when watching a movie and another that returns the room to its previous state. As you can probably see, there are other things you can do to make this scene even more useful: if you have an Infrared receiver, you could program a button on your current IR remote to trigger the actions. If you have A/V devices supported by a 3rd party plugin, you could add extra actions that would set the rest of your A/V equipment up so that it's ready to watch a movie.
In a simple trigger action, there is probably only one action that you want to take. In the scenario that we just finished, though, we have several actions we want to perform (adjust 2 different lights and the window shades). Indigo lets you specify multiple actions in the “Create New Trigger Action” dialog, and that's how we did it here. If, however, you had multiple ways you wanted to trigger these actions (besides just buttons on a single ControLinc), then you would implement the actions in Action Groups. Feel free to read up on those at your leisure!