HomeKit: support for additional accessory types

@beowulfe I did some testing with your homekit binding. First thanks a lot for the great work. I’m especially interested in controlling my rollershutters with it. The problem is, that the current state (opened / closed) is inverted for homekit. Completely opened shutters are shown as closed in homekit (on my iPhone) an vice versa.
I did some debugging in openhab. The opened state is represented as PercentValue/BigDecimal with value “0” in openhab. This is propagated as 0 to homekit (in the response json).
In Apples Homekit documentation for the target position characteristics they say that 0 is maximum light (https://developer.apple.com/documentation/homekit/hmcharacteristictypetargetposition). For the current position characteristics (which is queried here) there is no such documentation. For me it looks like 0 is interpreted “0% opened” for the current position characteristics.
I did a short check and inverted the value of the opened shutter from 0 to 100 in the debugger. As expected, the covering is presented as opened on my iOS device

I created a small patch, which inverts the window covering position (-> 100 - x). No everthing is working correct for me.

Could test the prerelease too and discovered the same issue. Can you share your patch?

Thanks again! :wink:
Michael

Yes, I you may download it here: https://github.com/maihacke/openhab2/releases/download/2.2.0-20180107/org.openhab.io.homekit-2.2.0-SNAPSHOT.jar

Just replace this with the jar in your addons folder and restart openhab

1 Like

Wow, christmas again! Thanks a lot!

Wow, how did you guys know about this one? I completely missed this and just moved over everything to node red to support windows, doors and window coverings.

Hi All,

I have installed the new homekit addon to my Openhab 2.3 release but when I pair my iPhone with openhab the rollershutters do not show up in the list of items (only my switches). I added the [ “Rollershutter” ] in my item file which looks like this:

Rollershutter VR1_FF_Salon “VR1 Salon” (FF_Salon) [ “Rollershutter” ] { mochadx10=“l10:pl” }

Do I need to change something?

Thanks for your help

The Tag has to be “Blinds”:

Rollershutter VR1_FF_Salon “VR1 Salon” (FF_Salon) [ “Blinds” ] { mochadx10=“l10:pl” }

1 Like

Thanks Simon,

I changed my item definition using [ “Blinds” ] but I still do not see my rollershutters in the iPhone app.
My previous items (switch, lights) are still there and working.
Is there some additionnal setup needed elsewhere?

In the log file, when restarting openhab2, I get the following error (2nd line and following) which may be the reason why Blinds are not listed:

2018-01-11 21:36:17.840 [WARN ] [homekit.internal.HomekitAuthInfoImpl] - Could not find existing MAC in org.eclipse.smarthome.storage.json.internal.JsonStorage. Generating new MAC. This will require re-pairing of iOS devices.
2018-01-11 21:36:19.214 [ERROR] [nhab.io.homekit.internal.HomekitImpl] - Could not initialize homekit: null
java.lang.NullPointerException: null
at com.beowulfe.hap.impl.http.impl.HomekitHttpServer.resetConnections(HomekitHttpServer.java:38) ~[?:?]
at com.beowulfe.hap.HomekitRoot.addAccessorySkipRangeCheck(HomekitRoot.java:74) ~[?:?]
at com.beowulfe.hap.HomekitRoot.addAccessory(HomekitRoot.java:61) ~[?:?]
at org.openhab.io.homekit.internal.OpenhabHomekitBridge.addAccessory(OpenhabHomekitBridge.java:76) ~[?:?]
at org.openhab.io.homekit.internal.HomekitAccessoryRegistry.lambda$0(HomekitAccessoryRegistry.java:62) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
at org.openhab.io.homekit.internal.HomekitAccessoryRegistry.setBridge(HomekitAccessoryRegistry.java:62) ~[?:?]
at org.openhab.io.homekit.internal.HomekitChangeListener.setBridge(HomekitChangeListener.java:71) ~[?:?]
at org.openhab.io.homekit.internal.HomekitImpl.start(HomekitImpl.java:88) ~[?:?]
at org.openhab.io.homekit.internal.HomekitImpl.modified(HomekitImpl.java:57) ~[?:?]
at org.openhab.io.homekit.internal.HomekitImpl.activate(HomekitImpl.java:45) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:229) ~[?:?]
at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) ~[?:?]
at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:650) ~[?:?]
at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:506) ~[?:?]
at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:307) ~[?:?]
at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:299) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:298) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:109) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879) ~[?:?]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:496) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461) ~[?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:619) ~[?:?]
at com.eclipsesource.jaxrs.publisher.internal.ResourceTracker.addingService(ResourceTracker.java:39) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109) ~[?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915) ~[?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) ~[?:?]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127) ~[?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225) ~[?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464) ~[?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:887) ~[?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:874) ~[?:?]
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:132) ~[?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:941) ~[?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:741) ~[?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:675) ~[?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:430) ~[?:?]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:657) ~[?:?]
at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:341) ~[?:?]
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:390) ~[?:?]
at org.apache.felix.scr.impl.Activator.access$200(Activator.java:54) ~[?:?]
at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:265) ~[?:?]
at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:254) ~[?:?]
at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:227) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) ~[?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:903) ~[?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) ~[?:?]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:156) ~[?:?]
at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) ~[?:?]
at org.eclipse.osgi.container.Module.start(Module.java:467) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1361) ~[?:?]
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:888) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1248) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$1(FeaturesServiceImpl.java:1147) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

Does anyone have a clue on the problem? I have tried to activate more trace but not getting more.

Kind regards

how do I install this? I’m using the latest snapshot 2.3 of the openhabian on a RPi. Homekit is already installed an works for “Lighting” and “Switches” quite ok. The “addons” folder (via samba share) is empty. I didn’t also find a .jar with “homekit” in the name. Just placing your .jar in the addons folder didn’t do the trick :frowning:

I think you have to uninstall the official release first and then put the patched version into the addons folder.

Did you uninstall the official release before?

it worked after uninstalling the official release. The app unfortunately lost the arrangements. I think it didn’t in the first round, when always a homekit binding was available (the official one or the pached one in the addons folder).

I think So. I went to karaf to unload the existing one, then copied the jar and restarted.

Since yesterday, I cannot start OH any more. I updated to the last snapshot thinking it might help and since then when I try to restart OH I only get openhab.log filled in with:
2018-01-13 23:28:04.275 [WARN ] [org.jline ] - Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)

I spent many hours last night trying to fix this without success. maybe I should go back to release 2.2 but I do not know exactly how to proceed and I really need to get some sleep.

I‘m using 2.2 maybe there is some incompatibility with 2.3

so, are blinds working now with OH2.2 when using the @maihacke release from github?

Using it for several weeks now without any problems

Yes, that‘s true! I could install in the meantime, Great work!

Hi! I successfully added my blind to homekit using your linked version of the addon.
org.openhab.io.homekit-2.2.0-SNAPSHOT
I downloaded it from your link @ mailhacke but my rollershutter is inverted (open is closed and vice versa) now :wink:
Can you tell me, where to edit the file or did i download the wrong file?

I added the 2.2.0 snapshot with rollershutter support to my dev system and I noticed that I can not pause the blinds. The open/close works fine as well of the % that is displayed with the expection of it being inverted. Is this expected Homekit behavior or a limitation of the addon that I can not pause it or ask siri to open them 50%?