hap-java / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 1.0
5 stars 1 forks source link

Understanding basic light concept #7

Open Tazintosh opened 5 years ago

Tazintosh commented 5 years ago

Hi there, This post is a bit of a copy of my post for the openhab support in homebridge. I'm waiting for the developper answer, but it's probably in vacation, so since, I've the exact same behavior when using the HomeKit add-on for openhab, I thought I could also post my question here:

I just want to check if I'm missing something on the concept here. Let's take the example of a light (in my case, a LED strip with RGB + physical white lights)

I've my LED strip as Thing on OpenHab. It has 5 channels Power (switch), Color (color), White (dimmer), White2 (dimmer, not used), Program (string) and Program speed (dimmer).

Following the HomeKit add-on documentation, I've added my tags to my items.

My (kind of) surprise is that I end up in HomeKit with 4 accessories (string is not supported), which makes sense based on the documentation, but doesn't to me and based on HomeKit accessory description where everything should be merged in one unique accessory. (For instance, with a native HomeKit light, I've never had to first toggle an accessory switch on to power it, then to use another one to set it's color, another one to set it's white, and so forth).

I understood that grouping could make it work as I thought, but in no way I've been able to make a lighting group work:

Group gStairwayLEDController "Stairway LED Controller" (gLight) [ "Lighting" ] Switch StairwayLEDController_power "Power" (gStairwayLEDController) [ "Lighting" ] {channel="wifiled:wifiled:XXXXXXXX:power"} Color StairwayLEDController_color "Color" (gStairwayLEDController) [ "Lighting" ] {channel="wifiled:wifiled: XXXXXXXX:color"} Dimmer StairwayLEDController_white "White" (gStairwayLEDController) [ "Lighting" ] {channel="wifiled:wifiled: XXXXXXXX:white"}

Is there a way to "merge" those (or at least power, color and white) in one unique accessory or is my only way is to program everything on openhab (ie. if brightness != 0 then power ON, etc.)?

Thanks in advance for your bright light ;)

ccutrer commented 5 years ago

The HomeKit addon doesn't handle multiple different channels for a Light accessory. It expects you to only tag the Color item. Color is represented as HSB. So for on/off it should be setting Brightness to 0 or 100. Does your bulb not respond by actually turning off if brightness is set to 0? If not, we may need to extend the addon to allow specifying a separate Switch item as the HomeKit PowerState characteristic.

Tazintosh commented 5 years ago

Hi @ccutrer, thanks for the answer. By "tapping" on the HomeKit accessory, the brightness goes from 0 to 100 (visible on openhab webUI). But the things power channel is not turned ON or OFF. So I would need to program the full behavior that is normally expected from an HomeKit device. And it's not all, the same applies for the white color, which as far as I know is normally handled on HomeKit by the temperature view. All of this would need to be programmed if we don't want min 4 accessories icons on HomeKit for just one physical device oO right?

ccutrer commented 5 years ago

Yes, if your bulb doesn't automatically turn on/off in response to changes of the brightness value, you'll need to write a rule to do that for you (for now). Question - if you use OpenHAB cli, does smarthome:send StairwayLEDController_color ON and smarthome:send StairwayLEDController_color OFF work? (Technically Color items are supposed to be able to respond to OnOff commands as well).

I'm not sure what you mean by "the white color". I haven't played with Home.app's UI (on iOS) for a lightbulb with color characteristics before, but I am familiar with the accessory definition, which says it has PowerState (on/off), and hue, saturation, brightness (a regular dimmer without color is just PowerState and brightness). There's not a separate channel for white. I know some LED bulbs have RGB and W elements, but you don't control those directly. The bulb automatically figures out when to use it as a supplement because the other elements can't accurately reproduce the color you're requesting.

Tazintosh commented 5 years ago

Ok, I just tried the commands you sent me. The result is not complete, let me explain: • smarthome:send StairwayLEDController_color ON does turn ON the led strip + set the brightness to 100% • smarthome:send StairwayLEDController_color OFF does turn OFF the led strip + set the brightness to 0% • But, while the paper UI does move the brightness slider in live to 100 or 0%, it doesn't reflect the power stat, which always stays to OFF.

As for the white color, yes I meant I do have dedicated W elements on my LED strip which in openhab, is a separate channel (dimmer). When I use it, indeed only the W elements are dimmed.