# Mi(Xiaomi) Smart home bindings?

**URL:** <https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711>\
**Category:** Home Automation\
**Created:** [December 2, 2015, 1:16pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711 "2015-12-02T13:16:10Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 22, 2017, 8:02pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/203 "2017-04-22T20:02:35Z")

</div>

Your welcome 🙂

Seems like the binding is either missing the developer key or the gateway token.

please check, if your server in A VLAN receives heartbeat messages from the gateway.  
enable DEBUG logging for the binding in the console of karaf and check if you get messages which look like this:

```auto
2017-04-22 21:53:45.078 [DEBUG] [me.handler.XiaomiActorGatewayHandler] - Item got update: {"cmd":"heartbeat","model":"gateway","sid":"xxxx","short_id":"0","token":"70TmuQW5QTln1BX4","data":"{\"ip\":\"192.168.0.xxx\"}"}

```

to be able to write values to the gateway you need to have the token (which is in this heartbeat message and gets updated every 10sec), and the developer key you get from the xiaomi app as described in the readme for the binding.

Are you receiving value updates from sensors etc. when in different VLANs? Then at least multicast traffic should be routed.  
Multicast address is `224.0.0.50`, port is `9898`

---

<div class="post-metadata">

**Author:** ![Gudszent\_Otto](https://community.openhab.org/user_avatar/community.openhab.org/gudszent_otto/32/38536_2.png) [@Gudszent\_Otto](https://community.openhab.org/u/Gudszent_Otto)\
**Post date:** [April 22, 2017, 8:29pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/204 "2017-04-22T20:29:42Z")

</div>

Thank your quick answer!  
From Service vlan, cant create any connection to server vlan or to internet. Everything disabled. 😕  
Enough the multicast ip?

---

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 22, 2017, 8:38pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/205 "2017-04-22T20:38:36Z")

</div>

at least multicast traffic and the port, I’d say…

---

<div class="post-metadata">

**Author:** ![Gudszent\_Otto](https://community.openhab.org/user_avatar/community.openhab.org/gudszent_otto/32/38536_2.png) [@Gudszent\_Otto](https://community.openhab.org/u/Gudszent_Otto)\
**Post date:** [April 23, 2017, 7:42am UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/206 "2017-04-23T07:42:11Z")

</div>

## Still I have no luck. On mikrotik not so easy to setup this 🙂 now I have a little bit different error log, but I think, this is the same issue…

09:35:06.805 [INFO] [smarthome.event.ItemCommandEvent] - Item ‘Gateway\_LightSwitch’ received command ON  
09:35:06.806 [DEBUG] [me.handler.XiaomiActorGatewayHandler] - Device 286c07888601 on channel mihome:gateway:286c07888601:brightness received command ON  
java.lang.NullPointerException  
at org.openhab.binding.mihome.internal.EncryptionHelper.encrypt(EncryptionHelper.java:35)  
at org.openhab.binding.mihome.internal.EncryptionHelper.encrypt(EncryptionHelper.java:25)  
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.getEncryptedKey(XiaomiBridgeHandler.java:282)  
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.createDataJsonString(XiaomiBridgeHandler.java:267)09:35:06.808 [INFO] [marthome.event.ItemStateChangedEvent] - Gateway\_LightSw  
itch changed from OFF to ON

```
    at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToBridge(XiaomiBridgeHandler.java:263)
    at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.writeBridgeLightColor(XiaomiActorGatewayHandler.java:191)
    at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.writeBridgeLightColor(XiaomiActorGatewayHandler.java:187)
    at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.execute(XiaomiActorGatewayHandler.java:75)
    at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:100)
    at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:374)
    at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:1)
    at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218)
    at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)
    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.receiveCommand(ThingManager.java:371)
    at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:46)
    at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:192)
    at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)
    at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

```

## 09:35:06.812 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Send to bridge: {“cmd”: “write”,“model”: “gateway”,“sid”: “286c07888601”,“short\_id”: “0”,“data”: “{"rgb": 603979776, "key": "” }“} 09:35:06.813 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Sending message: {“cmd”: “write”,“model”: “gateway”,“sid”: “286c07888601”,“short\_id”: “0”,“data”: “{"rgb": 603979776, "key": " “}”} to /10.6.2.47 09:35:06.853 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Received message {“cmd”:“write\_ack”,“sid”:“286c07888601”,“data”:”{"error":"Invalid key len"}”} 09:35:06.853 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Updated “last time seen” for device 286c07888601 09:35:06.853 [DEBUG] [g.mihome.handler.XiaomiBridgeHandler] - Device 286c07888601 honored write request 09:35:06.854 [DEBUG] [me.handler.XiaomiActorGatewayHandler] - Item got update: {“cmd”:“write\_ack”,“sid”:“286c07888601”,“data”:“{"error":"Invalid key len"}”} 09:35:06.854 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners 09:35:06.854 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Thread waiting for data on port 9898

BR,  
O.

---

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 23, 2017, 6:13pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/207 "2017-04-23T18:13:21Z")

</div>

seems that you got unicast traffic working as you receive answers to your requests.  
just to be sure: you entered the developer key into the thing config of the bridge right?

are you receiving any reports or heartbeats?

---

<div class="post-metadata">

**Author:** ![Gudszent\_Otto](https://community.openhab.org/user_avatar/community.openhab.org/gudszent_otto/32/38536_2.png) [@Gudszent\_Otto](https://community.openhab.org/u/Gudszent_Otto)\
**Post date:** [April 23, 2017, 6:37pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/208 "2017-04-23T18:37:49Z")

</div>

Yes of curse, until it in the same vlan, its working

Regarding the heartbeats, you mean this?:  
 ![](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/7/7ab9812fc348ab498856dd7aa1da888b8be67e53.png)

BR,  
O.

---

<div class="post-metadata">

**Author:** ![Gudszent\_Otto](https://community.openhab.org/user_avatar/community.openhab.org/gudszent_otto/32/38536_2.png) [@Gudszent\_Otto](https://community.openhab.org/u/Gudszent_Otto)\
**Post date:** [April 23, 2017, 6:42pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/209 "2017-04-23T18:42:04Z")

</div>

Is it a problem, If at the first time it was in the same wlan, so the autodiscovery find it. Than I move it to other vlan, and simple edit the ip here:  
 ![](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/6/6be355d7f78ef7cd8fe464c5f515f39b9a2e482b.png)  
BR,  
O.

---

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 23, 2017, 7:26pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/210 "2017-04-23T19:26:24Z")

</div>

Config seems ok. You can see in your logs that it sends to the configured ip and gets answers.  
With reports and heartbeats I mean in the debug log.  
If nothing happens the gateway is sending a heartbeat every 10sec.  
If for example a motion sensor triggers it should send a message with cmd : report in it

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [April 26, 2017, 5:50pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/211 "2017-04-26T17:50:54Z")

</div>

Please can anybody tell me how i can pair a aqara switch with the xiaomi gateway? I don´t speak chinese and i can´t read the manual.

Also there are two blue small led under the switches, what are they for?

I have the 2 channel aqara wireless switch (battery powered).

To pair a xiaomi gadget i have to press the button on the gateway three times, but what do i have to press on the switch?

EDIT:  
Strange, now i can see the aqara switch in my mi home, but i can´t add it with openhab paper ui. Any tips how i can do that? I made a search for new things, but there was none, then i added manually an aqara 2 channel switch and then i had to enter the device id, but i don´t have that. Where can i get this? All my tmep sensors and xiaomi switches were filled in automatically with this id.

---

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 26, 2017, 7:06pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/212 "2017-04-26T19:06:15Z")

</div>

you have to press the gateway button three times, then one of the pushbuttons of the switch for a few seconds, five or so.  
if you already see it perhaps it’s worth it pressing the button for the binding to get aware of the new device…  
Good luck!

**Good news**  
finally and thanks to @Kai the IOT marketplace now provides the latest version of the binding!!!

Please regard this a _still under development_ and help the community to get the bugs out of it…

cheers!

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [April 26, 2017, 7:07pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/213 "2017-04-26T19:07:52Z")

</div>

Finally i got it working.

I wanted to change to mihome-binding from 26.04.2017 but then all xiaomi things stopped working, so back to the old jar-file from 12.04.2017 i think and immediately it started to work again, and also there was the new aqara switch visible.

But on iot Marketplace still no new addon:

```auto
Date Created: 
Mon, 2017-04-17 17:48
Development Status: 
Beta
License: 
EPL
Date Updated: 
Tue, 2017-04-18 09:05
Submitted by: 
Dieter Schmidt

```

I found the not working (for me) jar-file from today on the github\_  
[https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.mihome/2.1.0-SNAPSHOT/](https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.mihome/2.1.0-SNAPSHOT/)

---

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 26, 2017, 7:15pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/214 "2017-04-26T19:15:49Z")

</div>

glad its working for you!  
can anybody confirm that the marketplace JAR is no functional? there were some issues with jenkins the last time, perhaps this relates to that…

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [April 26, 2017, 7:37pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/215 "2017-04-26T19:37:19Z")

</div>

Is the direct link from my last post to [jfrog.io](http://jfrog.io) the right jar?

* * *

Look at my screenshot, there is no update:

![](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/f/fb9ba16570c4b16f39e354938d1ac9c2deb12d0f.png)

---

<div class="post-metadata">

**Author:** ![miklosandras](https://community.openhab.org/user_avatar/community.openhab.org/miklosandras/32/27796_2.png) [@miklosandras](https://community.openhab.org/u/miklosandras)\
**Post date:** [April 26, 2017, 7:39pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/216 "2017-04-26T19:39:37Z")

</div>

I could not download the marketplace version, would you please provide the link for ot? I can test it.

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [April 26, 2017, 7:46pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/217 "2017-04-26T19:46:52Z")

</div>

Look at my Screenshot, there is a link in it in top oft the picture. It is the github pullrequest. there you can find a link to a jar file from 24.04.2017. this is working for me.

---

<div class="post-metadata">

**Author:** ![dimalo](https://community.openhab.org/user_avatar/community.openhab.org/dimalo/32/9098_2.png) [@dimalo](https://community.openhab.org/u/dimalo)\
**Post date:** [April 26, 2017, 7:54pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/218 "2017-04-26T19:54:17Z")

</div>

I can confirm its **NOT WORKING**  
had to move the existing jar away from the addons folder, then the one installed through the marketplace was registered and started in karaf.

what it outputs is:  
`207 | Active | 80 | 2.1.0.201704261053 | Energenie Mi|Home Binding`

seems our binding shares the same name with the energenie bundle ☹  
So the building system actually builds it, but its not the xiaomi mihome binding but energenie instead 😵

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [April 27, 2017, 11:21am UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/219 "2017-04-27T11:21:17Z")

</div>

With Aqara switch there is only single click available.

Is there a way to get double click or even tripple click? Maybe with some rules in Openhab?

Single click and voltage is working.

---

<div class="post-metadata">

**Author:** ![sonyxperiageek](https://community.openhab.org/user_avatar/community.openhab.org/sonyxperiageek/32/39945_2.png) [@sonyxperiageek](https://community.openhab.org/u/sonyxperiageek)\
**Post date:** [April 27, 2017, 12:05pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/220 "2017-04-27T12:05:51Z")

</div>

Hi guys, it’s a bit too much to read from the beginning, but just wondering if the Mi Smart Home Kit binding is working with openHAB 2 now, and if all products including the power strip were able to be controlled from openHAB 2?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![halloween](https://community.openhab.org/user_avatar/community.openhab.org/halloween/32/7493_2.png) [@halloween](https://community.openhab.org/u/halloween)\
**Post date:** [April 27, 2017, 12:25pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/221 "2017-04-27T12:25:37Z")

</div>

I´m using Openhab2 and i have the gateway/bridge → Color is working, sound not tested yet. Temp/Humidity Sensor, magnetic Door Contact, Xiaomi Button Swicth and Aqara 2-channel battery powered switch also working.

I can use the functionality of the sensors and i also get voltage notifications - actual voltage and low battery warning.

I don´t own any power strip or other xiaomi mi home stuff which i haven´t listet here.

---

<div class="post-metadata">

**Author:** ![sonyxperiageek](https://community.openhab.org/user_avatar/community.openhab.org/sonyxperiageek/32/39945_2.png) [@sonyxperiageek](https://community.openhab.org/u/sonyxperiageek)\
**Post date:** [April 27, 2017, 12:32pm UTC](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711/222 "2017-04-27T12:32:28Z")

</div>

Thank you. I searched the Add-Ons in PaperUI but can’t find it. How would I manually install the binding please, or will it be submitted to the Add-Ons soon?

Thanks.

[Previous page](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711.md?page=10)

[Next page](https://community.openhab.org/t/mi-xiaomi-smart-home-bindings/4711.md?page=12)
