Color temperature fade


#1
  1. Give a description of the problem
    Update the white color temperature (2700K-6500K) of a tunable LED bulb based on reading from a color sensor.

I built a piston that updates the white color temperature of a tunable white LED bulb based on the current ambient light levels outside as measured by a NodeMCU ESP8266 device hooked up to an Adafruit color sensor.

1 What is the expected behavior?
New color temperature reading, bulb ‘fades’ to the new reading smoothly (or at least as smooth as possible since there is no device level fading on this)

2 What is happening/not happening?

It works if I use the ‘Set Color Temperature’ task to update the bulb but it’s very abrupt as there is no fade. I tried the task called “Fade Color Temperature…” which is supposed to be emulated (not device level ) but it doesn’t work at all unfortunately, the color temperature never changes.

Since this looks like it might just be a bug, I was trying to just build my own ‘fade’ script with a while loop or a for loop incrementing a variable until it reaches the desired color temperature value. I couldn’t quite figure it out though. Can anyone help me out with this?

  1. Piston:

  2. Attach any logs (From ST IDE and by turning logging level to Full)

    +1ms ╔Received event [NodeMCU1 (colorTemperature1)].colorTemperature = 3201 with a delay of 413ms
    +184ms ║RunTime Analysis CS > 22ms > PS > 46ms > PE > 117ms > CE
    +195ms ║Runtime (37109 bytes) successfully initialized in 46ms (v0.2.0e5.20170812) (193ms)
    +196ms ║╔Execution stage started
    +213ms ║║Comparison (integer) 3201 changes = true (1ms)
    +215ms ║║Condition #12 evaluated true (8ms)
    +217ms ║║Condition group #1 evaluated true (state did not change) (10ms)
    +223ms ║║Evaluating switch with values [[i::32d37b8cba6f053831867ae6061de516::colorTemperature, v:[t:integer, v:3201, d::32d37b8cba6f053831867ae6061de516:, a:colorTemperature, i:null, x:false, vt:string]]]
    +231ms ║║Comparison (integer) 3201 is_inside_of_range (integer) 1 … (integer) 2699 = false (4ms)
    +239ms ║║Comparison (integer) 3201 is_inside_of_range (integer) 2700 … (integer) 6000 = true (4ms)
    +243ms ║║Cancelling statement #8’s schedules…
    +299ms ║║Executed physical command [null].setColorTemperature([100]) (28ms)
    +300ms ║║Executed virtual command [SYLVANIA Smart RT5/6 Tunable White].fadeColorTemperature (40ms)
    +305ms ║╚Execution stage complete. (109ms)
    +316ms ╚Event processed successfully (316ms)


#2

while it is possible to do this, the end result will be very choppy and not the kind of fade you are hoping it will be. :slight_smile:

recommend waiting for @ady624 to address the bug, if it is indeed a bug. since he is out with irma currently, may be a while. till then use set color temperature temporarily


#3

Thanks, I will wait for @ady624 to check it out. Hopefully Irma didn’t do too much damage at his place.


#4

sure thing. a few smallish things last i heard. he will back in no time.


#5

Bump… any help would be greatly appreciated.