I gave you bad information yesterday - I wasn't really thinking very clearly and forgot what we'd decided to do. The process for executing your plugin's events is this:
- User creates a trigger of type plugin and selects one of your plugin events - configures it (if necessary) and saves.
- Indigo Server sends the new trigger object to your plugin via the various Trigger Specific Methods in plugin.py. The easiest one (parallel to the various device events) is triggerStartProcessing(self, trigger). This method is also called when the server first starts up your plugin - it will pass all triggers defined to your plugin, one at a time, through this method.
- Your trigger catches the trigger passed in that method and stores it off.
- When the conditions are met that would cause that trigger to fire (plugin implementation specific), you tell the server to execute the trigger: indigo.trigger.execute(triggerRef). Note that the execute method will allow you to optionally bypass any conditions - you should NOT do this unless you're providing some kind of override/bypass. Users will clearly want conditions to be taken into account under normal circumstances (that's the default behavior).
You will also need to implement
triggerStopProcessing(self,trigger) so that you can remove disabled/deleted triggers from your list. So, the Server isn't really involved at all with the trigger firing (except to execute the trigger when you tell it to) - it only notifies your plugin of events it's supposed to be watching for and your plugin does the rest.
I'll get this added to the docs today but that's pretty much what you need to know I think.