Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
indigo_7_documentation:plugin_scripting_tutorial [2024/06/27 00:08] – external edit 127.0.0.1indigo_7_documentation:plugin_scripting_tutorial [2025/04/14 20:10] (current) – external edit 127.0.0.1
Line 94: Line 94:
 </code> </code>
  
-=== Getting a variable object and using it'value: ===+=== Getting a variable object and using its value: ===
 <code>myVar = indigo.variables[123] <code>myVar = indigo.variables[123]
 if myVar.value == "true": if myVar.value == "true":
Line 196: Line 196:
 ==== Log Examples ==== ==== Log Examples ====
  
-===Log to the Indigo Event Log window all of the attributes/properties of the device "office desk lamp":===+===Log to the Indigo Event Log window all the attributes/properties of the device "office desk lamp":===
 <code> <code>
 lamp = indigo.devices["office desk lamp"] lamp = indigo.devices["office desk lamp"]
Line 280: Line 280:
 <code>indigohost -i</code> <code>indigohost -i</code>
  
-{{pluginhost_prompt.png|}}+{{pluginhost_prompt.png?nolink|Plugin Host Prompt Image}}
  
 As shown, the IPH will automatically connect to the IndigoServer running on the same Mac and will show the server's version information. Additionally, you'll notice that Indigo Server logs the connection of the interactive shell plugin. As shown, the IPH will automatically connect to the IndigoServer running on the same Mac and will show the server's version information. Additionally, you'll notice that Indigo Server logs the connection of the interactive shell plugin.
Line 287: Line 287:
 <code>indigo.server.log("Hello world!")</code> <code>indigo.server.log("Hello world!")</code>
  
-{{pluginhost_helloworld.png|}}+{{pluginhost_helloworld.png?nolink|Hello World Code Example Image}}
  
 ===== Connecting Remotely over SSH ===== ===== Connecting Remotely over SSH =====
Line 357: Line 357:
     raise ImportError     raise ImportError
 from datetime import datetime from datetime import datetime
-  +
 def log(message, label=None): def log(message, label=None):
     # Create a log line with the date/timestamp prepended in MM/DD/YYYY HH:MM:SS format     # Create a log line with the date/timestamp prepended in MM/DD/YYYY HH:MM:SS format
Line 377: Line 377:
 If you try to run this script in a normal python session, you'll see the print statement followed by the ImportError: If you try to run this script in a normal python session, you'll see the print statement followed by the ImportError:
  
-<code>MyMac:testdir jay$ python2.7 testHandlerCall.py +<code>MyMac:testdir jay$ python2.7 testHandlerCall.py
 The indigo module can only be used by scripts started from within Indigo The indigo module can only be used by scripts started from within Indigo
 Traceback (most recent call last): Traceback (most recent call last):
Line 398: Line 398:
 |  pluginDisplayName  | The name displayed to users in the clients  | |  pluginDisplayName  | The name displayed to users in the clients  |
 |  pluginId  | The ID of the plugin (same as was passed to the getPlugin() method above)  | |  pluginId  | The ID of the plugin (same as was passed to the getPlugin() method above)  |
-|  pluginSupportURL  | The URL supplied by the plugin that points to it'user documentation  |+|  pluginSupportURL  | The URL supplied by the plugin that points to its user documentation  |
 |  pluginVersion  | The version number specified by the plugin  | |  pluginVersion  | The version number specified by the plugin  |
  
Line 449: Line 449:
  
 Check the various plugin documentation for the necessary information and more examples. Check the various plugin documentation for the necessary information and more examples.
 +
 +==== Debugging Errors ====
 +A likely place where errors can creep into your plugin scripting involves the payloads that are sent to and from the Indigo Web Server API. For example, JSON payloads may be converted to XML behind the scenes, so bear in mind the XML conventions found in the [[plugin_guide#indigo_plugin_xml_conventions|Plugin Developer's Guide]].
  
  • /www/perceptive/wiki/data/attic/indigo_7_documentation/plugin_scripting_tutorial.1719446928.txt.gz
  • Last modified: 2024/06/27 00:08
  • by 127.0.0.1