Homekit/iOS pairing is not possible: NullPointerException

I installed OpenHab 2.0.0 (Release Build) on a Debian Jessie board (A20-OLinuXino-Lime2)

I try to pair from an iOS device using Homekit and get a NullPointerException error:

17:47:46.096 [ERROR] [lfe.hap.impl.connections.HttpSession] - Could not handle request
java.lang.NullPointerException
    at com.beowulfe.hap.characteristics.FloatCharacteristic.getValue(FloatCharacteristic.java:72)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.characteristics.BaseCharacteristic.makeBuilder(BaseCharacteristic.java:71)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.characteristics.FloatCharacteristic.makeBuilder(FloatCharacteristic.java:48)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.characteristics.BaseCharacteristic.toJson(BaseCharacteristic.java:61)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.json.AccessoryController.toJson(AccessoryController.java:73)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.json.AccessoryController.listing(AccessoryController.java:39)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.connections.HttpSession.handleAuthenticatedRequest(HttpSession.java:70)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.connections.ConnectionImpl.doHandleRequest(ConnectionImpl.java:51)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.connections.ConnectionImpl.handleRequest(ConnectionImpl.java:46)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:47)[211:org.openhab.io.homekit:2.0.0]
    at com.beowulfe.hap.impl.http.impl.AccessoryHandler.channelRead0(AccessoryHandler.java:15)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:32)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:299)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:36)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)[211:org.openhab.io.homekit:2.0.0]
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)[211:org.openhab.io.homekit:2.0.0]
    at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

The same configuration was working with openhab2 Beta4. I test with Beta5 and I got the same error.

Re-installing the beta4 after beta5 solved the problem.

Should I rollback from “Release Build” to beta4 to get something that works ?

What could I try else ?

Check if all of the Homekit items are not NULL.
If any Homekit item is NULL, the Homekit addon fails to work (at least on my setup).

Thank you for your reply, it actually worked

I commented out the following items and the pairing succeeded.

I think this is a bug: a comprehensive error message should be raised instead of that NullPointerException. I will file a bug on the project’s GitHub page

/* HUE HOMEBRIDGE */
Color Hue_Spot1      "Hue 1"       [ "Lighting" ]
Color Hue_Spot2      "Hue 2"       [ "Lighting" ]
Color Hue_Spot3      "Hue 3"       [ "Lighting" ]

The problem is that I don’t know how to make these 1st generation Philips Hue work without binding in openhab2 (as openhab2 integrates Hue support). I will investigate

I have worked this issue around by making a rule: «when System started then sendCommand(itemName,“0,0,0”) but I don’t know if hue items work the same way.

Thanks a lot for this information :slight_smile:

I wrote a rule to do this and it is effectively working.

Here is the rule as I wrote it for one of the items:

rule "Initialize Philips Hue"
when 
        System started 
then 
        logInfo( "Initializer", "Started Timer ...")
        createTimer(now.plusSeconds(45)) [|     
                logInfo( "Initializer", "Initializing...")
                
                sendCommand("Hue_Spot1","0,0,0")
                logInfo( "Initializer", "")
        ]
        
end

I did not automate the sendCommand for each Hue_SpotX. A copy/paste is enough for me but I believe it can be automated, based e.g. on the itemName