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_2025.1_documentation:plugin_scripting_tutorial [2025/10/22 02:31] – [Event Data Examples] davel17indigo_2025.1_documentation:plugin_scripting_tutorial [2025/10/22 15:27] (current) – [Execute Action Group 12345678:] jay
Line 154: Line 154:
 </code> </code>
  
-Custom Python classes that you create can implement the %%__str__(self)%% method. Take this simple example:+Custom Python classes that you create can implement the //''__str__(self)''// method. Take this simple example:
  
 <code> <code>
Line 192: Line 192:
  
 ===Execute Action Group 12345678:=== ===Execute Action Group 12345678:===
 +Execute an action group:
 <code> <code>
 indigo.actionGroup.execute(12345678) indigo.actionGroup.execute(12345678)
 </code> </code>
 +===Execute Action Group 12345678 with extra event data:===
  
 +Execute an action group, but pass through an arbitrary dictionary of data to actions that support using **event_data**:
 +<code>
 +extra_data = {"a": 1, "b": ["c", 2, 3]}
 +indigo.actionGroup.execute(12345678, event_data=extra_data)
 +</code>
  
 ==== Log Examples ==== ==== Log Examples ====
Line 275: Line 282:
  
 <code> <code>
-Oct 21, 2025 at 9:20:50 PM +{ 
-   Trigger                         .Webhook Pass Event Data to Embedded Script +     "data": (dict) 
-   Script                          EventDataDict : (dict) +     "event-indigo-id": 1234567890 (integer) 
-     data : (dict) +     "event-plugin-event-id": simpleWebhook (string) 
-     event-indigo-id : 1234567890 (integer) +     "event-plugin-id": com.indigodomo.webserver (string) 
-     event-plugin-event-id : simpleWebhook (string) +     "event-plugin-name": Web Server (string) 
-     event-plugin-id : com.indigodomo.webserver (string) +     "event-type": PluginEventTrigger (string) 
-     event-plugin-name : Web Server (string) +     "http-method": GET (string) 
-     event-type : PluginEventTrigger (string) +     "request-url": https://localhost:8176/webhook/8143484549824dbba1286a873daa3cea (string) 
-     http-method : GET (string) +     "source": python (string) 
-     request-url : https://localhost:8176/webhook/8143484549824dbba1286a873daa3cea (string) +     "status-code": 200 (integer) 
-     source : python (string) +     "timestamp": 2025-10-21T21:20:50 (string) 
-     status-code : 200 (integer) +     "webhook-id": 8143484549824dbba1286a873daa3cea (string) 
-     timestamp : 2025-10-21T21:20:50 (string) +}
-     webhook-id : 8143484549824dbba1286a873daa3cea (string)+
 </code> </code>
  
-Regardless of where the data came from (trigger, schedule, etc), the variable name will be `event_data`. The data can be accessed like this:+Regardless of where the data came from (trigger, schedule, etc), the variable name will be //''event_data''//. The data can be accessed like this:
  
 <code> <code>
-event_data is prepopulated with the indigo.Dict from the originating event +If you did a indigo.actionGroup.execute(12345) the source would be `python`. 
-if event_data["source"] == "api-http": +# You don't need to import `event data`, it will be made available automatically. 
-    # the triggering event came from the HTTP API, so you may want to look at something +if event_data["source"] == "python": 
-    # here. +    indigo.server.log(f"{event_data['timestamp']}")  or whatever 
-    pass+    ...
 </code> </code>
  
 +All event_data payloads will be formatted as //''<class 'indigo.Dict'>''//.
 ==== Miscellaneous Examples ==== ==== Miscellaneous Examples ====
  
  • /www/perceptive/wiki/data/attic/indigo_2025.1_documentation/plugin_scripting_tutorial.1761100294.txt.gz
  • Last modified: 2025/10/22 02:31
  • by davel17