Server Commands (indigo.server.*)

Commands that aren't associated with any specific object type are collected up in the indigo.server.* command namespace.

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 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.

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

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

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

Command Syntax Examples
indigo.server.removeAllDelayedActions()

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)
  • /www/perceptive/wiki/data/pages/indigo_5_documentation/server_commands.txt
  • Last modified: 2024/06/27 00:08
  • by 127.0.0.1