Author Topic: How to set colortarget variable?  (Read 1904 times)

Offline kwieto

  • Hero Member
  • *****
  • Posts: 614
  • Karma: +27/-15
How to set colortarget variable?
« 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?

Offline bogdanf

  • Steering Box Fanclub
  • Administrator
  • Full Member
  • *****
  • Posts: 235
  • Karma: +8/-1
  • Did you change the oil ?
Re: How to set colortarget variable?
« Reply #1 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).

Offline kwieto

  • Hero Member
  • *****
  • Posts: 614
  • Karma: +27/-15
Re: How to set colortarget variable?
« Reply #2 on: November 03, 2018, 09:31:24 am »
It works, thanks!