Hi - I have a Xiaomi gateway with a few zigbee smart sockets and temperature sensors. I can see all of the items (discovered via Paper UI) in the console as well as the updated values from power consumption and temperature.
However whenever I try and send a command to a device i.e. toggle power via a switch I receive a Null Pointer exception in openHAB. I don’t not have any other errors. I have provided the developer key to the gateway configuration.
Any ideas?
2017-12-18 23:34:05.811 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling handler: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.thing.internal.ThingManager.receiveCommand(ThingManager.java:374)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:47)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:192)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[98:org.eclipse.smarthome.core:0.9.0.b5]
at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.8.0_151]
at java.lang.Thread.run(Unknown Source)[:1.8.0_151]
Caused by: java.lang.NullPointerException
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.toJsonValue(XiaomiBridgeHandler.java:319)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:257)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:239)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToDevice(XiaomiBridgeHandler.java:266)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiActorPlugHandler.execute(XiaomiActorPlugHandler.java:42)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:97)[185:org.openhab.binding.mihome:2.1.0]
at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:377)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:1)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218)[98:org.eclipse.smarthome.core:0.9.0.b5]
... 12 more
Thanks Simon - I installed the binding and discovered/created the items using Paper UI so I cant see the .items/.things in the usual openHAB/config location.
Should I delete them and try creating them manually?
Hi All, now that the holiday season is over I can add some more detail to this post. It looks to me that the toggle command (ON/OFF) is sent successfully, but the logs show that as soon as the command is sent in the event log the Null Point error occurs on the server - see 14:10:24.449 .
Any ideas of how or where to troubleshoot? Currently I can see the values for the Xiaomi devices i.e. status / power consumption with no issues in OpenHab, I even have persistence working to graph the consumption over time. The only sticky point is I cant send commands.
Below are the logs from my event and OpenHab files;
Event Logs
2018-01-08 14:10:24.449 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command OFF
2018-01-08 14:10:24.460 [ItemStateChangedEvent ] - mihome_sensor_plug_158d0001debc5b_power changed from ON to OFF
2018-01-08 14:10:36.196 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:36.199 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:36.203 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:36.311 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:38.970 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:38.971 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:38.972 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:39.018 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:39.230 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:39.233 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:39.236 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:39.239 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:39.404 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:39.409 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:39.410 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:39.439 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:39.580 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:39.581 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:39.582 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:39.626 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:39.751 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:39.755 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:39.758 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:39.799 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:39.899 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:39.900 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:39.901 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:39.938 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:40.116 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:40.121 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:40.125 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:40.141 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:40.188 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:40.193 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:40.196 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:40.271 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:40.339 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:40.340 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:40.341 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:40.377 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
2018-01-08 14:10:40.561 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_power' received command REFRESH
2018-01-08 14:10:40.566 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_inUse' received command REFRESH
2018-01-08 14:10:40.566 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_loadPower' received command REFRESH
2018-01-08 14:10:40.589 [ItemCommandEvent ] - Item 'mihome_sensor_plug_158d0001debc5b_powerConsumed' received command REFRESH
OpenHAB Log
2018-01-08 14:10:24.459 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling handler: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.thing.internal.ThingManager.receiveCommand(ThingManager.java:374)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:47)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:192)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)[98:org.eclipse.smarthome.core:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[98:org.eclipse.smarthome.core:0.9.0.b5]
at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.8.0_151]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.8.0_151]
at java.lang.Thread.run(Unknown Source)[:1.8.0_151]
Caused by: java.lang.NullPointerException
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.toJsonValue(XiaomiBridgeHandler.java:319)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:257)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:239)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToDevice(XiaomiBridgeHandler.java:266)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiActorPlugHandler.execute(XiaomiActorPlugHandler.java:42)[185:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:97)[185:org.openhab.binding.mihome:2.1.0]
at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:377)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:1)[105:org.eclipse.smarthome.core.thing:0.9.0.b5]
at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218)[98:org.eclipse.smarthome.core:0.9.0.b5]
... 12 more
Thanks namraccr, after some more testing this error only occurs when trying to send commands to the Xiaomi Smart Plugs. I can successfully send commands to the Xiamo Gateway i.e. turn on the light with no issues.
I would really appreciate some help on this one, as this is the last kind of significant functionally I am missing (cant get working) for my entire home automation solution.
Hi All - just to round out this thread, a quick update that I was able to solve this problem by using the Zulu Java Platform instead of the standard Oracle JRE/JDK.