Question on emulated Fade Hue


#1

1) Give a description of the problem
I’ve been trying out the Fade Hue emulation and it appears to only Fade forward, not backwards. I was wondering if this is by design or if it’s possible to Fade backwards Example: Start at Purple (Hue 294) to Red (Hue 360) over 60 seconds works as expected, but the other way (Hue 360 to Hue 294) doesn’t seem to work.

2) What is the expected behavior?
For the Fade Hue to move in negative increments.

3) What is happening/not happening?
Using a starting point of 360 moving to 294 , the Piston stops executing

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(5/4/2018, 11:45:45 AM +503ms
+1ms ╔Received event [Collinwood].time = 1525459546377 with a delay of -874ms
+138ms ║RunTime Analysis CS > 18ms > PS > 47ms > PE > 73ms > CE
+140ms ║Runtime (37408 bytes) successfully initialized in 47ms (v0.3.104.20180323) (139ms)
+142ms ║╔Execution stage started
+186ms ║║Executed physical command [lightify test].setHue([100]) (39ms)
+189ms ║║Fast executing schedules, waiting for 785ms to sync up
+998ms ║║Executed physical command [lightify test].setHue([100]) (18ms)
+1009ms ║╚Execution stage complete. (868ms)
+1010ms ╚Event processed successfully (1010ms))

REMOVE BELOW AFTER READING


#2

Just for kicks, can you switch the order and test again?
(make the fade down come before the fade up)
I only ask because sometimes pauses affects results.


#3

Thanks for the suggestion. Same result though.

+0ms ╔Received event [Collinwood].test = 1525481467122 with a delay of 0ms
+93ms ║RunTime Analysis CS > 20ms > PS > 61ms > PE > 13ms > CE
+95ms ║Runtime (36685 bytes) successfully initialized in 61ms (v0.3.104.20180323) (94ms)
+96ms ║╔Execution stage started
+101ms ║║Cancelling statement #1’s schedules…
+272ms ║║Executed physical command [lightify test].setHue([100]) (150ms)
+273ms ║║Executed virtual command [lightify test].fadeHue (161ms)
+276ms ║╚Execution stage complete. (180ms)
+278ms ╚Event processed successfully (279ms)
5/4/2018, 5:50:26 PM +618ms
+0ms ╔Received event [Collinwood].test = 1525481426617 with a delay of 0ms
+85ms ║RunTime Analysis CS > 18ms > PS > 49ms > PE > 19ms > CE
+87ms ║Runtime (36677 bytes) successfully initialized in 49ms (v0.3.104.20180323) (86ms)
+88ms ║╔Execution stage started
+94ms ║║Cancelling statement #1’s schedules…
+272ms ║║Executed physical command [lightify test].setHue([100]) (164ms)
+273ms ║║Executed virtual command [lightify test].fadeHue (172ms)
+275ms ║╚Execution stage complete. (187ms)
+276ms ╚Event processed successfully (276ms)


#4

You inspired me to mess around with the “Fade hue” command for the first time. I noticed the color froze at one shade when I imported your piston, but when I made both numbers 255 or less, it did work in all my testing. (I also lowered the duration to 15 seconds during the testing phase to make it easier to see changes)

Let me know if this works for you. (My tests were done with Philips Hue Color bulb)

temp


#5

Inspired? Wow, I’m a muse.

Thanks for taking a look at this. It does work with numbers 255 and less. Unfortunately since the scene I need is from RED (360 or 0) to Purple (294), this doesn’t quote work out for me. I’ve been messing with a For loop to sort of re-create the effect (since the duration is over such a long period) and having some success. The Fade Hue option would of course be easier.

Thank again. Not sure if it’s a bug or per spec, but I’m glad you were able to re-create it.


#6

I think I have figured out how to fade from red to purple using hue.

The first number can be 359… but the second number needs to be under 100. From my 25 tests, it looks like the first number is degrees (°) around the wheel, and the second number is the percentage (%) of 360. So for example, using your purple number, 294 / 3.60 = 81.7… So I rounded to 82 and it fades from red to purple beautifully!

temp

If your bulbs work the same as mine, the formula for the 2nd number would be:
degrees (°) divided by 3.6
294 / 3.6 = 81.7
(although you might have to round the answer to an integer)


Quick recap:

Red (359) to purple (294 / 3.6) is:
RedToPurple

Purple (294) to red (359 / 3.6) is:
PurpleToRed

Purple to purple (no change) is:
temp


How to Fade/Transition Bulb Colors
Webcore not saving and restoring correct HSL values for Hue bulb
Philips Hue Wiki/FAQ?
#7

AH! Perfect, that’s it. Never occurred to me that the second number was a # of degrees and not a position on the wheel, but a percentage. Yep, works perfectly.

Thanks so much.


#8

This was my first foray into fading hues, but I think I will be using this technique in the future for sure.

Maybe one of the @webCoRE_Minions can change the symbol in the second ° into a % since that seems much more accurate.

ie: change:
Fade hue from 359° to 82° in 10 seconds
to:
Fade hue from 359° to 82% in 10 seconds

and maybe the popup dialog as well:

temp

Although I have a hunch that different bulbs will have different parameters.
(for example, some may be 0-255)


#9

I’m using this for my Osram Gardenspot Lights since the Osram API change just sucks. I had a killer Halloween exterior scene that slowly change the colors from purple to red and/or orange. I’ve pretty much finished recoding all of my custom scripts I used with their API with Webcore and I’m pretty happy with it. A lot more flexibility and some different capabilities to make things interesting.

Thanks again for your help.


#10

The downfall of this approach, is you have to go all the way around in the positive direction to get to your color. For example you can not fade from red to purple without going through green. You need the ability for to set a negative percentage. For example, starting Red - 0 deg going through Magenta -60 deg then through Violet -90 deg to the target Blue -120 deg, should be as easy as setting starting hue to 0 degrees and target hue of -33 (according to the 3.6 formula). Unfortunately that doesn’t work for me.


#11

Yea, this can be a pain. I was trying to adjust the color of my text on my Dashboard… I wanted to go from Red (hot) to Blue (cold)… but when using rainbowValue, green was not in the middle. I had to break up the code something like:

Temp 40-65 fade Blue to Green
Temp 65-100 fade Green to Red

It was a bit more code, but the results look MUCH better


#12

I think you can get around this if you start with Red at the high end of the scale.
(remember, 0 degrees is the same as 360)

Using your numbers above:
Red 359 deg going through Magenta 300 deg then through Violet 270 deg to the target Blue 240 deg


I am not sure which bulbs you are using, but for Philips Hue, I can go from Red to Purple without touching green by using this one line of code:
RedToPurple
This is Red (359) to purple (294 / 3.6)

For some reason, the 2nd number is not in the same scale as the first number.
First number is 0-360 (degrees)
Second number is 0-100 (percent)

This is why we did the math on the second number. (294 / 3.6 = 82)


#13

Ah I see, ya that works.

Thanks!


#14

No problem. Glad to help!


#15

Now to figure out if it can be canceled by another task. :smiley:


#16

Good luck stopping a fade. Last I saw it took someone 200 lines of code for that “simple” idea…