Announcing some improvements to the Homekit plugin for openHAB 2

I’m VERY new to OpenHAB2. I started exploring OpenHAB2 and Homebridge.IO because I have an existing Home Tech infrastructure that I couldn’t justify abandoning. My lighting is UPB and my "alarm (slash, existing automation system) is HAI/Leviton OmniPro2. All I really needed was something that would expose all the HAI elements to Homekit (since the lighting is already in there). I thought about going UPB Direct in OpenHAB2, but there are some automation elements still within the Omni I haven’t learned how to duplicate yet on OpenHAB2 so I really just wanted to leave them, besides motion-based lights may respond quicker if I leave them on the system that’s aware of everything (the Omni).

Your plugin appears to be exactly what I’ve been looking for to act as a Homekit bridge for the Omni Lighting and Omni Security, but I’m having a heck of a time even getting it functional. I can get it to broadcast on the network for initial pairing, but after I try to pair, it seems to die, the phone ultimately saying it can’t pair with the accessory and in order to get it to broadcast again, I have to restart the OpenHAB2 service (sometimes also clear pairings). I’m also having a hard time understanding the tags and how/where to place them. I was going to load the latest release of the Homekit plugin, but also have no idea how to upgrade it from the CLI (since the version I got - 2.4.0 - was from the plugin store).

Could someone provide some guidance on how to upgrade to the latest version? Could someone also tell me how those tags work?

Thanks.

Yes, setting it up is a bit hard. And i don’t think you would see anything usefull in the logs when the tagging is set wrong.
Are you using tekst based config ? If so, i would suggest to remove all placed tags and just tag one item say a switchable light:

//["Switchable"] is the actual tag
Switch	light-item "Light"    <light>	(_lightsGroup)	["Switchable"]

If you have this setup, clear any existing pairings. Restart openHAB. Start pair and watch it work (or not)
If that doesn’t work, verify the Phone and the host running openHAB are on the same network/subnet and no firewall is blocking. if possible set the binding in debug mode and do it over again.

If not allready done, please check HomeKit Add-on - System Integrations | openHAB

I just re-read your post, you are on 2.4.0. A lot of work has been done to the homekit plugin afterwards, i suggest you to upgrade to 2.5.0 M2. How to upgrade depends on your host os, more details: Installation Overview | openHAB

I don’t believe I’m using a text based config - I haven’t manipulated any text files, except during troubleshooting. I wasn’t finding where to add the tags to items (PaperUI doesn’t seem to have a field), so I loaded HABMin, which seems to offer a tag field, but I’ve had some issues with my Omni module (can no longer find the v2 one), so it doesn’t let me save my edit to a test light source (comes back with “Error saving Light Level - Undefined”. So now I can’t add the tag “Lighting” to the switch. Sigh.

Oh, and this is OpenHABian. Image written last week. Sure enough, it says 2.4.0-1 but when I run the OpenHABian-config tool and tell it to upgrade all modules to latest, it basically says everything already is (as it runs through the script). Didn’t find at that link how to upgrade to 2.5.0M2. Ah, just found it in the config tool “latest milestone testing version”. Unfortunately, that version likes to crash a few seconds after it starts each time so I’m going to have to roll it back:

Aug 18 14:22:42 openhab systemd[1]: Started openHAB 2 - empowering the smart home.
[14:22:45] openhabian@openhab:~$ sudo service openhab2 status
● openhab2.service - openHAB 2 - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab2.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2019-08-18 14:22:57 EDT; 1s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 2050 ExecStart=/usr/share/openhab2/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=255/EXCEPTION)
 Main PID: 2050 (code=exited, status=255/EXCEPTION)

And now rolling back to 2.4.0 didn’t help (Does the same crashing thing), so I’ve moved it back to 2.5 since it’s dead anyway. Maybe it can be resurrected.

Seems to be where it’s failing, but could be wrong:

   CGroup: /system.slice/openhab2.service
           ├─13323 /bin/sh /usr/share/openhab2/runtime/bin/karaf daemon
           ├─13344 /bin/sh /usr/share/openhab2/runtime/bin/karaf daemon
           ├─13345 /bin/sh /usr/share/openhab2/runtime/bin/karaf daemon
           ├─13346 /bin/sh /usr/share/openhab2/runtime/bin/karaf daemon
           └─13353 expr /opt/jdk/zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf/bin/java : /.*

Phone and HAB are on the same VLAN, so Firewall is irrelevant. :frowning:

When you browse to the root http://hostname:8080/ you can select the UI you want to use. On that same screen you would see the openHAB build number at the bottom.

If you look in openhab.log you should see the reason of the crash.

Web server isn’t responding - no GUI accessible, even at root. Here’s the last batch of entries in the log…

2019-08-18 15:34:47.176 [SEVERE] [org.apache.karaf.main.Main] - Could not launch framework
java.lang.RuntimeException: Error initializing storage.
	at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:70)
	at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
	at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
	at org.apache.karaf.main.Main.launch(Main.java:256)
	at org.apache.karaf.main.Main.main(Main.java:178)
Caused by: java.io.IOException: Unable to create lock manager.
	at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:698)
	at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1776)
	at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1793)
	at org.eclipse.osgi.storage.Storage.<init>(Storage.java:132)
	at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:85)
	at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:68)
	... 4 more

Something wrong with the write permissions i think because of:
java.io.IOException: Unable to create lock manager.

If you just started and there is nothing that needs to be saved, i think it is better to get a fresh install of openhabian from here: Download openHAB | openHAB

Another possiblitiy is to check and fix the write permissions, but that might get complicated and who knows what went wrong because this should never happen with a openhabian installation. Anywat, this has nothing to do with the homekit binding, so if it remains an issue, i woudl suggest to open another topic.

Did you also include the SecuritySystem made by @ccutrer in the merge? - I have used the SecuritySystem now for 3 months, and it works great. More info here, where he also provides updated guides and examples.

No, I don’t think so. Maybe @ccutrer can implement that. I promise to review that ASAP.

This particular pull request did not include the SecuritySystem, because that depends on updates to the underlying HAP-java library which haven’t been accepted yet. My bundle that supports SecuritySystem also has a custom built HAP-java embedded in it.

Thanks for the update. The Security System is really great. @ccutrer : what do you suggest as next step to get it generally available?

I have been using nearly all accessory types from your private branch in 3 months in OH 2.4 and they work fine as in the current Homekit binding. I do get some errors in log though.

@J-N-K offered to review asap - that might help for next step.

As was suggested, I loaded the latest milestone, and sure enough, all is well. I even added another light after the fact and it was auto added to the “default room” in Homekit.

Thank you, all.

@Tim_Harper I’ve updated to the latest version and find that my contact items are now missing from homekit. Weren’t those changes merged?

edit: or @ccutrer are these changes on your branch now?

Yes, the branch at https://github.com/ccutrer/openhab2-addons/releases/tag/2.5.0-cody2 has contact items, and also works with iOS 13. I have not run it with the latest 2.5.0-SNAPSHOT, so no guarantees it will work with it.

@ccutrer this one works, thanks a lot!

1 Like

Is there any reason to not contribute these changed to the main repo?

I fully intend to, plus many more improvements I have in mind. I’m just going 110% on some pretty big home projects that need finished before winter, and I simply don’t have time. Hopefully come December-ish things calm down, and I can get lots done on automation stuff.

1 Like

Let me know if I can help in any way. I would like to get homekit working again until 2.5 is released (which is not fixed yet).

I’ve merged the two iOS 13-fixing commits into HAP-Java. If you could work on getting that released and then updated in OpenHAB, that should be the highest priority. It won’t get some of the new features that people are clamoring for, but it will get it working. As it stands now, HomeKit is essentially unusable with openhab master and iOS 13.

3 Likes

Hi Cody, thanks a lot for your contribution. I’ve been working with the Homekit addon integrated in latest milestone (2.5.0.M4), but the mayor missing for me was the security implementation. This works perfect in your version of the binding.
I’ve tried the IOS13 version which gave errors about missing info, so I took the org.openhab.io.homekit-2.5.0-SNAPSHOT.jar which worked immediately. Looking forward to see your addons embedded in the milestones; thanks again!
(still running IOS12 on almost all devices, only GF decided to update recently but haven’t checked if her phone works with the binding now.)
Edit: checked on GF phone (SE iOS 13) and HomeKit seems to work fine.

Can org.openhab.io.homekit-2.5.0-SNAPSHOT-ios13.jar work on Openhab 2.4 ? Right now I get /org.openhab.io.homekit-2.5.0-SNAPSHOT-ios13.jar does not have a META-INF/MANIFEST.MF! Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR! Or is there a jar with security system implemented that I could use on 2.4?