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

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
mschaar
Posts: 3
Joined: Sunday 25 April 2021 8:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

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

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mschaar
Posts: 3
Joined: Sunday 25 April 2021 8:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by mschaar »

Thanks. For now I made a workaround by fetching the actual color by httprequest. Not pretty, but it works...
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests