Setting attribute on one device from another

I know there are a few different approaches to this. But this is my first foray into the rules engine so i want to work through my issues , especially since I think I have something that should work, but it's tossing an error.

I have some HUEs LED (2 ID) strips going through a HUE Hub (GLEDOPTO controller technically)
I've got 3 of them set up and grouped into 1 group for controlling color.

When the color changes, I am trying to change the LED color on my Innovelli Dimmers (black) to match the same color.

From the LED Strips I can grab H/S/L.
I then take those and make a colormap string as that's what I can send to the innovelli switch.

This is the closest I've gotten yet to getting it to work.
I'm not sure why I am getting the following error considering what i see in the device.
p.s. - I've tried setting H/S/L in other fashions without much success. tried setting H/S/L at child RBG and parent level with no luck.

log from my rule Run:
dev:1312020-09-01 04:43:15.033 pm errorgroovy.lang.MissingPropertyException: No such property: hue for class: java.lang.String on line 173 (componentSetColor)

app:1732020-09-01 04:43:14.968 pm infoAction: setColor(colormap(hue:53,saturation:100,level:100)) on Bathroom Physical Switch

app:1732020-09-01 04:43:14.905 pm infoAction: Set colormap to 'hue:%HUE%,saturation:%SATURATION%,level:%LEVEL%'

app:1732020-09-01 04:43:14.885 pm infoAction: Set SATURATION to Kitchen LEDs - Color saturation

app:1732020-09-01 04:43:14.864 pm infoAction: Set LEVEL to Kitchen LEDs - Color level

app:1732020-09-01 04:43:14.844 pm infoAction: Set HUE to Kitchen LEDs - Color hue

Variables look correct.

Here is the from/to device info:


Appreciate any help - I want to learn as much as possible so don't want to just grab/copy/paste what others have done yet.

-ed

The error you're getting is ultimately because your colormap variable is a String, whereas Groovy is expecting a Map here (while they look the same in human-friendly text representation, colormap isn't a real map here). Rule Machine does not have Map-type variables, so while a good idea, I'm not sure there's an easy way to make that particular idea work with RM.

What I would do is use Rule Machine's built-in "Set Color"-style actions instead of the custom "setColor" command it appears you used. There, you can use "Custom color" and specify specific hue, saturation, and level values:

image

The outcome should be the same as what you're going for. I haven't tried variables here but assume this would work (with your individual variables and not the map-esque string). I could be wrong about that part, but it should at least get you closer if not. :slight_smile:

1 Like

I had tried that before and was having trouble as well.
However I will say that from that 1st attempt to my last one I've discovered a lot so it is something I should revisit.