Choosing Random Action Groups

This forum is for questions about Action Groups and Actions. If you're asking yourself "can Indigo do X" then this is may be the place to ask.
jltnol
Posts: 1011
Joined: Tue Oct 15, 2013 11:11 pm

Choosing Random Action Groups

Post by jltnol »

So I just installed some RGBW LED lights in the garden, and have a few different Action Groups representing a few different colors. I'd like the lights to come on at Sunset (no problem there) but would like Indigo to randomly choose a different action group each day so the colors are somewhat random.

So this would choose between a set of Action Groups...

I'm guessing there is a probably a way to do this via Python, but is there another easier way thru the GUI with existing plugins?
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Choosing Random Action Groups

Post by jay (support) »

I don't know of any plugin that does it, but the script is super simple:

Code: Select all

import random
# Just add the ID of each action group that's part of the list
group_id_list = [
     047955397,
     1859802910,
     137055768,
     614592366,
     1972742736
]
# Execute a random one from the list
indigo.actionGroup.execute(group_id_list[random.randrange(len(group_id_list))])
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
jltnol
Posts: 1011
Joined: Tue Oct 15, 2013 11:11 pm

Re: Choosing Random Action Groups

Post by jltnol »

Wow!

That looks easy!

Again, I can't thank you guys enough for all your hard work and support.

:D
jltnol
Posts: 1011
Joined: Tue Oct 15, 2013 11:11 pm

Re: Choosing Random Action Groups

Post by jltnol »

Jay

Just a quick note that I'm finally able to utilize this random script. I don't remember why I had asked in the beginning, but am able to use it to randomly start via OSC a DMX show running on a Raspberry Pi.

Works like a charm.

THANKS
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Choosing Random Action Groups

Post by jay (support) »

Great! Thanks for the followup.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
jltnol
Posts: 1011
Joined: Tue Oct 15, 2013 11:11 pm

Re: Choosing Random Action Groups

Post by jltnol »

Jay

Just wondering if there is an easy way to capture what Group the Random script chooses and stick it in a variable.. The log shows the Action Group NAME, (2nd line below) which would be best, but even just capturing the Action Group ID would be nice.

Code: Select all

Schedule                        ***Mardi Gras WarmUp. (1 of 3)
   Action Group                    Pi-1-Warmup-11
User avatar
jay (support)
Site Admin
Posts: 18411
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Choosing Random Action Groups

Post by jay (support) »

Sure:

Code: Select all

import random
# Just add the ID of each action group that's part of the list
group_id_list = [
     047955397,
     1859802910,
     137055768,
     614592366,
     1972742736
]
# Get a random action group
random_group = indigo.actionGroups[group_id_list[random.randrange(len(group_id_list))]]
# Insert the name into a variable
indigo.variable.updateValue(ID_OF_VARIABLE, value=random_group.name)
# Execute a random one from the list
indigo.actionGroup.execute(random_group)
Untested, but it should be close
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
jltnol
Posts: 1011
Joined: Tue Oct 15, 2013 11:11 pm

Re: Choosing Random Action Groups

Post by jltnol »

Got it

Can NEVER thank you enough!!
Post Reply

Return to “Action Groups and Actions”