Question for someone who can interpret Groovy

How would I set the "Color Palette" using 'Run Custom Action'. I can only 'Set Effect'. I'm sure there must be a way to do it I just don't kcan't figure out. Need someone who understands groovy!

Choose the command and then it will give you the option to specify the parameters.

1 Like

So here's what I get, how do I tell it to modify the Color Palette based on these options?

"Color Palette" is a parameter of the "Set Effect" command (arguably somewhat of a poor choice of name for that command--it matches a standard command name that works totally differently, though not for a capability that this driver implements, so it doesn't really matter here--but I digress). So, as @dman2306 mentions, you'll choose the setEffect command like you're about to do in your first screenshot, which it appears you did in your second screenshot.

There, you'll need to specify four parameters of the appropriate type. Looks like they are all "Number." This would be the fourth one, per your screenshot. Hopefully you know what the possible values for this mean since the driver doesn't help you out with those. :smiley: (You might be able to leave the first three parameters blank; the driver doesn't say that any are required, but this would be the fourth one regardless and you need to have that many. The parameters are ordered, not named--the names are just there for you.)

PS - the device page itself should also show you this command with all the parameters (and their order, type, and other information contained in the driver source code), so there's really no need to look at the source code or understand Groovy to find this information. Might be a bit easier!

Thanks for this detailed answer. How would I go about setting the 4th parameter? I'm pretty sure I can set the parameter as a number, it works for the 'effectname'. Are the parameters separated by commas?

If you're interested, here's the Github page for the driver:

In your screenshot above, you're about to specify the type and value of the first parameter. You will need to do that four times to get to the fourth parameter. (You will likely need to specify valid values for all parameters; the driver doesn't really mark any as required, nut a glance at that implementation in the code looks like it's likely to fail if you don't...)

Ok! That's the part I was looking for. But shoot, I only want to modify the colorpalette parameter without having to modify anything else but, no, rule machine won't let me enter nothing for the first few parameters to just modify the 4th parameter!

Just for completeness of this post, here's a screenshot of the device page:

Line 495 of the driver you linked to doesn't appear like it would let you do that anyway--but line 485 suggests that you could just pass two parameters, the effect (first parameter above--and apparently always) and the color palette, and it will work with that without needing all four. (Any combination 1-4 looks possible, but only the 2- and 4-parameter varieties appear to take the palette.)

I think i see what you're saying:

So I tried just entering just two parameters but it doesn't seem to like a number for the second parameter after all (see botom screenshot).

I'm trying to generate a random number, store it as a variable and then insert is as a parameter. I've been able to do this with the EffectName:

Looks like there is just something going on with the value of the parameter, but that's not an error coming from the device itself (it's the Rule). If you can't edit that parameter, try just deleting and re-creating it. It looks like you're using a variable, I assume in the correct %variableName% format, so if it still freaks out, I'd make sure that the type of this variable matches the type you need for this parameter (Number).

Ok, deleted all the run custom actions and started over. I still get the bad value after entering this:

Hold on, had 2 'L's in the name Palette

Ah ha! No error now!

But... now it doesn't actually change the palette or the effect and effect used to work prior to adding the second parameter for palette...

If I take out the second parameter then setting the effect parameter works again.

I really don't understand why it's working now but it's working so I'm happy! Thanks for your help @bertabcd1234 !

Ok, this is weird. I took out the second parameter (as shown in the screenshot of the above post), however running the actions in the rule actually changes both the effect and the palette to a random effect and palette now and it's working on the lights outside...

For example, here's what it's currently on:

Running the action again changes the effectname and the palettename to a new random effect and palette!


Something looks odd about that---there shouldn't be a comma after the first parameter (the comma denotes separate parameters, so there's some phantom thing going on after your last parameter in both screenshots above...could just be a UI issue, but probabl not; if your driver logs commands that gets sent, you could see which is actually running and with what values, which it sort of does but only after the less-parameterèd variants call the four-parameter one internally).

1 Like

I turned on debug logging and hit 'run actions', does this give any glimpses into what's happening and why it's working?

Assuming you meant to set effect 88 (on segment 0, I guess?) with palette 53, that looks right to me. It looks like it reads the values for the rest of the parameters from the current state for that segment (unless you specify them yourself).