iobroker-community-adapters / ioBroker.habpanel

AngularJS-based dashboard-like interface for ioBroker (based on openHAB panel)
Eclipse Public License 2.0
22 stars 15 forks source link

color picker widget (aCKolor) works only in rgb mode #15

Closed ArekHas closed 2 years ago

ArekHas commented 5 years ago

The color picker output is in rgb (r,g,b) the hue implementation in iobroker accept xy oder three single inputs for rgb.

Is it possible to extend the color picker to xy output? Im not sure if its better to implement a new output here or in the openhab.ui.panel branch, but the xy output is only needed for iobroker inplementation.

enclosed a possible rgb to xy convert

regards arek

// From: https://github.com/usolved/cie-rgb-converter/blob/master/cie_rgb_converter.js
 * Converts RGB color space to CIE color space
 * @param {Number} red
 * @param {Number} green
 * @param {Number} blue
 * @return {Array} Array that contains the CIE color values for x and y
 */
function rgb_to_cie(red, green, blue)
{
    //Apply a gamma correction to the RGB values, which makes the color more vivid and more the like the color displayed on the screen of your device
    var red     = (red > 0.04045) ? Math.pow((red + 0.055) / (1.0 + 0.055), 2.4) : (red / 12.92);
    var green   = (green > 0.04045) ? Math.pow((green + 0.055) / (1.0 + 0.055), 2.4) : (green / 12.92);
    var blue    = (blue > 0.04045) ? Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4) : (blue / 12.92); 

    //RGB values to XYZ using the Wide RGB D65 conversion formula
    var X       = red * 0.664511 + green * 0.154324 + blue * 0.162028;
    var Y       = red * 0.283881 + green * 0.668433 + blue * 0.047685;
    var Z       = red * 0.000088 + green * 0.072310 + blue * 0.986039;

    //Calculate the xy values from the XYZ values
    var x       = (X / (X + Y + Z)).toFixed(4);
    var y       = (Y / (X + Y + Z)).toFixed(4);

    if (isNaN(x))
        x = 0;
    if (isNaN(y))
        y = 0;   
    return [x, y];
}
hubermedia commented 4 years ago

hi arek, just a question: have you found a solution that the color picker returns CIE color (xy)? i would need this to control my philips hue loghts too. thx, stefan

ChR-iSz commented 3 years ago

Hi Arek,

currently i work on this. I have the same issue with my wled Hyperion led's.

Kiko1432 commented 2 years ago

Hello all,

Has anyone here already found a solution in Iobroker to control hue lights via the HubPanel? @ChR-iSz you said you working on something. Can you share your knowledge?

ChR-iSz commented 2 years ago

Hi @Kiko1432,

I must look into my past code for this. Currently i dont use iobroker, but let me check tomorrow my old workaround.

Cheers chrisz

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within the next 7 days. Please check if the issue is still relevant in the most current version of the adapter and tell us. Also check that all relevant details, logs and reproduction steps are included and update them if needed. Thank you for your contributions. Dieses Problem wurde automatisch als veraltet markiert, da es in letzter Zeit keine Aktivitäten gab. Es wird geschlossen, wenn nicht innerhalb der nächsten 7 Tage weitere Aktivitäten stattfinden. Bitte überprüft, ob das Problem auch in der aktuellsten Version des Adapters noch relevant ist, und teilt uns dies mit. Überprüft auch, ob alle relevanten Details, Logs und Reproduktionsschritte enthalten sind bzw. aktualisiert diese. Vielen Dank für Eure Unterstützung.

stale[bot] commented 2 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if still relevant and make sure to include all relevant details, logs and reproduction steps. Thank you for your contributions. Dieses Problem wurde aufgrund von Inaktivität automatisch geschlossen. Bitte öffnet ein neues Issue, falls dies noch relevant ist und stellt sicher das alle relevanten Details, Logs und Reproduktionsschritte enthalten sind. Vielen Dank für Eure Unterstützung.