Control temperature of double white LED stripes
monte last edited by
Now you can buy LED stripes with dual white LEDs. It's half cold half warm, it has 3 pins: V+, V- for cold LED and V- for warm LED. That way by dimming each led you can control the overall color temperature of the light.
This LEDs are used extensively by IKEA in their lamps. Home assistant has separate control for color temperature, so when you connect IKEA hub to it you can control lamp's warmth.
I haven't found suitable message type in Mysensor's API. Is there any way to implement this feature? Or maybe there is some workaround to do this with current API?
So I am digging into this subject. As I understand the main place to add new code is the controller itself, in my case it's Home Assistant and Mysensors library doesn't need any additions to work with new variable and sensor type. So if I will add support to Home Assistant's Mysensors plugin for sensor named "S_COLOR_TEMP" and give it, lets say, number 40 for serial value I can use this number as sensor type in my sketch, without any changes to Mysensors library and It will work. Am I right?
Also should I just make a pull request on github to add this sensor type to Mysensors library, or there is any other discussion process for such additions?
@monte that should work.
However, can't the color temperature be represented by the existing rgb values? Like it is being done in https://forum.mysensors.org/topic/4934/wall-mounted-mood-light-v2
Philips hue lights seem to use XY colors, which can be converted back and forth to rgb. Example: https://github.com/AWiseAd/MyS_AWI/tree/master/AWI_MySensors_HUE
So maybe there is a way to achieve what you want without having to add a new feature to the library (and thereby requiring every controller to be updated).
monte last edited by
@mfalkvidd Home Assistant has different controls for RGB and color temperature. It also requests different units, for RGB it's HSL and for CT it's Mired. If I will use RGB value and then convert it into CT internally on a sensor, then I will have to use RGB color wheel in Home Assistant interface. I can't see, how it would be convenient to choose color temperature by guessing a position on an RGB wheel. It would be a solution, if a controller didn't have dedicated interface to control color temperature, but I think it is clear that those two parameters are very different and each one needs it's own ui element to control it properly.
I have some Ikea Treadrfi lamps and I really like how you can change its color temperature, on other hand I can't see a use case for an RGB light for myself other then a proof of concept. I hope I am not the only one who needs this feature separately from RGB, considering that now you can easily buy a combined white LED stripes everywhere.
@monte thanks for explaining.
Could you use HA's color temperature UI control, and then map the values to RGB values before they are sent to MySensors? That way you could use the most intuitive / user friendly way to control the setting, while using existing functionality in MySensors.
I'm not against adding new features to MySensors, but I am against adding redundant features.
@mfalkvidd Well, as far as I understand how HA Mysensors plugin works, the answer is no. Basically HA auto adds sensors and chooses the suitable controls for them by checking its type. So if I use S_DIMMER it will only have a brightness parameter in HA, if I use S_RGB_LIGHT, or S_RGBW_LIGHT it will also have a color wheel to control it. The only way to get color temperature slider is either enable it for S_RGB_LIGHT and S_RGBW_LIGHT and do a conversion inside plugin's code, or add a separate sensor type which will only use brightness and CT control. If we go the first way then we will have redundant controls for sensors that doesn't need them, and I'm not sure that maintainer of the plugin will accept such changes, but who knows.
As for redundant features in Mysensors library, I agree with you. But as long as this is only a
typedefdefinition and doesn't need any code additions, I can't see how it can be bad for a platform. As I've said before, combined LED stripes are becoming widely available and there are already consumer products available that uses this principle, so it's not something unknown or niche type of thing. Ikea has wide variety of light in form of light bulbs and complete lamp pieces that has color temperature control, and doesn't have any RGB light. Osram too has zigbee lamps with this feature and there are even "dumb" Philips lamps that switches between cold and warm white light by only turning them on/off. Once again, for me CT is far more useful feature for home light than an RGB, because I don't do parties every day, but I can really appreciate different mood for different time of day that can be achieved by changing from cold light to neutral to warm.
@monte I see. I thought the user would be the one deciding whether they wanted to control their rgb strip by temperature or full color. I imagined that a party-loving user would opt for the full rgb control and a ”normal” user would opt for the temperature control, even if they bought the same rgb led strip.
Or maybe the one user would buy two identical strips, but wanted to control one with temperature and one with rgb.
Or even let a single user with a single rgb switch use the temperature control for normal operation, but bring forth the full color control when they occasionally host a party.
But if the device needs to decide how it should be controlles, I guess we have no choice but to add a new type.
You are correct that new types do not require more code in the MySensors library. But they make it harder for controller developers to support MySensors, and they make it harder for people new to MySensors to understand when they should use which type.
@mfalkvidd I understand. Maybe we could ask author of the plugin what he sinks about it, if you know his name on this forum and can tag him? There is possibility to manually config some parts in HA, but mysensors plugin uses config files only to set general options for gateway, there is no options for individual nodes in config (except changing node name). Maybe they could be added, but I imagine that this will brake the approach the author of the plugin has to it.
Yes, let’s see if we can get @martinhjelmare ’s opinion.