0

When calling to the api of my philips hue bridge to get the data of a lamp I get a JSON result like this:

{
    "state": {
        "on": true,
        "bri": 254,
        "hue": 23573,
        "sat": 254,
        "effect": "none",
        "xy": [
            0.2113,
            0.669
        ],
        "ct": 500,
        "alert": "select",
        "colormode": "xy",
        "mode": "homeautomation",
        "reachable": true
    },
        // etc etc
}

Now I have node.js app where I need the hex color that is equivalent to the xy value given by the api, I have found out that the code is presumably a CIE 1931 value, but I could not find a way to convert that value properly and get a hex code back.

I tried some npm packages but couldn't get it working

Lars
  • 1
  • 1
  • Does this answer your question? [Philips hue, convert xy from api to HEX or RGB](https://stackoverflow.com/questions/22894498/philips-hue-convert-xy-from-api-to-hex-or-rgb) – Jacob K Jan 27 '23 at 21:33
  • I had already used this guide and I got something working but it is very inaccurate – Lars Jan 27 '23 at 21:46

0 Answers0