While the following does work, I'm curious is there is a simpler way to do this, since most of the 2 commands are identical. I've tried a few things, re-arranging pieces, parts, deleting things that seemed redundant, including listing the execute actions part in (parentheses) back to back, then with a space, and then with a comma, but didn't get anywhere..
Is there a way to make multiple commands like this simpler?
- Code: Select all
airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.airfoilpro")
if airfoilPlugin.isEnabled():
try:
result = airfoilPlugin.executeAction("connect", deviceId= 1346544642, waitUntilDone=True) # ID of Speaker device
except Exception, e:
print "Exception occurred: %s" % unicode(e)
airfoilPlugin = indigo.server.getPlugin("com.perceptiveautomation.indigoplugin.airfoilpro")
if airfoilPlugin.isEnabled():
try:
result = airfoilPlugin.executeAction('setVolume', deviceId=1346544642, props={'volume': 52}, waitUntilDone=True) # ID of Speaker device
except Exception, e:
print "Exception occurred: %s" % unicode(e)