Choosing Random Action Groups

Posted on
Sun Oct 07, 2018 8:28 am
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Choosing Random Action Groups

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?

Posted on
Sun Oct 07, 2018 9:47 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Choosing Random Action Groups

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

Posted on
Sun Oct 07, 2018 7:47 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Choosing Random Action Groups

Wow!

That looks easy!

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

:D

Posted on
Sun Nov 24, 2019 2:28 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Choosing Random Action Groups

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

Posted on
Sun Nov 24, 2019 2:57 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Choosing Random Action Groups

Great! Thanks for the followup.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Jan 22, 2020 5:49 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Choosing Random Action Groups

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

Posted on
Wed Jan 22, 2020 8:01 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Choosing Random Action Groups

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

Posted on
Wed Jan 22, 2020 11:04 pm
jltnol offline
Posts: 989
Joined: Oct 15, 2013

Re: Choosing Random Action Groups

Got it

Can NEVER thank you enough!!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests