====== Action Collection ====== Note: the Action Collection plugin has been more directly integrated into Indigo 6 and so the action descriptions have moved to the normal Actions documentation for the releases from now on. As the name implies, this plugin is a collection of miscellaneous actions that you may find useful (the Indigo version in which the action was made available is in parenthesis): * **''Insert Device State into Variable''** - this will insert the selected state of the selected device into the specified variable. Specify the device, then configure the action and it will show you a popup with all possible states and a popup of all variables. You can create a trigger that executes when a device's state changes and have it insert the new state into the variable. * **''Insert Timestamp into Variable''** - this will insert the current time into the specified variable, using the optional format string as defined in the [[http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior|Python datetime string formatting]] documentation (see the chart at the bottom for format specifiers). * **''Toggle Variable''** (added in v1.3.0) - this will toggle a variable between a two values specified in the dialog: true/false, on/off, yes/no, enabled/disabled, and custom. The first 4 are self explanatory (although note that values will be converted to lower-case for comparisons). The last option, Custom Values, will allow you to specify the values. We will first try to match the custom variables without converting to lower case (some unicode characters behave oddly when lowercased) and if we don't find a match then we'll convert. Finally, if nothing matches, we'll just set the value to the first value. * **''Set Variable to Variable''** (added in v1.4.0) - this very simple action will set the value of one variable to another. * **''Open File''** - this will open the specified file (full path using *nix slashes ("/")) using the default application. If it's the path to an application (e.g. "/Applications/TextEdit.app") then it will launch that app. * **''Run Shell Script''** - this will run the specified script file optionally with the output being inserted into the specified variable. The script must be marked executable and the shebang (#!) must be specified at the top of the script. **Note** - this won't work for AppleScripts - you should use the built-in Execute Script action and select the script file that way. Also, if you're running a Python script you'll probably just want to use the Execute Script action since script files run from this plugin won't have access to the IOM (//''import indigo''//, which is Python-only). * **''Write to Log''** - this will write the specified text into the event log - optionally with the specified type string * **''Cycle Through Thermostat Modes''** (added in v1.1.0) - this will allow you to easily cycle through thermostat modes in this order: Off, Cool, Heat, Auto. Especially useful in conjunction with the "Thermostat Mode+.png" image on a control page - just add this as a server action and you have a simple control for adjusting the thermostat mode - each time you tap/click the image, the thermostat selected will cycle to the next mode just like pressing the Mode button on the thermostat itself (if it has one). * **''Toggle Thermostat Fan Mode''** (added in v1.1.0) - like the action above, this method will toggle between the two fan modes: Fan On (always on) and Fan Auto (automatic). Again, useful with the "Thermostat Fan Mode+.png" image file. * **''Cycle Through Speed Control (FanLinc) States''** (added in v1.1.0) - this will allow you to easily cycle through the various states for a speed control device. Specifically, for the FanLinc Fan device, this will cycle through the following fan speed states: Off, High, Medium, Low. However, any other speed control devices that are implemented will also work as well. Especially useful for the "FanLinc+.png" image on a control page - just add this as a server action and you have a simple control for adjusting the fan speed - each time you tap/click the image, the FanLinc fan selected will cycle to the next mode just like pulling the chain on the fan. * **''Email Event Log Data''** (added in v1.2.0) - this action will send an email to the specified email addresses that contains the specified number of lines from the log file. This is useful for debugging problems (among other things). ===== Scripting Support ===== As with all plugins, actions defined by this plugin may be executed by [[https://www.indigodomo.com/docs/plugin_scripting_tutorial#scripting_indigo_plugins|Python scripts]]. Here's the information you need to script the actions in this plugin. **Plugin ID**: com.perceptiveautomation.indigoplugin.ActionCollection ==== Action specific properties ==== === Insert Device State into Variable === **Action id**: insertState Properties for scripting: | //''devState''// |the string key (name) of the device state to use | | //''variable''// |the variable ID of target variable | Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("insertState", deviceId=135305663, props={'devState':'playStatus','variable':1229620185}) === Insert Timestamp into Variable === **Action id**: insertTimestamp Properties for scripting: | //''useCustomFormat''// |boolean to specify whether to use a custom date time format (True or False) | | //''format''// |the format string as defined in the [[http://docs.python.org/library/datetime.html#datetime.datetime|Python datetime string formatting]] documentation (only needed if useCustomFormat is True) | | //''variable''// |the variable ID of target variable | Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("insertTimestamp", props={'useCustomFormat':True, 'format':'%Y-%m-%d %H:%M:%S','variable':1229620185}) actionPlugin.executeAction("insertTimestamp", props={'useCustomFormat':False, 'variable':1229620185}) ===Open File=== **Action id**: openFile Properties for scripting: | //''path''// |the path to the file | Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("openFile", props={'path':'/Users/jay/temp/temp.png'}) ===Run Script=== **Action id**: runScript Note: the script must be marked executable and must have the shebang line at the top that directs the shell processor to the right shell to run the script in. Properties for scripting: | //''path''// |the path to the file | | //''storeReturnValue''// |boolean indicating that the action should insert the return value from the script into a variable (True or False) | | //''variable''// |the variable ID of target variable (only needed if storeReturnValue is True) | Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("runScript", props={'path':'/Users/jay/temp/temp.sh', 'storeReturnValue':False}) actionPlugin.executeAction("runScript", props={'path':'/Users/jay/temp/temp.sh', 'storeReturnValue':True, 'variable':1229620185}) ===Write to Log=== Pretty useless - just use the //''indigo.server.log()''// method directly === Cycle Through Thermostat Modes === **Action id**: cycleHvacMode No properties for scripting required. Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("cycleHvacMode", deviceId=135305663) === Toggle Thermostat Fan Mode === **Action id**: toggleHvacFanMode No properties for scripting required. Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("toggleHvacFanMode", deviceId=135305663) === Cycle Through Speed Control (FanLinc) States === **Action id**: cycleSpeedControlState No properties for scripting required. Example: acId = "com.perceptiveautomation.indigoplugin.ActionCollection" actionPlugin = indigo.server.getPlugin(acId) if actionPlugin.isEnabled(): actionPlugin.executeAction("cycleSpeedControlState", deviceId=1117643510)