rainbowValue for kelvin units for tunable white bulbs?


#1

1) Give a description of the problem
Looking to create a simple gradient between 1500 and 6500 kelvin for tunable white bulbs

2) What is the expected behavior?
Control of color temperature based on time of day (and/or other variables)

3) What is happening/not happening?
Literally nothing is happening, as I haven’t created anything.

I’m doing the rainbowValue to display a gradient for the weather temperature outside. It woks perfectly. In the same room, I have two LIFX “Day & Dusk” bulbs, which are just tunable white bulbs. Wondering if it’s possible to use the same ‘rainbowValue’ to shift between kelvin units.


#2

If you can find the color values of the whites you have then maybe use the rainbowValue() function with $hour24 as the input and then select the hours you want it to fade from. Never messed with this function so I might be blowing smoke right now.


#3

try something like this:

rangeValue($hour24, 1900, 0, 1900, 6, 2400, 9, 2700, 12, 3600, 15, 3900, 18, 3600, 21, 2700, 22, 2400, 23, 2100)


#4

Nice, this looks fairly straightforward - I’ll play with it this weekend.


#5

thats my mission … fairly straightforward :smiley:


#6

I’m working with:

rangeValue($hour24, 1500, 0, 1500, 6, 2400, 9, 3500, 12, 4500, 15, 5500, 18, 4500, 21, 3000, 22, 2400, 23, 1800)

I’m using “Set Color Temperature” which correctly defines these values as Kelvin. Evaluating the expression shows exactly ‘4500’, and the time is 12:20pm here. Does this ramp between values, or jump?


#7

this jumps. if you want to ramp you can combine this with rainbowvalue()

btw which bulbs support 1500K?


#8

The LIFX Day & Dusk bulbs hit 1500K. Giving them a shot - hopefully I can get them to behave.

So converting Kelvin to RGB… not so simple… but there’s some code down there that might make a nice piston…


#9

nice. but probably cost $75 or something a bulb. :slight_smile:

btw, rainbow might not work since it always returns a color.


#10

I got 'em for $29.99 :slight_smile: LIFX bulb colors are amazing, but I think they were designed by artists, not engineers.


#11

try this:

($hour24 < 15 ? int(1500 + (4000 * ((time($now)/1000) / (time(“15:00”)/1000)))) : int(1500 + (4000 - (4000 * ((time($now)/1000) / (time(“23:59”)/1000))))))


#12

Awesome, that gives a rather precise number, thanks.

Now I’m dealing with an entirely different issue - I think I have maxed out the number of wifi clients my router can handle (30!)


#13

probably going to need that for rooms occupancy so thought i would put it together any ways.

300+ devices? what do you have a fully automated mansion? :slight_smile:


#14

Hah, no, only 30!

I have a bunch of ESP8266 boards doing various things, each requiring a separate connection. That in combination with wifi bulbs… Stuff is sometimes not showing up in my tables.


#15

o ok. 30 devices seem low for a router to choke on?


#16

It does seem low… I’m trying to figure out why some of them have trouble being seen.


#17

@bangali this works great, and so simple to quickly add to tunable white bulbs. As far as I can tell, it’s creating what looks like a triangle wave that peaks at 15:00 (with 5500K), reverses direction, and bottoms out at at 23:59 (with 1500K). Is that correct?

Would you be willing to break this down so I can better understand the expression syntax? I’m wondering if a parabolic curve or sine wave could be created, for instance.


#18

yep. not an isosceles since light does not peak at noon but more like ~3pm.

($hour24 < 15 ? int(1500 + (4000 * ((time($now)/1000) / (time(“15:00”)/1000)))) : int(1500 + (4000 - (4000 * ((time($now)/1000) / (time(“23:59”)/1000))))))

up the hill: int(1500 + (4000 * ((time($now)/1000) / (time(“15:00”)/1000))))

the base is 1500 so thats the leading part. 4000 is the max height of the hill. at 15:00 it should be at peak so divide current time by time at 15:00 and multiply by 4000 to calculate how close to peak it is at any given time.

'down the hill: int(1500 + (4000 - (4000 * ((time($now)/1000) / (time(“23:59”)/1000)))))`

on this one at 23:59 should be back at base of hill. so divide current time by time at 23:59 and multiply by 4000 to calculate how far from peak it is at any given time. then subtract that from peak to find how close you are to the base.

sure. just requires a little work.


#19

Cool - I’ll get to work.

In the meantime I modified the range a tad. 1500 looks like a campfire burning embers. :fire:

($hour24 < 15 ? int(1800 + (4700 * ((time($now)/1000) / (time(“15:00”)/1000)))) : int(1800 + (4700 - (4700 * ((time($now)/1000) / (time(“23:59”)/1000))))))


#20

i use 1900 and 2600 as my 2 values.