Adding Phlips Hue Items

I’m probably just doing something wrong, but what is the proper format/syntax in your items file in OH2 to control a philips hue light?

I added this to my items in OH2 and can see the bulb in the sitemap, but can’t seem to turn it on and off?

> Switch Light_Family_Left "Family Left" (Garden, Lights) { hue="4"}

It also seems in the paper ui, when I try to add a light, it get added as a ‘room’? Thus, why I added manually to the items file.

Finally got it figure out… For anyone else still struggle with the new item definition syntax, I found the answer here:

btw, this is documented here: https://github.com/eclipse/smarthome/blob/master/extensions/binding/org.eclipse.smarthome.binding.hue/README.md#full-example
(link to be found on the addons overview at https://github.com/openhab/openhab-distro/blob/master/docs/sources/addons.md)

2 Likes

Hi,
the definition in the linked document is as follows:

demo.things:

Bridge hue:bridge:1 [ ipAddress="192.168.0.64" ] {
    LCT001 bulb1 [ lightId="1" ]
    ZLL_Light geBulb [ lightId="2" ]
}

demo.items:

Color Light { channel="hue:LCT001:1:bulb1:color" }
Dimmer Light_ColorTemp { channel="hue:LCT001:1:bulb1:color_temperature" }

Two questions about this:

  • What does the “1” in the item’s channel definition stand for? Seems to be the lightId? But isn’t this already defined in the things file?
  • Why do I need to mention the think type (LCT001) and the thing id (bulb1) in the channel definition? isn’t it clear from the things file that thing bulb1 is of type LCT001?

These make up the full address of the THING, you can’t use just one section, it much be complete.

hue:LCT001:1:bulb1

Think of it as you would your residential address; No. 35 for example is quite useless if I don’t know what street, what city and what country your house is in.

In the example you are basically linking your item Light_ColorTemp to this bulb on the color_temperature channel.

Thanks for your explanation. I also found out that “1” is not the lightId but the bridgeId.
So the channel seems to have this format: binding:thingType:bridge:thing:channel.

But then again, when I look at the example above:
hue:LWB004:0017881003d0:6:color this would mean that “6” is the name of the thing (defined in the .things file). Probably that is what confused me.

Completely different question, this is the description for the brightness channel:

This channel supports adjusting the brightness value. Note that this is not available, if the color channel is supported.

That is quite interesting? This hasn’t been the case in OH1 but I can in the LCT001.xml definition, that channel “brightness” is not listed.
Nevertheless, my lamp LCT001 works with both brightness and color channel, using these items:

Dimmer COLampBrightness {channel="hue:LCT001:00178812c614:COLamp:brightness"}
Color  COLampColor  {channel="hue:LCT001:00178812c614:COLamp:color"}

and logs:
2016-05-27 18:34:02.263 [INFO ] [home.event.ItemChannelLinkAddedEvent] - Link 'COLampBrightness-hue:LCT001:00178812c614:COLamp:brightness' has been added.

How would this be possible?

I assume this is possible because the code of the hue binding does not check whether the brightness channel exists on this thing type. As the handler implementation is the same for all thing types, it knows how to deal with brightness, so it simply does it… Kind of “useful bug” :wink:

1 Like