openHAB 2 Homekit Integration Java exception

Hi openHAB community,

i installed openHAB on a virtual ubuntu server while waiting for my Pine64 to arrive. Just to play a little…

I updated everything to the newest version and installed Oracle Java 1.8.0_91.

Then installed the openhab2-offline package with apt-get.

openHAB is starting and i activated the Max binding - working fine - my devices show up in inbox…

After the devices showed up in the UI, i tried to connect my iPhone with the Homekit integration, but openHAB won’t show up. I didn’t change anything in Homekit settings. After some "google"ing i found the following in openhab.log:

[ERROR] [org.openhab.io.homekit ] - [org.openhab.homekit(149)] The modified method has thrown an exception java.lang.NumberFormatException: For input string: “9124.0”
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)[:1.8.0_91]
at java.lang.Integer.parseInt(Integer.java:580)[:1.8.0_91]
at java.lang.Integer.parseInt(Integer.java:615)[:1.8.0_91]
at org.openhab.io.homekit.internal.HomekitSettings.fill(HomekitSettings.java:46)
at org.openhab.io.homekit.internal.HomekitImpl.modified(HomekitImpl.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_91]
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeModifiedMethod(SingleComponentManager.java:729)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.modify(SingleComponentManager.java:684)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:602)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:566)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:419)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.config.ConfigurationSupport.configurationEvent(ConfigurationSupport.java:315)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2046)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2014)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:143)[7:org.apache.felix.configadmin:1.8.8]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:110)[7:org.apache.felix.configadmin:1.8.8]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_91]

Changing the Port in the configuration changes the error only from "…For input string: “9124.0” to eg "…For input string: “9125.0”.

Did i miss something?

Is there any additional configuration to be done to get Homekit integration to work?

Thanks for your help
Jens

what iOS app are you using to “discover” the openhab instance (running homekit)? Change the port back to the default and pull down an app like Hesperus on the App store. You’ll discover and pair homekit through Hesperus and, after that, should be able to use Siri to control your switches, lights, etc. You can also use Hesperus to view temp/hum and actuate relays and switches from your openHAB instance.

Hi Nick,

i am trying to discover openHAB with iOS 10. I did see openHAB once but i could not connect. Then i found that error in “openhab.log” logfile. Now it won’t even show up in homekit app.

I did not change the port in the first place, this was only to see if the error is somewhat related to the port setting or if it’s just coincidence. And i thought there might be a typo in the default port setting as a TCP/UDP port is not a decimal value.

But as using “9125” gave the same error in the logfile i reverted to “9124”.

I will try another homekit app later, but as there is a java exception when starting the homekit service, i guess homekit integration is not working correctly.

Ah, ok. So I referenced my homekit.cfg file and discovered I’m using port 9124. I believe it was the default port entered when loading the binding. Have you tried 9124?

Ahh, sorry typo on my side it was always 9124 not 9024…the exception i postet has 9124, too…i’ll correct the typo’s, sorry

i found a sloution:

the file " /var/lib/openhab2/cache/org.eclipse.osgi/7/data/config/org/openhab/homekit.config" contains the homkit configuration, and there you can see the port value is “9124.0”

networkInterface="192.168.0.57"
pin="031-45-154"
port="9124.0"
service.pid="org.openhab.homekit"
thermostatAutoMode="Auto"
thermostatCoolMode="CoolOn"
thermostatHeatMode="HeatlOn"
thermostatOffMode=“Off"
useFahrenheitTemperature=B"false”

When i change the port value within the file to a non decimal value the exception is gone - have to check homekit functionality later, when i am at home…

When i change the value with the configuartion dialog again, the the value is decimal again… so it seems there is a bug with the configuration dialog the puts the port value as a decimal value into the configuration file.

I finally found an already open issus for it… https://github.com/eclipse/smarthome/issues/1692