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.

Properties (for connected Indigo Server)

Property Type Writable Description
version string No the currently connected Indigo Server version string
apiVersion string No API v1.7+ only: the currently connected Indigo Server plugin API version as a string (ex: “1.7”)
address string No the IP address of the currently connected Indigo Server

Calculate Sunrise

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

Calculate Sunset

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

Event Log List

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

Get Database File Name

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

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

Get Database File Path

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()

Get Install Folder Path

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()

Get Latitude and Longitude

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]

Get Plugin

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.

Get Serial Ports

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)

Get Time

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

Command Syntax Examples
indigo.server.getTime()

No Parameters

Examples

serverTime = indigo.server.getTime()

Log

This tells IndigoServer to write a log entry with the specified text. The type in the log will be the name of the plugin.

Command Syntax Examples
indigo.server.log("Text to log")
indigo.server.log("Text to log", type="myType")
indigo.server.log("Text to log", 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
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

Remove All Delayed Actions

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

Command Syntax Examples
indigo.server.removeAllDelayedActions()

Send Email

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

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)
indigo_7.3_documentation/server_commands.txt · Last modified: 2019/01/26 00:10 (external edit)
 

© Perceptive Automation, LLC. · Privacy