OK. I just noticed that even in @therealdb 's code snippets, the single quotes are broken. This isn’t his or the forum’s fault–editors, especially on Apple, do this, and one has to take great care that they are using a pure text editor.
So his code should look like this:
luup.call_action('urn:micasaverde-com:serviceId:Color1', 'SetColorRGB', {newColorRGBTarget = '0=252,1=255,2=108,3=224,4=227'}, 51)
luup.call_action('urn:micasaverde-com:serviceId:Color1', 'SetColorRGB', {newColorRGBTarget = '0=252,1=255,2=108,3=224,4=227'}, 3)
luup.call_action('urn:micasaverde-com:serviceId:HaDevice1', 'ToggleState', {}, 51)
luup.call_action('urn:micasaverde-com:serviceId:HaDevice1', 'ToggleState', {}, 3)
Notice the difference in highlight colors between my version above and how the forum presents his earlier version. That’s an extraordinarily subtle hint that something wasn’t healthy.
But I think there’s another issue at play here. In my work on the Yeelight plugin, which involved a lot of research into these actions, parameters and variables because they are so poorly documented, I found no analogue for the syntax you are trying to use for newColorRGBTarget
. As far as I know, that should be a simple comma-separated triplet of red/green/blue byte values (such as newColorRGBTarget="255,128,64"
). Luup uses the format you show in your action to store the current target value, but it does not receive it that way, as far as I know. If you look at how the Vera UI’s own color wheel widget uses this same action to set colors on a lamp, it always uses the r,g,b
triplet format.
So I would start by simplifying the newColorRGBTarget
value to just r,g,b
(255,255,255 would be all on bright white, 255,255,0 would be yellow, etc.).
Since you’re looking for white, another way to go would be to use the SetColorTemp
action to set the lamp white at a specific color temperature. It takes one parameter newColorTempTarget
with a value Wn
or Dn
where W is for the warm color range (2000-5500K) and D is for the daylight color range (5500-9000) and n is a number 0-255 for the value in that range (e.g. W51 is about 2700K, W255 is 5500, D0 is also 5500, and D36 is about 6000K).
luup.call_action('urn:micasaverde-com:serviceId:Color1', 'SetColorTemp', {newColorTempTarget = 'W51'}, 51)