Fetch, store, restore hue lights colour


#1

Hi,

Could anyone possibly help with my webcore script. I’ve written a quick test script which should fetch the current brightness level and colour of the light and store those to a variable.

This is so I can adjust the light and then revert back to its original state at the end of the script.

My problem is, the colour variable is not working, it’s always storing #000000 (black) rather than fetching the actual colour.

It’s working perfectly fine with the level variable and will set it back to its original level. But then the light turns off due to the colour variable always storing #000000

Thank you!

8/15/2019, 9:30:10 PM +149ms
+0ms ╔Received event [Our Home].time = 1565901011144 with a delay of -996ms
+331ms ║RunTime Analysis CS > 144ms > PS > 173ms > PE > 15ms > CE
+334ms ║Runtime (38574 bytes) successfully initialized in 173ms (v0.3.10e.20190628) (332ms)
+335ms ║╔Execution stage started
+350ms ║║Cancelling statement #16’s schedules…
+369ms ║║Executed physical command [Alex’s Lamp].setLevel([72]) (15ms)
+370ms ║║Executed [Alex’s Lamp].setLevel (17ms)
+385ms ║║Executed physical command [Alex’s Lamp].setColor([[hex: #000000, hue:0, saturation:0, level:0]]) (11ms)
+386ms ║║Executed [Alex’s Lamp].setColor (13ms)
+388ms ║╚Execution stage complete. (54ms)
+389ms ╚Event processed successfully (389ms)
8/15/2019, 9:30:00 PM +958ms
+1ms ╔Received event [Our Home].test = 1565901000958 with a delay of 0ms
+86ms ║RunTime Analysis CS > 21ms > PS > 48ms > PE > 17ms > CE
+89ms ║Runtime (38565 bytes) successfully initialized in 48ms (v0.3.10e.20190628) (87ms)
+91ms ║╔Execution stage started
+103ms ║║Comparison (enum) present is (string) present = true (1ms)
+104ms ║║Condition #2 evaluated true (8ms)
+106ms ║║Condition group #1 evaluated true (state did not change) (10ms)
+108ms ║║Cancelling statement #25’s schedules…
+121ms ║║Executed virtual command [Alex’s Lamp].setVariable (3ms)
+124ms ║║Cancelling statement #20’s schedules…
+134ms ║║Executed virtual command [Alex’s Lamp].setVariable (3ms)
+137ms ║║Cancelling statement #12’s schedules…
+160ms ║║Executed physical command [Alex’s Lamp].setColor([[hex: #7FFF00, hue:25, saturation:100, level:50]]) (13ms)
+161ms ║║Executed [Alex’s Lamp].setColor (21ms)
+178ms ║║Executed physical command [Alex’s Lamp].setLevel([100]) (13ms)
+179ms ║║Executed [Alex’s Lamp].setLevel (15ms)
+183ms ║║Executed virtual command [Alex’s Lamp].wait (1ms)
+185ms ║║Requesting a wake up for Thu, Aug 15 2019 @ 9:30:11 PM BST (in 10.0s)
+204ms ║╚Execution stage complete. (114ms)
+213ms ║Setting up scheduled job for Thu, Aug 15 2019 @ 9:30:11 PM BST (in 9.974s)
+221ms ╚Event processed successfully (221ms)


#2

For Philips Hue bulbs, I usually capture & restore Hue, Saturation and Levels…
(or sometimes, only Hue & Saturation)

Color and colorTemp usually do not work as expected when capturing


Issue capturing lights colour