openhab-addons: [mihome] Bridge uninitialized after reboot + NPE

I’m experiencing a weird behavior of the Xiaomi MiHome binding. After reboot I noticed that my setup doesn’t respond. My setup has a textual config aligned the same way described in the docs of this binding

Expected Behavior

The binding should work properly.

Current Behavior

My sensors are “UNINITIALIZED” whereas the gateway has “UNINITIALIZED - BRIDGE_UNINITIALIZED” status.

Here’s the Null Pointer Exception:

2017-07-09 20:20:56.805 [ThingAddedEvent           ] - Thing 'mihome:bridge:f0b42XXXXXX' has been added.
2017-07-09 20:20:56.839 [hingStatusInfoChangedEvent] - 'mihome:bridge:f0b42XXXXXX' changed from UNINITIALIZED to INITIALIZING
2017-07-09 20:20:56.859 [hingStatusInfoChangedEvent] - 'mihome:bridge:f0b42XXXXXX' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
==> /var/log/openhab2/openhab.log <==
2017-07-09 20:20:56.857 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'mihome:bridge:f0b42XXXXXX': java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)[:1.8.0_121]
	at java.util.concurrent.FutureTask.get(FutureTask.java:206)[:1.8.0_121]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)
	at org.eclipse.smarthome.core.thing.internal.ThingManager.doInitializeHandler(ThingManager.java:738)
	at org.eclipse.smarthome.core.thing.internal.ThingManager.initializeHandler(ThingManager.java:664)
	at org.eclipse.smarthome.core.thing.internal.ThingManager.access$12(ThingManager.java:639)
	at org.eclipse.smarthome.core.thing.internal.ThingManager$2.apply(ThingManager.java:681)
	at org.eclipse.smarthome.core.thing.internal.ThingManager$2.apply(ThingManager.java:1)
	at org.eclipse.smarthome.config.core.BundleProcessorVetoManager.applyActionFor(BundleProcessorVetoManager.java:124)[98:org.eclipse.smarthome.config.core:0.9.0.201706270841]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.registerAndInitializeHandler(ThingManager.java:1016)
	at org.eclipse.smarthome.core.thing.internal.ThingManager.thingAdded(ThingManager.java:464)
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:212)
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutAddedElement(ThingRegistryImpl.java:131)
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutAddedElement(ThingRegistryImpl.java:1)
	at org.eclipse.smarthome.core.common.registry.AbstractRegistry.added(AbstractRegistry.java:126)[102:org.eclipse.smarthome.core:0.9.0.201706270841]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:51)[102:org.eclipse.smarthome.core:0.9.0.201706270841]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:70)[102:org.eclipse.smarthome.core:0.9.0.201706270841]
	at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutAddedElement(AbstractProvider.java:74)[102:org.eclipse.smarthome.core:0.9.0.201706270841]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.lambda$18(GenericThingProvider.java:984)[137:org.eclipse.smarthome.model.thing:0.9.0.201706270841]
	at java.util.ArrayList.forEach(ArrayList.java:1251)[:1.8.0_121]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModelForThingHandlerFactory(GenericThingProvider.java:987)[137:org.eclipse.smarthome.model.thing:0.9.0.201706270841]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.access$1(GenericThingProvider.java:950)[137:org.eclipse.smarthome.model.thing:0.9.0.201706270841]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.lambda$0(GenericThingProvider.java:234)[137:org.eclipse.smarthome.model.thing:0.9.0.201706270841]
	at java.util.concurrent.ConcurrentHashMap$KeySetView.forEach(ConcurrentHashMap.java:4649)[:1.8.0_121]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.apply(GenericThingProvider.java:236)[137:org.eclipse.smarthome.model.thing:0.9.0.201706270841]
	at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.apply(GenericThingProvider.java:1)[137:org.eclipse.smarthome.model.thing:0.9.0.201706270841]
	at org.eclipse.smarthome.config.core.BundleProcessorVetoManager.bundleFinished(BundleProcessorVetoManager.java:68)[98:org.eclipse.smarthome.config.core:0.9.0.201706270841]
	at org.eclipse.smarthome.config.xml.osgi.AbstractAsyncBundleProcessor.informListeners(AbstractAsyncBundleProcessor.java:253)[101:org.eclipse.smarthome.config.xml:0.9.0.201706270841]
	at org.eclipse.smarthome.config.xml.osgi.AbstractAsyncBundleProcessor.access$3(AbstractAsyncBundleProcessor.java:251)[101:org.eclipse.smarthome.config.xml:0.9.0.201706270841]
	at org.eclipse.smarthome.config.xml.osgi.AbstractAsyncBundleProcessor$1.run(AbstractAsyncBundleProcessor.java:242)[101:org.eclipse.smarthome.config.xml:0.9.0.201706270841]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: java.lang.NullPointerException
	at org.openhab.binding.mihome.internal.socket.XiaomiBridgeSocket.setupSocket(XiaomiBridgeSocket.java:45)[212:org.openhab.binding.mihome:2.2.0.201707082234]
	at org.openhab.binding.mihome.internal.socket.XiaomiSocket.<init>(XiaomiSocket.java:68)[212:org.openhab.binding.mihome:2.2.0.201707082234]
	at org.openhab.binding.mihome.internal.socket.XiaomiBridgeSocket.<init>(XiaomiBridgeSocket.java:30)[212:org.openhab.binding.mihome:2.2.0.201707082234]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.initialize(XiaomiBridgeHandler.java:100)[212:org.openhab.binding.mihome:2.2.0.201707082234]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$9.call(ThingManager.java:741)[109:org.eclipse.smarthome.core.thing:0.9.0.201706270841]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$9.call(ThingManager.java:1)[109:org.eclipse.smarthome.core.thing:0.9.0.201706270841]
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[102:org.eclipse.smarthome.core:0.9.0.201706270841]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	... 1 more
==> /var/log/openhab2/events.log <==
2017-07-09 20:20:56.927 [ThingAddedEvent           ] - Thing 'mihome:gateway:f0b42XXXXXX' has been added.
2017-07-09 20:20:56.931 [hingStatusInfoChangedEvent] - 'mihome:gateway:f0b42XXXXXX' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2017-07-09 20:20:56.934 [ThingAddedEvent           ] - Thing 'mihome:86sw2:158d00012a7bb4' has been added.
2017-07-09 20:20:56.937 [hingStatusInfoChangedEvent] - 'mihome:86sw2:158d00012a7bb4' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)
2017-07-09 20:20:56.939 [ThingAddedEvent           ] - Thing 'mihome:sensor_switch:158d00013f9a48' has been added.

Your Environment

  • Version used: openHAB 2.2.0~20170709011141-1 (Build #982)
  • Environment name and version (e.g. Chrome 39, node.js 5.4, Java 8, …): Raspberry PI 3 with latest openHABian

CC: @pboos @tavalin @dimalo @CoolWombat

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Alright, hope the build system will produce the same outcome. Thanks everyone for testing. I’m quite limited at the moment…

implemented like @martinvw suggested…