RGBW control over optimization


#1

I’m controlling a virtual RGBW device with WebCoRE. WebCoRE avoids unnecessary commands to devices. If it knows a light is already on, it does not send an on command. RGBW devices have an internal color mode state. The state can be either CT or RGB. From what I have gleaned, the state changes to CT when color temperature is adjusted. The state changes to RGB when hue or saturation is adjusted.

Consider the following scenario:
1/ Set level to 100 - device turns on
2/ Set color temperature to 2700 - device in CT mode
3/ Set hue to 0 - device in RGB mode
4/ Set color temperature to 2700 - device should be in CT mode

In step 4, WebCoRE recognizes that color temperature was previously set to 2700 and does not send the set color temperature command to the RGBW device. The device remains in RGB mode when the desired mode is CT.


#2

would need to see full logs for when you run this.

I see in the code command optimization is not done for setColorTemperature …


#3

I’ve made a test piston and the logs indicate the calls to the device are being made. The device doesn’t always change mode based on a hue or CT parameter change. Perhaps this is a bug in the Hubitat virtual RGBW driver code.

WebCoRE logs

8/27/2023, 9:29:45 PM +65ms
+3ms ╔Received event [Grossland HE].time = 1693193385044 with a delay of 21ms, canQueue: true, calledMyself: false
+8ms ║RunTime initialize > 8 LockT > 0ms > r9T > 1ms > pistonT > 0ms (first state access 3 m:7 3 5)
+11ms ║Runtime (6728 bytes) initialized in 1ms (v0.3.114.20230809_HE)
+14ms ║╔Execution stage started
+39ms ║║Executed device command [Test RBGW].setColorTemperature(2700) (15ms)
+41ms ║╚Execution stage complete. (27ms)
+43ms ╚Event processed successfully (41ms)
8/27/2023, 9:29:43 PM +987ms
+3ms ╔Received event [Grossland HE].time = 1693193383966 with a delay of 21ms, canQueue: true, calledMyself: false
+8ms ║RunTime initialize > 7 LockT > 0ms > r9T > 1ms > pistonT > 0ms (first state access 3 m:6 3 4)
+10ms ║Runtime (6723 bytes) initialized in 1ms (v0.3.114.20230809_HE)
+13ms ║╔Execution stage started
+52ms ║║Executed device command [Test RBGW].setHue(0) (31ms)
+56ms ║║Executed virtual command wait [1000] (1ms)
+58ms ║║Requesting wake up at Sun, Aug 27 2023 @ 9:29:45 PM MDT (in 999ms) for 11 (st:12)
+61ms ║╚Execution stage complete. (47ms)
+93ms ║Setting up scheduled job for Sun, Aug 27 2023 @ 9:29:45 PM MDT (in 993ms)
+94ms ╚Event processed successfully (93ms)
8/27/2023, 9:29:42 PM +915ms
+3ms ╔Received event [Grossland HE].time = 1693193382889 with a delay of 26ms, canQueue: true, calledMyself: false
+8ms ║RunTime initialize > 8 LockT > 1ms > r9T > 1ms > pistonT > 1ms (first state access 3 m:6 4 4)
+10ms ║Runtime (6706 bytes) initialized in 1ms (v0.3.114.20230809_HE)
+15ms ║╔Execution stage started
+47ms ║║Executed device command [Test RBGW].setColorTemperature(2700) (25ms)
+50ms ║║Executed virtual command wait [1000] (0ms)
+52ms ║║Requesting wake up at Sun, Aug 27 2023 @ 9:29:43 PM MDT (in 999ms) for 7 (st:8)
+54ms ║╚Execution stage complete. (40ms)
+98ms ║Setting up scheduled job for Sun, Aug 27 2023 @ 9:29:43 PM MDT (in 994ms)
+100ms ╚Event processed successfully (97ms)
8/27/2023, 9:29:41 PM +868ms
+3ms ╔Received event [Grossland HE].test = 1693193381868 with a delay of 1ms, canQueue: true, calledMyself: false
+7ms ║RunTime initialize > 6 LockT > 0ms > r9T > 1ms > pistonT > 0ms (first state access 2 m:5 3 3)
+9ms ║Runtime (6639 bytes) initialized in 1ms (v0.3.114.20230809_HE)
+10ms ║╔Execution stage started
+17ms ║║Command optimization: Skipped execution of device command [Test RBGW].setLevel(100) because it would make no change to the device. (1ms)
+21ms ║║Executed virtual command wait [1000] (0ms)
+22ms ║║Requesting wake up at Sun, Aug 27 2023 @ 9:29:42 PM MDT (in 999ms) for 3 (st:4)
+24ms ║╚Execution stage complete. (14ms)
+63ms ║Setting up scheduled job for Sun, Aug 27 2023 @ 9:29:42 PM MDT (in 994ms)
+64ms ╚Event processed successfully (62ms)

Hubitat logs

dev:2572023-08-27 09:29:45.095 PMinfoTest RBGW colorName is Incandescent
dev:2572023-08-27 09:29:45.093 PMinfoTest RBGW colorTemperature is 2700°K
(missing Test RBGW colorMode is CT)
dev:2572023-08-27 09:29:44.032 PMinfoTest RBGW colorName is Red
dev:2572023-08-27 09:29:44.015 PMinfoTest RBGW hue is 0%
dev:2572023-08-27 09:29:44.013 PMinfoTest RBGW colorMode is RGB
dev:2572023-08-27 09:29:42.953 PMinfoTest RBGW colorName is Incandescent
dev:2572023-08-27 09:29:42.947 PMinfoTest RBGW colorTemperature is 2700°K