Hue colors

Hi everyone,

I’m trying to propgram my hue bulbs for my setup. For that purpose, I’m attempting to dump my existing scenes from the hue app and place them in functions. In general, it works well, but I have weird effects with the colors. I have an LED panel which is programmed to look yellow-ish. I execute my dump function and it returns something like this (the dump function is designed that I just copy&paste the result into an text editor, remove the prefix and then place it into a separate rule or function):

2016-04-09 11:33:13.403 [INFO ] [enhab.model.script.getHueLight] - setColorHueItem.apply(Light_Paneel, 33.81318681318681029779327218420803546905517578125, 78, 100)

so the hue is somewhere between red and yellow. Should be fine in my eyes.

To verify the value, I am reading the state of that bulb from the command line. It returns the following:

{
“manufacturername”: “dresden elektronik”,
“modelid”: “FLS-PP3”,
“name”: “Paneel”,
“state”: {
“alert”: “none”,
“bri”: 254,
“colormode”: “xy”,
“ct”: 383,
“effect”: “none”,
“hue”: 6154,
“on”: true,
“reachable”: true,
“sat”: 197,
“xy”: [
0.4565,
0.394
]
},
“swversion”: “33048736”,
“type”: “Extended color light”,
“uniqueid”: “xxx”
}

Now when I execute that same command in a separate rule, I weirdly get a different color than the one I have just dumped. It is somewhat more red than yellow.

I dump the values again and I get the following:

2016-04-09 11:37:58.587 [INFO ] [enhab.model.script.getHueLight] - setColorHueItem.apply(Light_Paneel, 33.8131866455078125, 78, 100)

So this is almost the same. I get the state of the bulb from the command line again:

{
“manufacturername”: “dresden elektronik”,
“modelid”: “FLS-PP3”,
“name”: “Paneel”,
“state”: {
“alert”: “none”,
“bri”: 254,
“colormode”: “hs”,
“ct”: 500,
“effect”: “none”,
“hue”: 6154,
“on”: true,
“reachable”: true,
“sat”: 198,
“xy”: [
0.5089,
0.3892
]
},
“swversion”: “33048736”,
“type”: “Extended color light”,
“uniqueid”: “xxx”
}

Ok, so what I notice is that hue/sat/brightness match mostly, but the color mode is different now than in the scene that I programmed with my Hue app. Also, the x/y parameters are different.

So can anybody tell me what the problem is and how I can read the color correctly? I have a hunch that either the device or the bridge converts the xy color space wrongly to hsb, what do you think?

Thanks a lot in advance!

I am not sure what you are trying to do… or how you are trying to do it :confused:

If you already have the scenes on your bridge it would be easier to keep them there, and call them in a rule with a http request:

var String hueApiCall = "curl@@-X@@PUT@@-d@@{\"scene\": %s }@@http://192.168.1.147/api/HUEUSERID/groups/4/action"
executeCommandLine(String::format(hueApiCall, "0cH4dn0QboIkabE-scene-id"))
1 Like

Indeed, your solution is a lot more simple. The intention was to use the features available offered by the binding. I’ll do it as suggested by you though. I still find it really weird that I’m unable to read a color and reset it with the same values to get the same result.
Thanks!

Have you tried getting the state of the Hue lights from the binding with something like:

var HSBType savedState = Light_FF_Office_Ceiling.state

You can then set it with:

sendCommand(Light_FF_Office_Ceiling, savedState)

I think the binding just uses HSB and you can separate them out as described in the wiki

The issues I have with the binding is the lack of groups, scenes and transitions, the binding is great at integrating the Hue lights to the openHAB way of doing things. But not so great at using the bridge and the the features that come with it.

I saw the exectudeCommandLine method referenced in a thread about slow fading the lights and since then I use it for all Hue interactions. As well as setting scenes you can set any property for a group or lightstate; bri, hue, sat etc

var String hueApiCall = "curl@@-X@@PUT@@-d@@{\"on\": %s, \"bri\": 1, \"transitiontime\": %d}@@http://192.168.1.147/api/HUEUSERID/groups/%d/action"
executeCommandLine(String::format(hueApiCall, "true", 300, 4))

With the occasional “get state set state” example as described above. Which is very handy to check if a light is on before doing something.