Need your help!
I’ve recently added Xiaomi Zigbee Plug to my collection of Xiaomi devices.
It works great, can read the power load and consumption, updates the status of the switch but I cannot control the device from OpenHAB.
Is there anything that I’ve done wrong in the config?
Items:
Switch Mi_Plug_1_Switch "Media Centre Switch [%s]" <switch> { channel="mihome:sensor_plug:158d0001ded347:power" }
Switch Mi_Plug_1_Active "Media Centre Active [%s]" <switch> { channel="mihome:sensor_plug:158d0001ded347:inUse" }
Number Mi_Plug_1_Power "Power Load [%.1f W]" <energy> { channel="mihome:sensor_plug:158d0001ded347:loadPower" }
Number Mi_Plug_1_Consumption "Power Cunsumed [%.1f kWh]" <line-incline> { channel="mihome:sensor_plug:158d0001ded347:powerConsumed" }
Sitemap:
Switch item=Mi_Plug_1_Switch
Switch item=Mi_Plug_1_Active
Text item=Mi_Plug_1_Power
Text item=Mi_Plug_1_Consumption
Logs:
2017-10-27 15:58:00.559 [ItemStateChangedEvent ] - Mi_Plug_1_Power changed from 46.65 to 46.21
2017-10-27 16:11:24.570 [ItemStateChangedEvent ] - Mi_Plug_1_Consumption changed from 18.536 to 18.563
2017-10-27 16:11:24.571 [ItemStateChangedEvent ] - Mi_Plug_1_Power changed from 46.21 to 46.65
2017-10-27 16:45:23.496 [ItemStateChangedEvent ] - Mi_Plug_1_Power changed from 46.65 to 46.21
2017-10-27 16:45:23.497 [ItemStateChangedEvent ] - Mi_Plug_1_Consumption changed from 18.563 to 18.591
2017-10-27 16:50:44.487 [ItemStateChangedEvent ] - Mi_Plug_1_Power changed from 46.21 to 46.65
2017-10-27 16:58:27.481 [ItemStateChangedEvent ] - Mi_Plug_1_Power changed from 46.65 to 46.21
2017-10-27 17:05:46.469 [ItemStateChangedEvent ] - Mi_Plug_1_Power changed from 46.21 to 46.65
2017-10-27 17:16:21.455 [ItemStateChangedEvent ] - Mi_Plug_1_Consumption changed from 18.591 to 18.617
2017-10-27 17:17:44.448 [ItemCommandEvent ] - Item 'Mi_Plug_1_Switch' received command OFF
2017-10-27 17:17:44.458 [ItemStateChangedEvent ] - Mi_Plug_1_Switch changed from ON to OFF
2017-10-27 17:17:46.100 [ItemCommandEvent ] - Item 'Mi_Plug_1_Active' received command OFF
2017-10-27 17:17:46.102 [ItemStateChangedEvent ] - Mi_Plug_1_Active changed from ON to OFF
2017-10-27 17:17:47.575 [ItemCommandEvent ] - Item 'Mi_Plug_1_Switch' received command ON
Screenshot from Paper UI (I’ve added things via it):
Going through a similar issue here, with a very similar setup.
I’m on Windows 10, OH 2.1, jre1.8.0_152
However, I get the following error when triggering (only) the Xiaomi Zigbee Plug ON or OFF :
2017-11-14 01:35:13.344 [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(FutureTask.java:266)[:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_152]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_152]
Caused by: java.lang.NullPointerException
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.toJsonValue(XiaomiBridgeHandler.java:319)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:257)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:239)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToDevice(XiaomiBridgeHandler.java:266)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiActorPlugHandler.execute(XiaomiActorPlugHandler.java:42)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:97)[187: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
2017-11-14 01:35:23.849 [INFO ] [.smarthome.model.script.Yeelink Bulb] - LR Light is:100
2017-11-14 01:35:27.009 [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(FutureTask.java:266)[:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_152]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_152]
Caused by: java.lang.NullPointerException
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.toJsonValue(XiaomiBridgeHandler.java:319)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:257)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:239)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToDevice(XiaomiBridgeHandler.java:266)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiActorPlugHandler.execute(XiaomiActorPlugHandler.java:42)[187:org.openhab.binding.mihome:2.1.0]
at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:97)[187: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
My Gateway, Door sensor, Yeelight and Wireless Controller all work fine, otherwise.
I’m on Ubuntu but found the same problem in 2.1.0.
The 2.2 snapshot versions however works.
I use a small lxd container running 2.2 for testing and to run things that don’t work properly in 2.1.
I have configured it to use mqtt to trigger my plugs through that.
Not ideal but the work-around works.
As you say the rest appears to work, including reading the status and power info from the plugs.
I recently switched to the Xiaomi Smart Home binding’s 2.2.0 SNAPSHOT (found on this post) and it’s working fine now; for anyone else that comes across this.
what else did u change i just updated and changed to that 2.2.0 SNAPSHOT, and im still having the same problem cant send command to the plug. But its able to read all the information abt it
please, may you confirm that the above reported positive result is made with the xiaomi mi smart zigbee plug connected to the zigbee binding and not to zigbee2mqtt?
I am planning to buy the above mentioned plug and use it with the zigbee binding
thanks