The Vera Community forums have moved!

General => Lighting & Load Control => Topic started by: kwieto on October 30, 2018, 06:42:20 am

Title: How to set colortarget variable?
Post by: kwieto on October 30, 2018, 06:42:20 am
I have Zipato RGBW2 bulb (works well with native interface and with RGB Controller), for which I want to set the color via lua code.

When I check device variables, I see the TargetColor variable, containing data as follow
Code: [Select]
0=0,1=255,2=0,3=255,4=255
I figured out that it reflects the sequence of White (0), Warm White (1), Red (2), Green (3), Blue (4), and for values 0-255 range is used.
But how to change that variable via scene?
I've tried
Code: [Select]
luup.call_action( "urn:micasaverde-com:serviceId:Color1", "SetTargetColor", {NewTargetColor = 0=0,1=0,2=0,3=0,4=0}, 122)but it doesn't work via test lua.
I've tried
Code: [Select]
luup.call_action( "urn:micasaverde-com:serviceId:Color1", "SetTargetColor", {NewTargetColor = "0=0,1=0,2=0,3=0,4=0"}, 122)it reports that code was sent successfully, but it doesn't really work.

Any ideas?
Title: Re: How to set colortarget variable?
Post by: bogdanf on October 30, 2018, 03:34:17 pm
Try the following code:

luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 122)
luup.sleep(1000)
luup.call_action("urn:micasaverde-com:serviceId:Color1", "SetColorRGB", {newColorRGBTarget = "0,0,255"}, 122)

The first command should turn on the device, while the seconds should change the color to blue (after 1 second).

I took the device ID 122 from your code (if your RGBW2 device is having another device ID on Vera you will need to replace it with the actual ID).
Title: Re: How to set colortarget variable?
Post by: kwieto on November 03, 2018, 09:31:24 am
It works, thanks!