Page 1 of 1

how to use commands sent to virtual switch in lua script (lua shows values from one cycle back)

Posted: Friday 30 April 2021 14:55
by mschaar
Hi,
I a using a virtual switch (rgb) to be able to 'capture' the commands sent from the gui to that switch and then relay them onto my actual device. This device is not fully supported, hence the workaround.
Now when I perform a set color on the virtual switch, i see it is correctly shown in the log (Status: setcolbrightnessvalue: ID: 20, bri: 100, color: '{m: 3, RGB: ff0eff, CWWW: 0000, CT: 0}')
So my green should be 0e = 14, but the device.color or device.getColor() it returns the value it had before changing the color.: 169

How can I use / retrieve the actual latest sent rgb values for setcolbrightnessvalue in the lua script?

Code: Select all

2021-04-30 14:46:16.193  Status: setcolbrightnessvalue: ID: 20, bri: 100, color: '{m: 3, RGB: ff0eff, CWWW: 0000, CT: 0}'
2021-04-30 14:46:16.205  LED strip dummy: Color Switch (LED muurcirkel)
2021-04-30 14:46:16.310  Status: dzVents: Info: Handling events for: "LED muurcirkel", value: "Set Color"
2021-04-30 14:46:16.310  Status: dzVents: Info: sendColor: ------ Start external script: set_ledstrip_color.lua: Device: "LED muurcirkel (LED strip dummy)", Index: 32
2021-04-30 14:46:16.311  Status: dzVents: Debug: sendColor: original color : {"b":255,"cw":0,"g":169,"m":3,"r":255,"t":0,"ww":0}
2021-04-30 14:46:16.311  Status: dzVents: Debug: sendColor: {["g"]=169, ["red"]=255, ["warm white"]=0, ["temperature"]=0, ["r"]=255, ["cold white"]=0, ["m"]=3, ["isWhite"]=false, ["hue"]=300.0, ["mode"]=3, ["value"]=100.0, ["t"]=0, ["brightness"]=100.0, ["b"]=255, ["br"]=100, ["green"]=169, ["ww"]=0, ["blue"]=255, ["cw"]=0, ["saturation"]=33.725490196078}
Hope someone can help.

Maureen

Re: how to use commands sent to virtual switch in lua script (lua shows values from one cycle back)

Posted: Friday 30 April 2021 23:50
by waaren
mschaar wrote: Friday 30 April 2021 14:55 How can I use / retrieve the actual latest sent rgb values for setcolbrightnessvalue in the lua script?
You might be helped by looking at this topic

Re: how to use commands sent to virtual switch in lua script (lua shows values from one cycle back)

Posted: Saturday 01 May 2021 9:15
by mschaar
Thanks. For now I made a workaround by fetching the actual color by httprequest. Not pretty, but it works...