How to fire a custom event ?

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
User avatar
Juju
Posts: 108
Joined: Wed Aug 31, 2011 10:16 am
Location: Toulouse - FRANCE

How to fire a custom event ?

Post by Juju »

Hello,

I defined some custom events into Events.xml.
I understand I have to catch and store the triggers defined with my plugin events using triggerStartProcessing (self, trigger). To do this, I planed to store them into a dict. But I don't understand how I can know which event (from Events.xml) is used by the trigger ... I think the link is made with the event id, but how to have it through the trigger passed in parameter with triggerStartProcessing (self, trigger) ?
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: How to fire a custom event ?

Post by berkinet »

Take a look at the trigger object. Just print it out to the log with indigo.server.log
indigo.server.log('Received trigger object:\n%s' % trigger)
User avatar
Juju
Posts: 108
Joined: Wed Aug 31, 2011 10:16 am
Location: Toulouse - FRANCE

Re: How to fire a custom event ?

Post by Juju »

OK, thanks berkinet.
Triggers has property pluginTypeId with the event id.

Thanks.

Julien
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: How to fire a custom event ?

Post by berkinet »

BTW, Similar to devices, etc. you can also look at a trigger in the Indigo Scripting shell (Plugins > Open Scripting Shell). Try:
print indigo.triggers[trigger-ID]

For example
print indigo.triggers[154961128]
User avatar
Juju
Posts: 108
Joined: Wed Aug 31, 2011 10:16 am
Location: Toulouse - FRANCE

Re: How to fire a custom event ?

Post by Juju »

That's a nice info.
Thanks Berkinet.
Locked

Return to “Extending Indigo with Plugins and Python”