Closed OliverHi closed 6 years ago
Ok, lets see how this works.
There are two different approaches as regards conforming white color with RGBW led strips. 1- Full brightness set to RGB channels and full brightness to White channel 2- RGB channels turned off and full brightness to White channel.
I have a rule that converts the selected color from the color picker and turns it into separate R G B W intensities.
When I set full white in openhab, this is what I get:
19:08:41.900 [INFO ] [smarthome.event.] - Item 'HSBValueRGBW' received command 0,0,100 19:08:41.890 [DEBUG] [orsAbstractConnection$MySensorsWriter] - Sending to MySensors: 0;1;1;0;41;ffffffff 18:51:50.717 [INFO ] [smarthome.event.ItemStateChangedEvent] - RGBWStrValue changed from NULL to FFFFFFFF
Lets analyze this 3 log lines:
Line 1: Brightness set to 100%, hue and saturation to 0
Line2: Color converted to FFFFFFFF by mysensors
Line 3: Color converted to the same value by the rule i am using (this is just a string label I'm using for debug purposes)
So my rule is behaving more alike the first behavior described, and so is the mysensors conversion method.
I don't see any error in this, but it would be nice to be able to choose between the two behaviors mentioned above.
NOTE: It's very difficult to set plain white using the color picker. NOTE2: My rule that converst HSV to RGBW and RGBW and writes it to a string just to debug: ` rule "Set RGB value" when Item HSBValueRGB changed then val hsbValue = HSBValueRGB.state as HSBType
val brightness = hsbValue.brightness.intValue
val redValue = ((((hsbValue.red.intValue * 255) / 100) * brightness) / 100)
val grnValue = ((((hsbValue.green.intValue * 255) / 100) * brightness) / 100)
val bluValue = ((((hsbValue.blue.intValue * 255) / 100) * brightness) / 100)
val rgbHexString = String::format("%02X%02X%02X", redValue, grnValue, bluValue)
sendCommand(RGBStrValue, rgbHexString)
end
rule "Set RGBW value" when Item HSBValueRGBW changed then val hsbValue = HSBValueRGBW.state as HSBType
val brightness = hsbValue.brightness.intValue
val redValue = ((((hsbValue.red.intValue * 255) / 100) * brightness) / 100)
val grnValue = ((((hsbValue.green.intValue * 255) / 100) * brightness) / 100)
val bluValue = ((((hsbValue.blue.intValue * 255) / 100) * brightness) / 100)
val whiValue = Math.min(redValue, Math.min(grnValue, bluValue));
val rgbHexString = String::format("%02X%02X%02X%02X", redValue, grnValue, bluValue, whiValue)
sendCommand(RGBWStrValue, rgbHexString)
end `
RGBW leds have the distinct advantage over simple RGB ones that they can be set to a pure white without color mixing. They just use the dedicated white leds. I guess this also saves on energy Currently it doesn't seem to possible to set a color value like
000000FF
. I always either get a mixed color or no color at all. I don't know if this is a bug or a missing feature or intended but the ability to send the above value to RGBW nodes would be great! I guess the fix would be somewhere in the org.openhab.binding.mysensors.converter.MySensorsRGBWTypeConverter as openhab seems to use HSB/HSV internally that gets converted here. Currently white is just set to the minimum of all other values. Perhaps an if statement could help there. Or a completely new conversion like this one. I am no expert in color conversion though, so I don't really know. I do know that domoticz handles it the way I described (sending pure white for a white color).