Indigo Object Model Reference

About this Reference

This guide is meant to provide specific reference information about the Indigo Object Model (IOM) as used by scripters writing embedded scripts as well as developers writing Server plugins. Scripters can be Developers and vice versa - we just wanted to define the different potential uses for IOM.

The IOM is divided up based on the major object types: Devices, Triggers, Schedules (not yet implemented), Action Groups (not yet fully implemented), Variables, and Folders. There is also a utility base class (and subclasses), Action (not yet complete), that's used with the major object types that support actions.

For ease of discussion, any Python program that uses the object model will be referred to as a “script” throughout this document. From a style perspective, anything that’s in code text is generally considered to be Python code and represents the exact code needed. You'll also see code blocks like this:

# some code here
# that does something

Some conventions of the Python API: all values are represented in camelCase, where words aren’t separated but each starts with an uppercase letter. The first character of all class names are uppercase (DimmerDevice) and the first character of class properties are lowercase letter (folderId). Constant enumerations start with a lowercase “k” (kEnumerationName), and each enumerated value begins with an uppercase letter (kEnumerationName.EnumeratedValue).

A note about version numbers: As we've revised the API and added features, we've incremented the API version number. Up until Indigo 5 v5.1.1, the API remained 1.0 and the documents were just updated with new features (which could lead to incompatible features if using an older release of Indigo). As of Indigo 5 v 5.1.2, we've begun incrementing the API minor version number (1.X) whenever we add new features. The major number (X.0) will only be incremented when we do something that will break backwards compatibility or when there are major changes. See the API version chart to see which API versions were released in which Indigo version.

If any of the API tables in the documentation don't have a version number you can assume that the feature is available in API version 1.0 and later.

NOTE: Indigo uses Python v2.7. Different versions of macOS might have newer versions of python installed, so make sure that you're using Python 2.7 for your development or you could get a nasty surprise when you turn your code into a plugin (if you're developing code outside of the plugin architecture).

If you execute “python2.7” at the command line instead of “python” you'll get the installed 2.7 version.

Definitions of terms used throughout this manual are listed below:

Action Group An action (or collection of actions) that can be used by multiple Schedules, Triggers, and Action Groups. This allows you to change the collection in a single place rather than editing multiple Schedules, Triggers, etc., that require identical actions to be executed.
Developer A person who writes Server Plugins.
Direct Parameter The first parameter to a command, although it may be optional. Any further parameters to a command must have a name specified.
Event Some external plugin defined event (outside Indigo) that is used to instruct the IndigoServer to execute a Trigger.
Protocol Any built-in home automation technology that Indigo supports (INSTEON, X10, etc.). This does not include plugins that might implement their own protocol.
Schedule An action (or collection of actions) that will be executed based on some temporal settings - dates and times. When the appropriate time and date is met, IndigoServer evaluates any conditions specified in the schedule in order to decide if the actions associated with the event should execute. In previous versions of Indigo, these were referred to as Time/Date Actions.
Script Any section of code using the IOM regardless of language being used.
Scripter A person who writes embedded scripts.
Trigger An action (or collection of actions) that will executed based on some input event - a device state change, an event from a plugin, an email received, etc. When the event occurs, IndigoServer evaluates any conditions specified in the trigger in order to decide if the actions associated with the event should execute.

Indigo Object Model (IOM) Overview


The Indigo Object Model (IOM) is a collection of objects and methods that allow scripts to interact with objects in Indigo.

From an architectural perspective, the most fundamental design point that needs to be understood is that the host process that executes python scripts is a separate process from the IndigoServer process - which is where the objects actually reside. We do this so that a single script or plugin can't bring down the entire IndigoServer.

So, when you get an object, it’s actually a copy of the object, not the real object. We could have implemented a distributed object model with object locking, etc., but that would have added significant complexity. Instead, we decided to create some simple rules that you need to follow in order to use the IOM correctly:

For Scripters and Developers:

  • To create, duplicate, delete, and send commands to an object (i.e. turnOn, nextZone, displayInRemoteUI, moveToFolder, etc.), use the appropriate command namespace and a reference to the object rather than altering the object directly (you can see the list of objects and their command name spaces in the table below)
  • To modify an object's definition (name, description, etc.), get a copy of it, make the necessary changes directly to the object, then call myObject.replaceOnServer()
  • To update a copy of an object that you previously obtained, call the object's myObject.refreshFromServer() method.

For Developers:

  • To update a plugin's props on an object on the server, call myDevice.replacePluginPropsOnServer(newPropsDict) rather than try to update them on the local device
  • To change a device's state on the server, use myDevice.updateStateOnServer(key=“keyName”, value=“Value”)

A couple of notes to help you understand these rules. First, the IOM allows Server Plugins to attach arbitrary attributes to any object. We call these plugin properties, or just props. They are read-write for a Server Plugin, but are readonly for all Python scripts.

Second, as discussed in the Plugin Developer's Guide, a Server Plugin may define multiple device types. All devices have some state (or states): on/off, paused/playing/stopped, heating/cooling/off, etc. These states are used in Triggers and shown on Control Pages. Your Server Plugin will need to be able to tell the server whenever a state changes for one of it's devices. That's what the last rule above is referring to. See the Devices description for more information and examples.

We’ve divided the commands into name spaces such that if the command applies to a specific class type, it’s put into a namespace that matches the type. Here is a chart that maps the classes to their associated namespace:

ClassCommand namespaceNotes
Device (indigo.Device)indigo.device.*for commands and properties that apply to all device subclasses
DimmerDevice (indigo.DimmerDevice)indigo.dimmer.*manipulate a dimmer
InputOutputDevice (indigo.MultiIODevice)indigo.iodevice.*manipulate an I/O device
SensorDevice (indigo.SensorDevice)indigo.sensor.*manipulate a sensor (motion, etc)
RelayDevice (indigo.RelayDevice)indigo.relay.*manipulate a relay, lock, or other 2 state device
SpeedControlDevice (indigo.SpeedControlDevice)indigo.speedcontrol.*manipulate a speed control/motor device
SprinklerDevice (indigo.SprinklerDevice)indigo.sprinkler.*manipulate a sprinkler device
ThermostatDevice (indigo.ThermostatDevice)indigo.thermostat.*manipulate a thermostat
Schedule (indigo.Schedule)indigo.schedule.*manipulate a scheduled event FIXME not yet implemented
Trigger (indigo.Trigger)indigo.trigger.*commands and properties that apply to all trigger subclasses
DeviceStateChangeTrigger (indigo.DeviceStateChangeTrigger)indigo.devStateChange.*manipulate a device state change trigger
EmailReceivedTrigger (indigo.EmailReceivedTrigger)indigo.emailRcvd.*manipulate an email received trigger
InsteonCommandReceivedTrigger (indigo.InsteonCommandReceivedTrigger)indigo.insteonCmdRcvd.*manipulate an INSTEON command received trigger
InterfaceFailureTrigger (indigo.InterfaceFailureTrigger)indigo.interfaceFail.*manipulate an interface failure trigger
InterfaceInitializedTrigger (indigo.InterfaceInitializedTrigger)indigo.interfaceInit.*manipulate an interface initialized trigger
PluginEventTrigger (indigo.PluginEventTrigger)indigo.pluginEvent.*manipulate an trigger defined by a plugin event
PowerFailureTrigger (indigo.PowerFailureTrigger)indigo.powerFail.*manipulate a power failure trigger
ServerStartupTrigger (indigo.ServerStartupTrigger)indigo.serverStartup.*manipulate a server startup trigger
X10CommandReceivedTrigger (indigo.X10CommandReceivedTrigger) indigo.x10CmdRcvd.*manipulate an X10 command received trigger
VariableValueChangeTrigger (indigo.VariableValueChangeTrigger)indigo.varValueChange.*manipulate a variable changed trigger
Action Groups
ActionGroup (indigo.ActionGroup)indigo.actionGroup.*commands for action groups
Variable (indigo.Variable)indigo.variable.*manipulate a variable
Protocol Specific Commands
INSTEON specific commandsindigo.insteon.*commands specific to the INSTEON protocol
X10 specific commandsindigo.x10.*commands specific to the X10 protocol
General Commands
Commonly used commands and server propertiesindigo.server.*for commands and properties that are more general in nature

The next question you probably have is “How do I create a new object in the IndigoServer?”. The simple answer is that most class namespaces have a create() method. They work a bit differently based on the class type (for instance, indigo.device.create() is used as a factory method to create all types of devices), but it's always named the same. There are also duplicate() and delete() methods for each. See the individual class pages for details.

This will keep the IOM simple and understandable and it avoids significant complexity. In this section we’ll describe the classes exposed to your script so that you can use them for whatever your script needs: checking the value of a variable, the state of a device, the definition of an event or action, etc.

There are a few classes that are special. One is Action and it’s subclasses (collectively referred to as “actions”). Why are these classes different? Because outside of the trigger, schedule, action group, or control page that they’re associated with they aren’t individually addressable in the IndigoServer: for instance, there is no way to identify an action without first identifying the trigger that it’s associated with.

So, how do you interact with actions? Directly, as you would any other object. You can create one (which creates it locally), edit it, etc. Once you have the object set up correctly, you can add it to the appropriate local copy of an object then call the object's replaceOnServer() method. If you have a local copy of an object and you want to ensure that it's in sync with what's on the server then call the object's refreshFromServer() method. Don’t worry if this seems abstract: the examples section for each class page has examples of how to manipulate actions.

Another very important concept that we’re introducing along with the IOM is the concept of an identifier, or id. Every top-level object in Indigo (action group, device, folder, schedule, trigger, variable) now has a globally unique integer ID associated with it.

All commands in the IOM accept the id of an object or the object reference itself (along with the name). You should never store the object’s name. The id is visible in the various lists throughout the UI. You can also select any object in the GUI and right click it to get it’s contextual menu where you'll find a Copy ID (123) item that shows the ID and allows you to copy it to the clipboard. Server plugins that define config UIs that use the built-in lists will get the id(s) of the object(s) selected in the lists rather than the name.

Now, if you're being very observant, you'll notice something missing: Control Pages. It is our intention to support Control Pages in the IOM, but unfortunately it just didn't make it into v1. Look for it in an upcoming IOM revision.

IOM Class Hierarchy

IOM Data Types and Object manipulation

Indigo specific data types

Indigo exposes a couple of special classes in Python: indigo.Dict() and indigo.List(). These are very similar to their Python counterparts (dict and list). The big difference is that when you're dealing with dictionaries and lists that come from the IndigoServer and that go to the IndigoServer, you'll want to use these rather than the built-in Python types because they are handled natively by Indigo and can automatically be saved to the database and preference files.

The behavior of indigo.Dict and indigo.List is similar but not identical to the native python containers. Specifically, the Indigo containers:

  • must contain values that are of types: bool, float, int, string, list or dict. Any list/dict containers must recursively contain only compatible values.
  • do not support value access via slicing (we might add this eventually).
  • always retrieve values (ex: myprops[“key”] or mylist[2]) as a copy and not reference of the object.
  • keys can only contain letters, numbers, and other ASCII characters.
  • keys cannot contain spaces.
  • keys cannot start with a number or punctuation character.
  • keys cannot start with the letters XML, xml, or Xml.

The behavior that items are always retrieved as values (not references) can lead to some unexpected results when compared to python dicts and lists, especially when multiple levels of container nesting is being used. What this means is that you can set items and append to items, but the items returned from the get / iterators are always new copies of the values and not references. For example, consider:

c = indigo.List()

a = indigo.Dict()
a['a'] = "the letter a"
a['b'] = False
a['c'] = c			# a COPY of list C above is inserted (not a reference)

# Because a['c'] has a COPY of list C this will NOT append to instance a:
print(str(a))			# no change from previous output!

# And because a['c'] returns a COPY of its value this will also NOT append to instance a:
print(str(a))			# no change from previous output!

But all is not lost. You can just re-assign the nested object to the root container:

# Instead you must re-assign a copy to the container. Since we already
# appended c with 6 above, we just need to reassign it now:
a['c'] = c
print(str(a))			# now has a COPY of the updated object, c

If you just need to override an existing value in a container (and not append to it), then a more efficient solution is to use our helper method setitem_in_item. It avoids creating temporary copies of values.

a.setitem_in_item('c', 4, "the number six")

Likewise, it is most efficient to use getitem_in_item when accessing nested items since it avoids temporary copies of containers. For example, this creates a temporary copy of the c object before accessing index 4:

a['c'][4]			# works, but is slow because a temporary copy of a['c'] is created

Where this returns the same result but is more efficient:

a.getitem_in_item('c', 4)	# same result, but fast

Converting to native Python collections

You can convert an indigo.Dict to a python dict and an indigo.List to a python list, by calling the appropriate methods on those instances. Note, this will recursively convert nested objects (which attempting a manual cast will not):

python_dict = my_indigo_dict.to_dict()  # recursively convert an indigo.Dict instance to a python dict instance
python_list = my_indigo_list.to_list()  # recursively convert an indigo.List instance to a python list instance

Beginning with Indigo 2021.2, you can use a native Python conversion:

python_dict = dict(my_indigo_dict)
python_list = list(my_indigo_list)

Built-in objects

The IOM supplies the following built-in objects:

Object Description
indigo.devicesAll devices in the database
indigo.triggersA ll triggers in the database
indigo.schedulesAll schedules in the database
indigo.actionGroupsAll action groups in the database
indigo.variablesAll variables in the database

These objects are very similar to an indigo.Dict - but have some special abilities and constraints:

  1. They are read-only - you can't modify them directly but rather use other methods to change them
  2. They contain a “folders” attribute that has all the folders defined for that object type
  3. They define a couple of convenience methods that are specialized for their use

Let's elaborate on each of these a bit. First, they're read-only in that you can't do something like this:

indigo.devices[123] = someOtherDevice

To change a device, in most cases you get a copy of the device, make the necessary changes, then replaceOnServer(). You'll find specific information about each of those in the appropriate section linked below in the Classes and Commands section.

Each of the objects above corresponds to one of the high-level objects in Indigo. In the UI, you know that you can create folders for each of those object types. To access the folders available for each type, you can reference the “folders” attribute: i.e. indigo.devices.folders. This is also a read-only indigo.Dict of folder objects. As with the other top-level classes, you manipulate folders within specific namespaces, described on the folder class page.

Finally, these objects define some convenience methods as well as supporting most of the standard Python dict object methods.

The first added method, getName(elemId), is a shortcut to get the string name of the item. Normally you would need to get a copy of the object (which would pull the entire object from the IndigoServer) then get the name, but this method is more efficient since it only gets the name from the IndigoServer rather than the whole object. So, an easy way to get a variable folder's name (maybe for logging) would be to do this: indigo.variables.folders.getName(1234). Make sure you use the correct object (indigo.variables) so that we'll know where to search for the folder.

Subscribing to Object Change Events

The other additional method is subscribeToChanges(). This method doesn't return anything - rather, it tells the IndigoServer that your plugin wants notification of all changes to the specific object type. Use this method sparingly as it causes a significant amount of traffic between IndigoServer and your plugin. What kind of plugins would use this? One good example is a logging plugin - one that's logging activity within Indigo (like our SQL Logger). Another example is a plugin that's doing some kind of scene management - you would probably want to issue a indigo.devices.subscribeToChanges() at plugin start so that you'll always be notified when any device changes - you can then determine if your scene “state” has changed and act accordingly. Note that subscribeToChanges() only reports actual changes to devices - so for instance when a light turns ON you'll get a notification. If the light is commanded to turn ON again, you won't get the notification because the device state didn't change.

Object Events
Objects that support subscribeTochanges()

For example,

def deviceUpdated(self, origDev, newDev):
    # call the base's implementation first just to make sure all the right things happen elsewhere
    indigo.PluginBase.deviceUpdated(self, origDev, newDev)
    # do your stuff here - make the network connection if necessary, write the data, etc
Lower-level Events

Use the lower-level subscribeToIncoming() and subscribeToOutgoing() methods in the indigo.insteon and indigo.x10 command spaces to see commands regardless of their effect on device state. These commands are exclusive to Insteon and x10 device classes.

Low Level Commands (Insteon and x10 Only)

For example,

    def x10CommandReceived(self, cmd):
        self.logger.debug(f"x10CommandReceived: \n{str(cmd)}")

        if cmd.cmdType == "sec":    # or "x10" for power line commands
            if cmd.secCodeId == 6:
                if cmd.secFunc == "sensor alert (max delay)":
          "SENSOR OPEN")
                elif cmd.secFunc == "sensor normal (max delay)":
          "SENSOR CLOSED")

    def x10CommandSent(self, cmd):
        self.logger.debug(f"x10CommandSent: \n{str(cmd)}")

Iterating Object Lists

For each of the built-in objects, we've also provided some handy iterators that in some cases will allow you to filter. For instance, if you would like to iterate over the list of all devices in Indigo, here's what you would do in Python:

for dev in indigo.devices:
    # do stuff with dev here

A note on iteration: when the above loop begins, the list of devices is fixed. So if mid-loop an element is added then it will NOT be iterated (unless the entire loop runs again later). Likewise, if an element is deleted midway through, then the iterator gracefully handles it and just ignores that deleted item (it skips to the next item automatically). So if items are added/removed during an iteration it never throws an exception – it handles it gracefully but you are not guaranteed to get the new ones.

You can also iterate with just the ID of the object:

for devId in indigo.devices.iterkey():
    # all device id's (rather than the whole device object)

For some of the built-in objects, you can filter the results:

for dev in indigo.devices.iter("indigo.dimmer"):
    # all devices will be dimmer devices

You can further restrict some filters - for instance, you can specify the device type and the protocol:

for dev in indigo.devices.iter("indigo.dimmer, indigo.insteon"):
    # all devices will be INSTEON dimmer devices

Or you can iterate just devices defined by custom plugin types:

for dev in indigo.devices.iter("self"):
    # each dev will be one that matches one of our custom plugin devices

Here's a list of all device filters:

Filter Description
indigo.zwaveinclude Z-Wave devices
indigo.insteoninclude INSTEON devices
indigo.x10include X10 devices
com.mycompany.myplugininclude all devices defined by a plugin
indigo.responderinclude devices whose state can be changed
indigo.controllerinclude devices that can send commands
indigo.iodeviceinput/output devices
indigo.dimmerdimmer devices
indigo.relayrelay, lock, or other 2 state devices
indigo.sensorsensor devices (motion, temperature, etc.)
indigo.speedcontrolmulti-speed controlled device (fans, motors, etc.)
selfinclude devices defined by the calling plugin
self.myDeviceTypeinclude myDeviceType's devices defined by the calling plugin xyzDeviceType's defined by another plugin
props.SupportsOnStatereturn only devices that support an ON state property

Triggers also have filters:

Filter Description
indigo.insteonCmdRcvdinsteon command received triggers
indigo.x10CmdRcvdx10 command received triggers
indigo.devStateChangedevice state changed triggers
indigo.varValueChangevariable changed triggers
indigo.serverStartupstartup triggers
indigo.powerFailpower failure triggers
indigo.interfaceFailinterface failure triggers - can be used with or without a specified protocol
indigo.interfaceInitinterface connection triggers - can be used with or without a specified protocol
indigo.emailRcvdemail received triggers
indigo.pluginEventplugin defined triggers
selfinclude triggers defined by the calling plugin
self.myTriggerTypeinclude myTriggerType's triggers defined by the calling plugin all xyzTriggerType's defined by another plugin

So, to iterate over a list of device state change triggers, you would:

for trigger in indigo.triggers.iter("indigo.devStateChange"):
    # each trigger will be a device state change trigger

Or to iterate over all triggers defined by our plugin types:

for trigger in indigo.triggers.iter("self"):
    # each trigger will be one that matches one of our custom plugin triggers

Unlike devices, however, you may only use a single trigger filter - anything else will result in an empty list.

There is a special filter for variables as well. To iterate over the variable list, you would probably guess this:

for var in indigo.variables:
    # all variables

And you'd be correct. You can also just iterate through the writable variables:

for varName in indigo.variables.iter("indigo.readWrite"):
    # you'll only get readwrite variables

Common Python Exceptions

All IOM Commands can throw exceptions if there is a missing or incorrect parameter, or if there is a runtime problem that prevents the command or request from completing successfully. Common exceptions that may be raised include:

Possible Exceptions
ArgumentError a required parameter is missing, or is not the correct type
IndexError an index parameter value is out-of-range
KeyError a key parameter (to a dictionary) was not found in the dictionary
PluginNotFoundError a plugin that you're trying to talk to (on a create() perhaps) isn't avaliable (disabled or gone)
TypeError a parameter had the incorrect runtime type
ValueError a parameter has a value that is illegal or not allowed

Other exceptions, such as IOError, MemoryError, OverflowError, etc., are also possible although less likely to occur.

Classes and Commands

Indigo provides many classes and commands to work on those classes. You can use standard Python introspection methods to find out information about those classes (these examples are done using the Scripting Shell):

# first, let's get an indigo.DimmerDevice like a LampLinc
>>> dev = indigo.devices[238621905]
>>> dev.__class__
<class 'indigo.DimmerDevice'>
>>> hasattr(dev,'onState')
>>> dir(dev)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'address', 'brightness', 'buttonGroupCount', 'description', 'deviceTypeId', 'enabled', 'folderId', 'globalProps', 'id', 'lastChanged', 'model', 'name', 'onState', 'pluginId', 'pluginProps', 'protocol', 'refreshFromServer', 'remoteDisplay', 'replaceOnServer', 'replacePluginPropsOnServer', 'states', 'supportsAllLightsOnOff', 'supportsAllOff', 'supportsStatusRequest', 'updateStateOnServer', 'version']

# Next, an indigo.ThermostatDevice
>>> thermo = indigo.devices[171495708]
>>> thermo.__class__
<class 'indigo.ThermostatDevice'>
>>> dir(thermo)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'address', 'buttonGroupCount', 'coolIsOn', 'coolSetpoint', 'description', 'deviceTypeId', 'enabled', 'fanIsOn', 'fanMode', 'folderId', 'globalProps', 'heatIsOn', 'heatSetpoint', 'humidities', 'humiditySensorCount', 'hvacMode', 'id', 'lastChanged', 'model', 'name', 'pluginId', 'pluginProps', 'protocol', 'refreshFromServer', 'remoteDisplay', 'replaceOnServer', 'replacePluginPropsOnServer', 'states', 'supportsAllLightsOnOff', 'supportsAllOff', 'supportsStatusRequest', 'temperatureSensorCount', 'temperatures', 'updateStateOnServer', 'version']

# Here's a plugin defined device
>>> tunes = indigo.devices["Whole House iTunes"]
# notice that it only shows the Device base class
>>> tunes.__class__
<class 'indigo.Device'>
>>> dir(tunes)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'address', 'buttonGroupCount', 'description', 'deviceTypeId', 'enabled', 'folderId', 'globalProps', 'id', 'lastChanged', 'model', 'name', 'pluginId', 'pluginProps', 'protocol', 'refreshFromServer', 'remoteDisplay', 'replaceOnServer', 'replacePluginPropsOnServer', 'states', 'supportsAllLightsOnOff', 'supportsAllOff', 'supportsStatusRequest', 'updateStateOnServer', 'version']
# You can use the deviceTypeId attribute to get the plugin's defined type
>>> tunes.deviceTypeId

So, from a discovery perspective, the dir(obj) method will list all properties and methods for an object. The hasattr(obj, attr) will test an object to see if it has a specific attribute. The obj.__class__ attribute will show you what class the object is. As you explore IOM objects, these methods will help you figure out how to use IOM objects effectively.

Object Dictionaries

An important note about Indigo objects. When you print an object instance to the Events log, you will get all the attributes and properties for that object:

>>> dev = indigo.devices[123]
>>> indigo.server.log(f"{dev}")
address : 
batteryLevel : None
buttonGroupCount : 0
configured : True
description : 

>>> indigo.server.log(f"{type(dev)}")

These data are stored as Indigo class instances. In order to send a complete description of the Indigo instance to another process or system (serializing it into JSON, for example), you can convert the Indigo instance to a traditional Python dictionary:

>>> dev = indigo.devices[123]
>>> dev_dict = dict(dev)
>>> indigo.server.log(f"{dev_dict}")
{'class': 'indigo.Device', 'address': '', 'batteryLevel': None, 'buttonGroupCount': 0, 'configured': True, 'description': '', ...}

>>> indigo.server.log(f"{type(dev_dict)}")
<class 'dict'>

Converted objects include all elements of the class instance. All the object types listed below support conversion to Python dictionaries.

Here are the major groupings of classes defined in the IOM (the command namespace for each is described with the classes):

Here are the command namespaces that are independent (to some extent) from the classes they effect:

Utility Classes and Functions

We have included several things in the indigo.utils module that aren't directly related to Indigo objects but are helpful in writing scripts and building plugins.


Name Base Description
FileNotFoundErrorException This is a useful exception if you handle files in any way. There is no built-in processing to catch such exceptions, it's just a useful exception to use.
IndigoJSONEncoderJSONEncoder Use this encoder class if you are encoding a python date, time, or datetime class into a JSON string. Very useful if you attempt to encode a device dictionary into JSON (json.dumps(dict(mydevice), cls=indigo.utils.IndigoJSONEncoder))


Return Static File

This function will accept a file path and an optional content_type and return the correctly structured dictionary that the Indigo Web Server will interpret as a directive to stream back the specified file.

Command Syntax Examples
indigo.utils.return_static_file("/some/path/to/file.json", status=400, path_is_relative=False, content_type="application/json")
Parameter Required Type Description
file_path Yes string a string that represents the path to a file
status No int the HTTP status code to return, defaults to 200
path_is_relative No boolean is the path a full path or relative to the plugin, defaults to True
content_type No string a string to return as the mime type of the content, returns the appropriate type based on the file extension if none is specified

This method returns an indigo.Dict that can be passed directly back to the Indigo Web Server from an HTTP processing call to your plugin. The dict looks something like this:

    "status": 404,
    "headers": {
        "Content-Type": "text/html"
    "file_path": "/Library/Application Support/Perceptive Automation/Indigo 2023.1/Plugins/Example HTTP Responder.indigoPlugin/Contents/Resources/static/html/static_404.html"

IWS will use this to create the HTTP reply to stream the file back to the caller. Note that this function will raise an indigo.utils.FileNotFoundError if the file doesn't exist or a TypeError if file_path isn't a list of path parts or a string.

Validate Email Address

This function will accept an email address string and validate that it is constructed correctly. Note: it does not attempt to determine if the email address exists on the destination system, only that it is constructed correctly.

Command Syntax Examples
indigo.utils.validate_email_address("invalid address will return false")
Parameter Required Type Description
address Yes string a string that represents an email address

Returns True for an email that is constructed correctly, False otherwise.

indigo_2023.1_documentation/object_model_reference.txt · Last modified: 2023/09/05 19:47 (external edit)

© Perceptive Automation, LLC. · Privacy