Announcing some improvements to the Homekit plugin for openHAB 2

It is identical.
Sorry for the screenshot. I’ve found no way to copy text on my iPad from ssh…

Edit: seem I was wrong. Here is the complete tracelog from the working switch. It also sends 0/1 and later there is another entry with true/false witch is missing in the other case.

ok. so, both ways - single line and group have created identical HomeKit items. communication seems to be ok as well. i would really check the other side - items -> things. maybe device does not accept “On” event and set it back to “off”.

Ok, thank you. Will test it next week at home and give feedback than.

Can anyone give me some hints how to use the name property?
Is it used to set the name how the item is presented on the iphone or am I not understanding this correctly?

Switch  Homekit_Pumpe     {homekit="Switchable.OnState,Switchable.name=Pumpe1"}

by default HomeKit add-on uses the label of the openHAB item as the name in home app on iphone. i.e. you can write something like

Switch Homekit_Pumpe "Pumpe1" {homekit="Switchable.OnState}

in case the name of the item is dynamic, one can use the name property like this

Group  gPumpeGroup     			             {homekit = "Switchable"}
Switch  Homekit_Pumpe      (gPumpeGroup)     {homekit = "OnState}
String  Pumpe_Name	       (gPumpeGroup)     {homekit = "Name"}

in this case, the name of the accessory in home app will be the value of the item “Pumpe_Name”.

btw, you can also use “Valve” accessory for the pump. it will give you different icons in home app on iphone, e.g.
image
image

1 Like

@webjochen have you found the correct garage door opener configuration?

this one works for me:

Group  gGarage    						"Garage Group"       									{homekit = "GarageDoorOpener"}
Switch garage_obstruction 				"Garage Obsruction" 							(gGarage) 		{homekit = "ObstructionStatus"}
Switch garage_target 					"Garage Door Target State" 							(gGarage) 		{homekit = "TargetDoorState"}
String garage_current 					"Garage Door Current State" 							(gGarage) 		{homekit = "CurrentDoorState"}

and sitemap

Switch item=garage_obstruction label="Garage Obstruction"
Switch item=garage_target label="Garage Target"
Switch item=garage_current label="Garage Current" mappings=["OPEN"="OPEN", "OPENING"="OPENING", "CLOSED"="CLOSED", "CLOSING"="CLOSING",  "STOPPED"="STOPPED"]

Are you sure? The compiler says: The item of CurrentDoorState has to be CLOSE instead of CLOSED. On the official site Homekit Addon it is also mentioned as CLOSED. Could that be an error?

it was a bug/typo in the implementation. it was fixed 3 days with this commit

depending on which version you have you need to use “CLOSE” or “CLOSED”.
however, this mapping is configurable.
you can add this line to homekit.cfg to make your mapping, e.g. to “CL” instead of “CLOSE/CLOSED”
doorCurrentStateClosed="CL"

here are the all names for mapping

doorCurrentStateOpen = "OPEN"
doorCurrentStateOpening = "OPENING"
doorCurrentStateClosed = "CLOSED"
doorCurrentStateClosing = "CLOSING"
doorCurrentStateStopped = "STOPPED"
doorTargetStateClosed = "CLOSED"
doorTargetStateOpen = "OPEN"
1 Like

Hi eugen @yfre,
I’ve got the On Characteristic working. I’ve found the solution in another thread. I completly commented the thing (Group and all Items) out and in, than it works.
Now I have the next problem, hope you can help.
My device I want to include into homekit is an Aeotec LED Stripe ZW121.
I have a

  • Dimmer for Brightness (0-100%)
  • Switch for On/Off
  • Color
  • Dimmer for White Color (0 (cold) - 100% (warm))

I can create a rule to convert the temperature Item from dimmer (0-100) to number (-50 - 400). But the documentation says, I should never use color and color temperatur in combination with hsb.

What is the best way to bring the device into homekit?

Edit: not tested, but I think I need a proxy Item (Color) and expose this to homekit. In a rule I need to split it into the temperature dimmer in case it is white and color in other cases.

the limitation is from Apple. apple writes in the spec

Color Temperature
This characteristic describes color temperature which is represented in reciprocal megaKelvin (MK-1) or mirek scale. (M = 1,000,000 / K where M is the desired mirek value and K is temperature in Kelvin). If this characteristic is included in the ”8.23 Light Bulb” (page 147), ”9.44 Hue” (page 179) and ”9.82 Saturation” (page 197) must not be included as optional characteristics in ”8.23 Light Bulb” (page 147). This characteristic must
not be used for lamps which support color.

this limitation is however not enforced by homekit binding, i.e. you can try it out and add Color Temperature, Hue and Brightness to the same accessory. Maybe it will work in home app. if not, i would split this one device in 2 different “lighting” accessories: one with Hue and brightness and another one with Color Temperature.

Hi eugen,
can’t get it to work.

Group ledStripe "Aeotec LED Stripe" {homekit="Lighting"}
Switch ledStripeSwitch "Schalter" (ledStripe) {homekit="Lighting.OnState"}
Color ledStripeProxyColor (ledStripe) {homekit="Lighting.Hue, Lighting.Brightness, Lighting.Saturation"}
openhab> homekit printAccessory 1189018796
1189018796 Aeotec LED Stripe
Services:
    Service Type: 00000043-0000-1000-8000-0026BB765291
    Characteristics:
      : class io.github.hapjava.characteristics.impl.common.OnCharacteristic
      : class io.github.hapjava.characteristics.impl.lightbulb.HueCharacteristic
      : class io.github.hapjava.characteristics.impl.lightbulb.BrightnessCharacteristic
      : class io.github.hapjava.characteristics.impl.lightbulb.SaturationCharacteristic

This seems to be ok.
I’ve no linking to any “real” thing. On/Off and Dimming works as aspected. But choosing color is strange.

ezgif.com-video-to-gif

If I choose a color, the Item in background change also. But when I pull up my finger from the color chooser, the “bubble” jumps to an other position (the fullcolor position).

According to the documentation I tried also 3 Dimmer-Items, each for Hue, Saturation und Brightness, but it throws a error message, it is not supported.

Thanks for your help again,
Daniel

i can confirm: your configuration is correct and i could reproduce your issue. it does not happen always but time to time.

it is an issue in the implementation of the binding. i have an idea to fix it but not sure whether it is a correct fix. so, opened a question in the developer channel.

thank you
it works with your sitemap,
but how do i do it when i have two items in openhab
open and close garage door
and one item for the state open and closed

it depends on your setup. i have a garage motor, which get “targetState”, and i have “contactSensor”, which is the current state.

if you dont have contact sensor that reports the door status, then you can have a rule which get triggered by TargetState changes sets currentState = CLOSING/OPENING and after sometime currentState=CLOSED/OPEN

1 Like

That is correct, I personally use the described setup, and as for the timing just time how long you door takes to open and use that.

I’m an happy user of the Homekit plugin, everything I control in OpenHAB is done through the homekit app and it’s getting more stable and more extended.

One question, I have some doorsensors on batteries and I’ve implemented the batterylow (created a rule when percentage is below 15% then set this to true, but I was wondering, will the batterypercentage also come to the plugin, so that I can see the percentage in homekit?
As far as I can see this isn’t supported yet.

But again, it is already a great plugin :+1:

it will come but it will take some time.

according to apple specification:

  • battery percentage is a separate service in homekit specification.
  • one can combine several services combined to one accessory, e.g. doorsensor + batteryservice, or heater + fan.

however, the library we use for homekit binding does not support this. it only supports one service per accessory. first proposals how to add this supports are already there, but it will take some time to merge them, test them and add support in OH binding.

1 Like

hi Roel,

to avoid the limitions in the HomeKit plugin and limitions in HomeKit itself + the fact there isn’t support for all devices running on batteries, I also use a rule - it runs every day at noon to check the batt-low threshold of all devices running on batteries. An exception mail is dropped when a device gets in batt-low state.
This keeps the item creation for homekit less complex and your icons in HomeKit are not overloaded with additional information.

Hey guys, first of all: Thanks a lot for your great work!

Are there any news on this topic regarding battery percentage?

Hi Frank,

no, no updates from my side. not sure whether anyone else looking into it.

if i get some time again to do some development then this would be the first feature i would do. i would love to have myself as well.