Mi(Xiaomi) Smart home bindings?

(Sasha) #530

@dimalo Hi, thanks for the advice. I’ve reenabled a dev code in the gateway settings and changed it in Xiaomi binding but it still the same. I cannot control it but can get data… Any other ideas?

(Sergey M) #531

I have 3 leakage sensors. They are added to the android application and configured in OpenHAB. In the rules, when alarming and resetting the alarm, sending to telegrams is configured. Everything works well!!! Yesterday morning in the android application received three notifications, alarm reset, OpenHAB did not send a telegram. Then I put all three sensors in the water and immediately got three telegrams, pulling the sensors out of the water, again received three telegrams. It turns out that those three notifications about the alarm reset in the android application are different from the real ones. What was it? Has anyone encountered a similar one?

(Simon) #532

Ist there a possibility to “reset” the motion sensors, so they don’t sleep one minute after triggering?

(Mar) #533

Does anyone have any preference to the original Mijia or newer Aqara items? Im wondering exactly what the difference between the two is besides looks.

(Cool Wombat) #534

@Mar Besides look, some of the newer Aqara items have additional sensors, for example the Aqara temperature & humidity also measure atmospheric pressure and the Aqara movement sensor also measure luminence. Most of the Aqara items also do away with the paper clip switch and instead work with a long press to connect and disconnect from your gateway. That is usually not a problem for most items.

The range of Aqara items is also growing while the Mijia have stopped and I am pretty sure is discontinued.

However, with the single switch version of the Aqara switch (to me looks better than the original round puck) misses out on the long press function. The original round switch has three functions - single quick press, double quick press and long press while the newer Aqara switch only has the single and double quick press. Also, sometimes if you accidentally press and hold on the switch, it disconnects form the gateway and you have to go through the steps to reconnect it. Something to think about.

(Mar) #535

@CoolWombat thanks so much for the details around the original vs the Aqara items. I suppose it does make sense to go with the newer Aqara items, and I’d also agree that the Aqara items look a little better. Good to know around the bonus things like measuring pressure/luminescence - I suppose you could run a lot of automation just getting how bright it is back into openhab.

Also really good to know about the switch, having that extra function on the switch could prove useful. I’ve gone ahead and ordered a bunch of Aqara items and one of the original switches to try it out.

With all the sales I managed to get a whole ton of stuff for less than £80!! take that smartthings!

(Murpher) #536

Have looked through and can’t see an answer to my issue.
OpenHAB : openHAB 2.1.0 - release build -
MiHome : Firmware 1.4.1_150.0143
Gateway : V2
Binding : org.openhab.binding.mihome-2.2.0-SNAPSHOT.jar

I have followed the very well prepared instructions Xiaomi Mi Smart Home Binding

It found my Gateway and Bridge with in seconds and I entered (is correct!:slight_smile: ) developer key and created the items, sitemap map etc.

Issue I’m having is my items don’t read the current status of the gateway and aren’t changing when I perform an action from openHAB or the Mi Home APP. Below is the events log and openHAB log which is generating an error.

Events log

2017-11-22 19:26:03.737 [ItemCommandEvent          ] - Item 'Gateway_LightSwitch' received command ON
2017-11-22 19:26:03.742 [ItemStateChangedEvent     ] - Gateway_LightSwitch changed from OFF to ON
2017-11-22 19:26:05.179 [ItemCommandEvent          ] - Item 'Gateway_LightSwitch' received command OFF
2017-11-22 19:26:05.181 [ItemStateChangedEvent     ] - Gateway_LightSwitch changed from ON to OFF

Openhab Log

Caused by: java.lang.NullPointerException
	at org.openhab.binding.mihome.internal.EncryptionHelper.encrypt(EncryptionHelper.java:69)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.internal.EncryptionHelper.encrypt(EncryptionHelper.java:42)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.getEncryptedKey(XiaomiBridgeHandler.java:290)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.createDataJsonString(XiaomiBridgeHandler.java:276)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToBridge(XiaomiBridgeHandler.java:272)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.writeBridgeLightColor(XiaomiActorGatewayHandler.java:183)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.writeBridgeLightColor(XiaomiActorGatewayHandler.java:179)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.execute(XiaomiActorGatewayHandler.java:68)[198:org.openhab.binding.mihome:]
	at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:101)[198:org.openhab.binding.mihome:]
	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

Looking if anyone has an idea to whats wrong with my configuration.

(Dimalo) #537

hey @Murpher ,
a quick search on EncryptionHelper gave me this guy who was using a VPN - and this guy, who had to configure his firewall.
The error seems to appear often with network related solutions. Please make sure you try out different ways to ensure the communication is working :slight_smile:

(Murpher) #538

Hi @dimalo,

Thanks for your reply was hoping my fix was in them. Thanks for the links unfortunately I’m running on a raspberry pi and I have no vpn or firewall.

Must me some communication issue between if anyone has any other ideas I welcome them all it has to be something simple.

(Sergey M) #539

Why are some things highlighted in bold and others not?

(Mr. Yoinkz) #540

Hey Guys,

Did anyone get this working?

rule "Xiaomi Switch"
    Channel "mihome:sensor_switch:<ID>:button" triggered
    var actionName = receivedEvent.getEvent()
    switch(actionName) {
        case "SHORT_PRESSED": {
        case "DOUBLE_PRESSED": {
        case "LONG_PRESSED": {
        case "LONG_RELEASED": {

I’m runnning openHAB 2.2.0 Build #1068 but I still don’t see my light gets turned ON.
I do see the events though, so openHAB sees the buttons pressed…

I tried reading through this long thread, so I might have missed something! Is there any solution to this?

(Sven Mey) #541

There as been a change, so the code doesn’t work anymore.

Try this instead:

rule " "
    Channel "mihome:sensor_switch:<ID>:button" triggered SHORT_PRESSED
  <code>    				}

rule " "
    Channel "mihome:sensor_switch:<ID>:button" triggered DOUBLE_PRESSED
  <code>    				}

rule " "
    Channel "mihome:sensor_switch:<ID>:button" triggered LONG_PRESSED
  <code>    				}

Xiaomi Binding - Wireless Switch do not work anymore
Errors after upgrade to 2.2
(Mr. Yoinkz) #542

Hmm, tried it, but nothing happens:

rule "Xiaomi Switch - Doorbell "
    Channel "mihome:sensor_switch:158d00014d0cc0:button" triggered SHORT_PRESSED
    gGarden_Back_Beds.sendCommand(ON) }

Also, now my other Xioami rules doesn’t work - when above is in my rules file.

(Mr. Yoinkz) #543

Sorry - my mistake.

Got it working with;

rule "Xiaomi Switch - Doorbell "
    Channel "mihome:sensor_switch:158d00014d0cc0:button" triggered SHORT_PRESSED
    if (gGarden_Back_Beds.state == OFF) {
    } else {


(Ward) #544

The first 3 Things are missing some sort of label. I thought is was something in the binding’s code (https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.mihome/ESH-INF/thing), but I see a correct label for all things. I see the same with my water leak sensors.

What has been changed? this code is still working in my setup…

(Sven Mey) #545

To be honest, i assume there must have been a change, because after an update the old version did not work anymor for me.

(Maciek B) #546

I just bought Xiaomi Mijia Aqara Smart IP Camera
It is camera with getaway functionality. Do you think it will work with the binding? If not who should I ask to update the binding?

(Ward) #547

This should work with the gateway, but is not yet supported by the binding (https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.mihome)

Maybe you can ask it in this topic: Support for more Mi-Home Aqara items

(Fontoura) #548


Does anyone having problem getting to developer mode in the new mi home app version 5? I press the version in the about page and the only thing I get is a bunch of information about my gateway (ip, wifi password, devices, …).

I’m using gateway 3 v2.46

(Ward) #549

Just tried it again, is still working. Don’t you see the ‘local area network communication protocol’ item in the About menu? This should appear after enabling developer mode.

My gateway has firmware 1.4.1_150.0143 (version 2.46) (I don’t think a gateway v3 exists)
MiHome v5.0.10