Variable Watcher  (Script)

Contributed by: Jay Martin    Forum username: jay (support)

Overview

This script is a Python library for Indigo that will examine a variable value, and if that value is the name or ID of another variable, it will examine that variable's value, recursively. When it finds a name or ID that's not a variable, it will check to see if it's an action group and if so it will execute that action group.

This allows the user to create a tree of choices that can easily be traversed until it finds what the user wants. It's used in the Advanced Thermostat Adjustment wiki article but can be used in a variety of other ways.

Installation

  1. Download the script using the link above

  2. Unzip the file (if it doesn't automatically do so)

  3. Move the script into this folder:

    • /Library/Python/2.5/site-packages/ (for Indigo 5/6 on Mac OS X 10.9 and earlier)

    • /Library/Python/2.6/site-packages/ (for Indigo 5/6 on Mac OS X 10.10 and later)

    • /Library/Python/2.7/site-packages/ (for Indigo 7 or later)

     

  4. In the Indigo Mac client, select the Plugins->Reload Libraries and Attachments menu item

Usage

In any Indigo Python script, you can call the processVariable() method with the ID (or name) of a variable and traverse the tree until it finds an Action Group, which it will execute. A simple example:

from variable_watcher import processVariable
processVariable(123456)  # ID or name of a variable