Openhab-addons: Hue Emulator Color Support

Created on 10 Oct 2016  路  16Comments  路  Source: openhab/openhab-addons

Would be nice to have color support in hue Emulator.

Currently it doesn't work through Logitech Harmony. Can't set light colors.

All 16 comments

What build are you on? There was an issue for this and a fix this week, if you could try it out and confirm it works that would be great

Yes, actually I was the one reporting that issue too: #1266. If you like you can close this and re-open #1266.

I'm on a recent snapshot. 2.0.0.201610080957 is the version of Hue Emulation binding.

Yes, actually I was the one reporting that issue too:

Sorry missed that. Actually I had been assuming this was a conversion issue, now I realized I'am advertising everything as a "LWB004" device, which is not a Color hue bulb. That would be the problem. Let me play around with how to solve this, one thought is if the item is a ColorItem, then advertise a Color bulb, another however would be to support a "ColorLight" tag, there's currently a discussion about tagging symantics at https://github.com/eclipse/smarthome/issues/1093 . I'll probably go with the item type to start,

Hey, i am also very interested in the color support in the Hue Emulation Binding. Anything new on this topic?

Same, I would like to be able to change colors through Google Home and other application using the hue emulator. One use case I am looking forward to is to connect the Hue Disco (colors following music) app to the hue emulator so that my ledstrip follows the color changes like my hue bulbs.

Any update on this issue?

Any update on this? I'd like to use Alexa to change colors, but it says my device doesn't support that.
I think the device would need to be advertised as an 'Extended Color Light' (and possibly a different model id) for that to work, seems that's hardcoded though.

I would also like to see this feature. Especially that Alexa can now control light color of Hue Bulbs as well.
So +1. Please implement it @digitaldan.

I looked at the code, and there seems to be an attempt to support colour items in there, but it doesn't work. It seems to depend on a ColorItem.state being an instance of HSBType, which it isn't. By default a ColorItem.state is DecimalType (it returns brightness), you have to cast the colorItem to HSBType to be able to access all the properties.

It should be looking at the item type, not state, as state does not neccesarily reflect the item type accurately.

So what are your proposed changes to the code? Just the cast or is there more that needs to be changed? I would support the change and test a new version of the binding.

I am happy to support in adding color support for hue emulation binding @digitaldan.
I looked at the code and assume we have to announce different light bulb types depending on the item type of the hue device in Openhab. All different hue bulb types are listed on the following page: https://developers.meethue.com/documentation/supported-lights)

I did take a look at the code and I think the main problem is that simply that the conversion to HSBType is not quite right yet. The brightness is converted to openhab format (from 0 - 255 to percent type) but the saturation is not converted to percent type. (also 0 - 255) Also the hue value is not converted. (This should be divided by 182 regarding to the hue addon) I've changed the method toHSBType in the HueState.java like this:

    public HSBType toHSBType() {
        int brightness = 0;
        int saturation = 0;
        int hue = 0;
        if (this.on || this.bri > 0) {
            // if on but brightness is less then 1, set HSB brightness to 100, otherwise convert Hue brightness
            brightness = this.bri < 1 ? 100 : (int) (this.bri / 255.0 * 100);
        }
        if (this.on || this.sat > 0) {
            // if on but saturation is less then 1, set HSB saturation to 100, otherwise convert Hue saturation
            saturation = this.sat < 1 ? 100 : (int) (this.sat / 255.0 * 100);
        }
        if (this.on || this.hue > 0) {
            // if on but hue is less then 1, set HSB hue to 14924, otherwise convert Hue hue
            hue = this.hue < 1 ? 14924 : (int) (this.hue / 182);
        }
        return new HSBType(new DecimalType(hue), new PercentType(saturation), new PercentType(brightness));
    }

This seams to solve the problem that the Phillips Hue color values are not accepted. But the problem is still that a lot of apps are having problem recognizing the emulated api because there are a lot of json properties that are not provided by the emulation. (e.g. groups, config, schedules, scenes, rules, sensors and resourcelinks)

So we also would need to have a definition which of those json properties are required at minimum for those apps to recognize the api properly.

Could be the case. But for example for Alexa all Openhab Items are offered as simple on/off lights. Even if the item in Openhab is defined as a color light item. In order for Alexa to recognize an openhab item as a color light it has to be offered as a color light via the hue emulation binding. Only then Alexa allows controlling the color attribute like this: "Alexa, switch to color blue".

I have the same problem with my Logitech Harmony. It seems to be that the harmony uses Brightness, X and Y to set the color, but the Hue emulator does simply ignore X and Y.

Bump this...I need color for hue emulation hard. Would be very nice if someone can add this functionality

Appears this is dead with no comments or code updates. Assuming "color" will not work with Hue Emulation and Alexa anytime soon.

The referenced PR adds color support for the hue emulation. But controlling the color will not work with Alexa without a skill.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gk4 picture gk4  路  3Comments

openPhiL picture openPhiL  路  5Comments

DanielMalmgren picture DanielMalmgren  路  5Comments

kubawolanin picture kubawolanin  路  4Comments

Nikos78 picture Nikos78  路  5Comments