Server Properties and Commands (indigo.server.*)

These are properties and commands that aren't associated with any specific object type and are inside the indigo.server.* command namespace.

Property Type Writable Description
address string No the IP address of the currently connected Indigo Server
apiVersion string No API v1.7: the currently connected Indigo Server plugin API version as a string (ex: “1.7”)
connectionGood boolean No true if the connection to the Indigo Server is currently good
licenseStatus string No API v2.5: returns one of the values specified in the indigo.kLicenseStatus enumeration below
portNum integer No the port number of the currently connected Indigo Server
version string No the currently connected Indigo Server version string
License Status Enumeration
indigo.kLicenseStatus
Value Description
ActiveTrial the license is a trial
ActiveSubscription license has an active Indigo Up-to-Date subscription (access to a reflector)
ExpiredSubscription license has an expired Indigo Up-to-Date subscription (no access to a reflector)
Unknown license is in an unknown state

This command will broadcast message to other plugins that have subscribed to the specified name message.

Command Syntax Examples
indigo.server.broadcastToSubscribers(messageName)

This command will return a datetime object that represents the sunrise for the specified day (or the next sunrise if no date is passed in).

Command Syntax Examples
indigo.server.calculateSunrise()
indigo.server.calculateSunrise(myDateObject)
Parameters
Parameter Required Type Description
direct parameter No datetime.date a datetime.date object representing the day to calculate the sunrise time for

This command will return a datetime object that represents the sunset for the specified day (or the next sunset if no date is passed in).

Command Syntax Examples
indigo.server.calculateSunset()
indigo.server.calculateSunset(myDateObject)
Parameters
Parameter Required Type Description
direct parameter No datetime.date a datetime.date object representing the day to calculate the sunrise time for

This command will return a string that contains the latest log entries. Each line is terminated with a line feed character.

Command Syntax Examples
indigo.server.getEventLogList()
indigo.server.getEventLogList(lineCount=5)
indigo.server.getEventLogList(showTimeStamp=False)
indigo.server.getEventLogList(lineCount=5, showTimeStamp=False)
indigo.server.getEventLogList(returnAsList=True, lineCount=5)
Parameters
Parameter Required Type Description
returnAsList No boolean if true a list of dicts is returned containing individual log entry attributes; if false a string containing a textual description of the log lines is returned - the default is false
lineCount No integer the number of lines to return from the event log starting from newest and going backwards in time - the default is 1500
showTimeStamp No boolean indicate whether every line should have it’s timestamp prepended to the log entry - the default is true

Returns the name of the current database name (without the file extension). It takes no parameters.

Command Syntax Examples
name=indigo.server.getDbName()

Returns the POSIX path to the current database file (includes the file name with extension). It takes no parameters.

Command Syntax Examples
name=indigo.server.getDbFilePath()

Returns the server's list of elements that have attributes orproperties that are now deprecated.

Command Syntax Examples
name=indigo.server. getDeprecatedElems(includeWarnings=[True/False]

Returns the POSIX path to the current Indigo installation path. Useful if you want to manipulate files (like graphics and scripts) that are in the Indigo installation path. It takes no parameters.

Command Syntax Examples
name=indigo.server.getInstallFolderPath()

Returns a list of floating point numbers where the first float is the latitude and the second (and last) is the longitude. It takes no parameters.

Command Syntax Examples
latLong=indigo.server.getLatitudeAndLongitude()
lat = latLong[0]
long = latLong[1]

Returns a plugin object given the plugin id.

Command Syntax Examples
myPlugin=indigo.server.getPlugin("com.company.pluginId")
Parameters
Parameter Required Type Description
direct parameter Yes stringthe id of the plugin to retrieve

See scripting plugins for details and examples of using this method.

API v2.4: Returns a list of all enabled plugin object instances.

Command Syntax Examples
enabled_plugin_list=indigo.server.getPluginList()

API v2.5: Returns a string with the URL to the active reflector. Returns None if there is no reflector or if remote access is disabled.

Command Syntax Examples
indigo.server.getReflectorURL()

Examples

>>> indigo.server.getReflectorURL()
"https://myreflector.indigodomo.net/"

Returns a dictionary representing all serial ports on the server machine. The key is the full path specification for the port (for use by PySerial) and the value is just the name of the port (for display purposes).

Command Syntax Examples
indigo.server.getSerialPorts()
indigo.server.getSerialPorts(filter="indigo.ignoreBluetooth")
Parameters
Parameter Required Type Description
filter No stringcurrently there’s only one valid filter: “indigo.ignoreBluetooth” which will remove the “Bluetooth-PDA-Sync” option from the list

Examples

ports = indigo.server.getSerialPorts(filter="indigo.ignoreBluetooth")
# iterate through the full paths
for posixPath in ports:
	print(posixPath)
# iterate through just the port name itself
for uiName in ports.itervalues():
	print(uiName)
# iterate through both
for posixPath, uiName in ports.iteritems():
	print(posixPath)
	print(uiName)

Returns a datetime object representing the server's current time.

Command Syntax Examples
indigo.server.getTime()

No Parameters

Examples

serverTime = indigo.server.getTime()

Returns a URL string that best represents the URL to the active Indigo Web Server. This is the order of which URL will be returned:

  1. Reflector (https://reflector.indigodomo.net) if a reflector is configured.
  2. Bonjour name (http://MacName.local:PORT) if it can be determined.
  3. Localhost (http://localhost:PORT) if all else fails.

Note, there is no trailing slash.

Command Syntax Examples
 indigo.server.getWebServerURL()

No Parameters

This tells IndigoServer to write a log entry with the specified text. The type in the log will be the name of the plugin. The examples below that refer to the logging package assume that you've done this somewhere before: import logging

Command Syntax Examples
indigo.server.log("Info Text to log")
indigo.server.log("Info Text to log", type="myType")
indigo.server.log("Warning Text to log", level=logging.WARNING)
indigo.server.log("Error Text to log1", level=logging.ERROR)
indigo.server.log("Error Text to log2", isError=True)
Parameters
Parameter Required Type Description
direct parameter Yes string this is the text that’s written to the log
type No string a string representing the type - if it’s not included and is run from a Server Plugin, the name of the plugin will automatically be used
level No integer API v2.4: the python logging level which determines both the type shown and the text color used. (ex: using level=logging.WARNING will show orange text)
isError No boolean if True, it will show up in red in the event log - default is False - if no type is included, the name of the plugin will automatically be used with “ Error” appended

This command will remove all delayed actions currently scheduled. It doesn’t take any parameters.

Command Syntax Examples
indigo.server.removeAllDelayedActions()

This command will tell the server to restart our plugin process. The message is printed to the event log, and if isError is true then it's logged as an error. This command can only be called from a plugin and it refers to the plugin itself (not other plugins).

Command Syntax Examples
indigo.server.restartPlugin("Restarting now for some reason", isError=True)

The Indigo server will save changes to plugin preferences automatically, and this command will cause the server to save plugin preferences immediately. It doesn’t take any parameters.

Command Syntax Examples
indigo.server.savePluginPrefs()

This tells IndigoServer to send an email using the SMTP settings configured in the preferences “Email” tab.

Command Syntax Examples
indigo.server.sendEmailTo("my.address@example.com")
indigo.server.sendEmailTo("my.address@example.com", subject="Subject of email", body="Body of email")
Parameters
Parameter Required Type Description
direct parameter Yes string a semicolon separated string of email addresses
subject No string the subject of the email
body No string the body of the email

Speak a text string using the built-in speech synthesizer.

Command Syntax Examples
indigo.server.speak("text to speak", waitUntilDone=True)
Parameters
Parameter Required Type Description
direct parameter Yes string the string to speak
waitUntilDone No boolean should the method call block until speaking is complete or should it just return immediately (queue up the speech)

Tell the server to shutdown our plugin process. Plugin will remain enabled but be in a stopped state. This command can only be called from a plugin and it refers to the plugin itself (not all plugins).

Command Syntax Examples
indigo.server.stopPlugin("Stopping now for some reason", isError=True))

Subscribes to all server event log broadcasts. This command does not take any parameters.

Command Syntax Examples
indigo.server.subscribeToLogBroadcasts()

Wait (block) until server has completed event processing and command sending. This command does not take any parameters.

Command Syntax Examples
indigo.server.waitUntilIdle()
  • /www/perceptive/wiki/data/pages/indigo_2022.2_documentation/server_commands.txt
  • Last modified: 2024/06/27 00:08
  • by 127.0.0.1