[SOLVED] OH2.2: NullPointer in ComfoAir binding

Windows 64 bit

Dear all

I get continuously the following NPE with the ComfoAir binding. Any ideas how to resolve this?

03-Jan-2018 11:56:13.498 [WARN ] [org.apache.karaf.services.eventadmin              ] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/Lueftung_Control] {bridgemarker=true, item=Lueftung_Control, command=0} | {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={event.topics=openhab/*, service.pid=org.openhab.comfoair, component.name=org.openhab.binding.comfoair, component.id=235, service.id=369, service.bundleid=235, service.scope=bundle} | Bundle(org.openhab.binding.comfoair_1.11.0 [235])]
java.lang.NullPointerException: null
	at org.openhab.binding.comfoair.handling.ComfoAirCommandType.getChangeCommand(ComfoAirCommandType.java:393) [235:org.openhab.binding.comfoair:1.11.0]
	at org.openhab.binding.comfoair.internal.ComfoAirBinding.internalReceiveCommand(ComfoAirBinding.java:118) [235:org.openhab.binding.comfoair:1.11.0]
	at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:94) [200:org.openhab.core.compat1x:2.2.0]
	at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:45) [200:org.openhab.core.compat1x:2.2.0]
	at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415) [3:org.apache.karaf.services.eventadmin:4.1.3]
	at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutBlacklistTiming(HandlerTask.java:82) [3:org.apache.karaf.services.eventadmin:4.1.3]
	at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:104) [3:org.apache.karaf.services.eventadmin:4.1.3]
	at org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:166) [3:org.apache.karaf.services.eventadmin:4.1.3]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
	at java.lang.Thread.run(Unknown Source) [?:?]

Thanks & regards

The NullPointerException is definitely a defect, but what’s causing it is the question.

The cause could be a configuration issue or magic.
No way to know without more information.

How can I provide more information?

By the way: this NPE is reported in log as WARN but it should be ERROR, right?

For a start, you need to show your comfoair binding configuration and any items that are defined for it.

That might be sufficient. Usually it helps to grab a debug log and post that.

No, the convention in OH is that bindings should generally not log to the ERROR level.

I found the root cause, it was a driver problem and a typo in the item configuration:



Pay attention to the < in front of fan_level --> this must not be there. I had this typo in all of my items, most likely this was made by copying from somewhere.



Just for documentation purposes: I’m using the binding from OH 1.8.3 and a USB-RS232-adapter with profilic chipset but very old driver (v3.2.0.0) - newer driver do not work with Windows 10 64 bit.

My comfoair.cfg looks like that:

# Serial port of the Zehnder ComfoAir to connect to

# refresh interval in milliseconds (optional, defaults to 60000)