Setting color on Sylvania LED light strip

I have been playing with a color changing smart app to randomly cycle the colors on a few LED light strips that I’ve recently installed. However, the color change is very spotty and typically in any cycle, only one of the lights will actually change color.

I calculate the color as a map of a random hue in the range 0…359. I’ve tried sending the command to the lights several times in a row but no improvement. When I check the logging, I always get a trace log that the light received the command. But only occasionally I’ll get the color cluster updated log message that coincides with an actual color change.

I always get the following log message: trace setColor([hue:190, saturation:100, level:100])
When it works, I also get this: debug color cluster updated successfully

Any ideas why the lights won’t update color every time, even though they clearly get the message? Are there only certain hue values that are valid? Are the messages being sent too quickly (not sure I have any control over this).

Code snippet is below (I spread out the values so the colors are different):

int hue = (new Random()).nextInt(360)
int saturation = 100
int count = 0;
for(light in lights)
{
    def color = [hue: (hue+count)%360, saturation: saturation, level:100]
        light.setColor(color)
       count += 100
}

Thanks!

Hello @Dan999

According to the capabilities documentation, hue, saturation, and level must have values between 0 and 100 percent.

Also, as commands are being executed too fast, they’re not being processed correctly, I would suggest you to apply a delay.

Best regards,
Nayely Z.

1 Like

Thanks - that seems to work better, although the Color capability lists hue as 0 to 360.