Pardon my ignorance, Mike---I just want to be sure I'm not unnecessarily adding methods to my drivers, and I had a thought as I was reading through this thread.
Does HE have built-in HSV <> RGB methods? In ST, I had to write my own (which I've carried over into my new drivers.)
If this is already implemented and I've missed it, then I'd sure love to get on board with that.
Not at this time, unfortunatly.
Not a problem! I'll clean my methods up a bit, in that case
csteele
November 13, 2018, 4:47am
24
Feel free to document them here if sharing's a goal.
1 Like
Sharing is absolutely my goal
They're not the cleanest, but here are my HSV <> RGB methods:
def hsvToRGB(float conversionHue = 0, float conversionSaturation = 100, float conversionValue = 100){
// Function's parameters are between 0 - 100
// Returns RGB map ([ red: 0-255, green: 0-255, blue: 0-255 ])
conversionHue = conversionHue / 100
conversionSaturation = conversionSaturation / 100
conversionValue = conversionValue / 100
int h = (int)(conversionHue * 6);
float f = conversionHue * 6 - h;
float p = conversionValue * (1 - conversionSaturation);
float q = conversionValue * (1 - f * conversionSaturation);
float t = conversionValue * (1 - (1 - f) * conversionSaturation);
conversionValue *= 255
f *= 255
p *= 255
q *= 255
t *= 255
This file has been truncated. show original
def rgbToHSV( r=255, g=255, b=255, resolution="low" ) {
// Takes RGB (0-255) and returns HSV in 0-360, 0-100, 0-100
// resolution ("low", "high") will return 0-100, or 0-360, respectively.
r /= 255
g /= 255
b /= 255
float h
float s
float max = Math.max( Math.max( r, g ), b )
float min = Math.min( Math.min( r, g ), b )
float delta = ( max - min )
float v = ( max * 100.0 )
max != 0.0 ? ( s = delta / max * 100.0 ) : ( s = 0 )
if (s == 0.0) {
h = 0.0
This file has been truncated. show original
If you have any changes, feel free to submit a pull request. I think they should be explanatory enough to make sense.
Hi @mike.maxwell ,
Is the Generic Zigbee CT Bulb (dev) driver fine to use in a production environment, and is there anything still in the queue to be done to bring it out of dev?
Best wishes,
Mark
That is the production driver, it just escaped its cage with the wrong name.
1 Like
Thanks for confirming, @mike.maxwell
Can this be flagged to be renamed in a future release as a very low priority?