So, I've done some more testing with this. It seems that the reported values from device.color are sometimes incorrect after updates from the domoticz UI. Rather a long post, but I've included several examples with a real lamp and a pure dummy.
If I setRGB in code, then use a second event to read back device.color, the results match - set 255,0,255 read 255,0,255, etc.
If I set the colour using the UI colour picker, trigger an event on that light device changing and report the values, they are incorrect - typically, b=255 whatever colour I select!
If I use a separate event, triggered manually by a switch, to read back device.color after setting colour through the UI, it is also reported incorrectly.
Code: Select all
[1] Set UI colour picker to green:
2020-12-27 15:29:53.563 (Scene trigger dummy switches) Color Switch (WLED Lounge TV)
2020-12-27 15:29:53.556 Status: setcolbrightnessvalue: ID: a20, bri: 100, color: '{m: 3, RGB: 0fff37, CWWW: 0000, CT: 0}'
2020-12-27 15:29:53.661 Status: dzVents: Info: Handling events for: "WLED Lounge TV", value: "Set Color"
2020-12-27 15:29:53.661 Status: dzVents: Info: ------ Start internal script: TEST3: Device: "WLED Lounge TV (Scene trigger dummy switches)", Index: 2592
2020-12-27 15:29:53.661 Status: dzVents: Info: WLED colour is {"b":255,"cw":0,"g":0,"m":3,"r":0,"t":0,"ww":0}
... wrong!
Query colour again after a 10+ seconds:
2020-12-27 15:31:09.115 Status: dzVents: Info: ------ Start internal script: TEST3: Device: "Test switch 2 (Scene trigger dummy switches)", Index: 1731
2020-12-27 15:31:09.116 Status: dzVents: Info: WLED colour is {"b":255,"cw":0,"g":0,"m":3,"r":0,"t":0,"ww":0}
... still wrong!
[2] Set UI to white-ish:
020-12-27 15:31:55.446 Status: setcolbrightnessvalue: ID: a20, bri: 100, color: '{m: 3, RGB: f8f2ff, CWWW: 0000, CT: 0}'
2020-12-27 15:31:55.549 Status: dzVents: Info: Handling events for: "WLED Lounge TV", value: "Set Color"
2020-12-27 15:31:55.549 Status: dzVents: Info: ------ Start internal script: TEST3: Device: "WLED Lounge TV (Scene trigger dummy switches)", Index: 2592
2020-12-27 15:31:55.549 Status: dzVents: Info: WLED colour is {"b":55,"cw":0,"g":255,"m":3,"r":15,"t":0,"ww":0}
2020-12-27 15:31:55.549 Status: dzVents: Info: ------ Finished TEST3
... wrong, that would be a green-ish shade, not white.
Query again:
2020-12-27 15:32:39.486 Status: dzVents: Info: WLED colour is {"b":55,"cw":0,"g":255,"m":3,"r":15,"t":0,"ww":0}
... Still wrong.
[3] Set picker to strong blue:
2020-12-27 15:41:36.015 Status: setcolbrightnessvalue: ID: a20, bri: 100, color: '{m: 3, RGB: 0307ff, CWWW: 0000, CT: 0}'
2020-12-27 15:41:36.117 Status: dzVents: Info: Handling events for: "WLED Lounge TV", value: "Set Color"
2020-12-27 15:41:36.117 Status: dzVents: Info: ------ Start internal script: TEST3: Device: "WLED Lounge TV (Scene trigger dummy switches)", Index: 2592
2020-12-27 15:41:36.118 Status: dzVents: Info: WLED colour is {"b":255,"cw":0,"g":242,"m":3,"r":248,"t":0,"ww":0}
2020-12-27 15:41:36.118 Status: dzVents: Info: ------ Finished TEST3
... wrong. No way is there 242 green or 248 red in the colour I selected, it was near-pure blue.
Query again:
2020-12-27 15:42:42.138 Status: dzVents: Info: WLED colour is {"b":255,"cw":0,"g":242,"m":3,"r":248,"t":0,"ww":0}
... wrong.
Reporting event code:
Code: Select all
return {
on = {
devices = {
'Test switch 2',
'WLED Lounge TV'
},
},
execute = function(domoticz, triggeredItem)
domoticz.log('WLED colour is ' .. domoticz.devices('WLED Lounge TV').color)
end
}
Some tests with a pure dummy switch (RGBWW), so that the WLED plugin isn't involved:
Code: Select all
[1] Picker to red:
2020-12-27 15:45:29.729 Status: setcolbrightnessvalue: ID: 987, bri: 64, color: '{m: 3, RGB: ff0005, CWWW: 0000, CT: 0}'
2020-12-27 15:45:29.835 Status: dzVents: Info: Handling events for: "Test RGBWW", value: "Set Color"
2020-12-27 15:45:29.835 Status: dzVents: Info: ------ Start internal script: TEST3: Device: "Test RGBWW (Scene trigger dummy switches)", Index: 2439
2020-12-27 15:45:29.836 Status: dzVents: Info: Test RGBWW colour is {"b":0,"cw":126,"g":0,"m":2,"r":0,"t":129,"ww":129}
2020-12-27 15:45:29.836 Status: dzVents: Info: ------ Finished TEST3
... wrong. We can see 255,0,5 set but we get 0,0,0 read back.
[2] Picker to blue-green:
2020-12-27 15:48:03.774 Status: setcolbrightnessvalue: ID: 987, bri: 64, color: '{m: 3, RGB: 07fff9, CWWW: 0000, CT: 0}'
2020-12-27 15:48:03.879 Status: dzVents: Info: Handling events for: "Test RGBWW", value: "Set Color"
2020-12-27 15:48:03.879 Status: dzVents: Info: ------ Start internal script: TEST3: Device: "Test RGBWW (Scene trigger dummy switches)", Index: 2439
2020-12-27 15:48:03.880 Status: dzVents: Info: Test RGBWW colour is {"b":5,"cw":0,"g":0,"m":3,"r":255,"t":0,"ww":0}
2020-12-27 15:48:03.880 Status: dzVents: Info: ------ Finished TEST3
... wrong. There's almost no red set, 7, yet 255 is read back.
Query again, ~20 seconds later:
2020-12-27 15:48:49.805 Status: dzVents: Info: Test RGBWW colour is {"b":5,"cw":0,"g":0,"m":3,"r":255,"t":0,"ww":0}
... still wrong values.
Any ideas? Looks like device.color is giving results that don't match the UI when the colour picker is used, but when setRGB is used, the UI, the lamp and device.color are in agreement.
Domoticz, Z-Stick Gen.5, zzh Zigbee, rxftrx433XL on Ubuntu 22.04, HP 290 G1.
Node Red, MQTT, 80+ Z-wave, ESP8266 & Shelly, handful of Zigbee bulbs. EMS-ESP gateway for Bosch boiler. Controlicz, until it dies :-(