Scripting and Triggers

Posted on
Fri Dec 07, 2012 8:12 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Scripting and Triggers

All.. hoping someone could help me out.

I do a lot of trigger firing via variables and now I realize that there is a better way in a lot of instances to handle this. Rather than using a variable to do this, I think enabling/disabling the triggers would work a lot more cleanly.

Now for my problem. I don't know how to call to see if a trigger is enabled or disabled.

Just looking to get some script together that toggles between enabling and disabling a trigger based on that trigger being enabled or disabled.

For example, Trigger A is disabled... I run the script, it sees that trigger A is disabled and then it enables it and vice versa for a toggle. I poked around thinking there would be some sort of action to toggle on/off a trigger as you can do with a device but did not find one.

Help is greatly appreciated!

Posted on
Sat Dec 08, 2012 10:57 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Scripting and Triggers

Untested, but I think an embedded python script action like this should get you started:

Code: Select all
elem = indigo.triggers[someTriggerIdHere]
indigo.trigger.enable(elem, not elem.enabled)

Image

Posted on
Sat Dec 08, 2012 2:12 pm
Dewster35 offline
Posts: 1030
Joined: Jul 06, 2010
Location: Petoskey, MI

Re: Scripting and Triggers

Works great Matt, Thanks!

Really need to learn some basic python some free afternoon.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 11 guests