TheThingSystem / steward

The Thing System is a set of software components and network protocols that aims to fix the Internet of Things. Our steward software is written in node.js making it both portable and easily extensible. It can run on your laptop, or fit onto a small single board computer like the Raspberry Pi.
http://thethingsystem.com
Other
346 stars 81 forks source link

Is the lighting model mis-specified? #156

Closed RussNelson closed 10 years ago

RussNelson commented 10 years ago

Is it just me (I'm new to this, so yeah, it might be me), or is the lighting model overspecified? A particular state of a bulb includes whether it is on or off, its R, G, and B values, and its brightness. If RGB == #000, shouldn't that be sufficient information to turn power off to the bulb? And isn't it always the correct thing to do to multiple R_brightness, G_brightness, and B*brightness to arrive at the final colors?

It's also under-specified in the case of the LIFX bulbs, which are internally RGBW (literally ... they have R, G, B, and White LEDs.) Their UI uses the brightness control to raise up the level of white past the halfway point. So, 0-50% of brightness affects the RGB LEDs, and 50% to 100% affects the white LEDs. And then they also support color temperatures. There's an algorithm to turn color temperatures into RGB values.

RussNelson commented 10 years ago

Playing some more with the lifxjs reverse-engineered library, it seems to work sensibly. The hue sets the hue. The saturation says how far from "white" you are to the specified hue. The brightness says how far you are from black to the saturated color. And the kelvin value sets whatever your "white" is.

mrose17 commented 10 years ago

hi. the reason why rgb=#000000 isn't off is because you may want to set the color of a bulb without turning it on, so the next time you turn it on, it has the right color. i'm not really keen on this behavior, but it appears to be fairly common.

could you do a PR on your lifx code so that we can start using it?

as the first line, please put:

// Author: Russ Nelson, released to open source under the MIT License

so that we can distribute it far and wide?

thanks!

ps: lighting is the most difficult thing to model at the moment because while you want to have a lowest common denominator (RGB, on/off), people do actually buy bulbs for fancy stuff, which usually involves brightness, color temperature, and color model. thus, the #thethingsystem, for both better and worse requires that each lighting driver provide both the RGB+on/off functionality and whatever high-end functionality is available with respect to color. other things, e.g., blinking, etc., we ignore. you want that stuff, get a custom app, because after all, no two manufacturers are going to have the same functionality in that area...