Page 1 of 1

Choosing Random Action Groups

PostPosted: Sun Oct 07, 2018 8:28 am
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?

Re: Choosing Random Action Groups

PostPosted: Sun Oct 07, 2018 9:47 am
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))])

Re: Choosing Random Action Groups

PostPosted: Sun Oct 07, 2018 7:47 pm
by jltnol
Wow!

That looks easy!

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

:D

Re: Choosing Random Action Groups

PostPosted: Sun Nov 24, 2019 2:28 pm
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

Re: Choosing Random Action Groups

PostPosted: Sun Nov 24, 2019 2:57 pm
by jay (support)
Great! Thanks for the followup.

Re: Choosing Random Action Groups

PostPosted: Wed Jan 22, 2020 5:49 pm
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

Re: Choosing Random Action Groups

PostPosted: Wed Jan 22, 2020 8:01 pm
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

Re: Choosing Random Action Groups

PostPosted: Wed Jan 22, 2020 11:04 pm
by jltnol
Got it

Can NEVER thank you enough!!