Mi(Xiaomi) Smart home bindings?

Ist there a possibility to ā€œresetā€ the motion sensors, so they donā€™t sleep one minute after triggering?

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.

@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.

1 Like

@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!

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

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:

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.

Why are some things highlighted in bold and others not?

Hey Guys,

Did anyone get this working?

rule "Xiaomi Switch"
when
    Channel "mihome:sensor_switch:<ID>:button" triggered
then
    var actionName = receivedEvent.getEvent()
    switch(actionName) {
        case "SHORT_PRESSED": {
            Garden_Light.sendCommand(ON)
        }
        case "DOUBLE_PRESSED": {
            Garden_Light.sendCommand(OFF)
        }
        case "LONG_PRESSED": {
            <ACTION>
        }
        case "LONG_RELEASED": {
            <ACTION>
        }
    }
end

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?

There as been a change, so the code doesnā€™t work anymore.

Try this instead:

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


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


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

Hmm, tried it, but nothing happens:

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

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

Sorry - my mistake.

Got it working with;

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

Thanksā€¦

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ā€¦

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

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?

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 - #50 by antricki

Hi,

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

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

Maybe the one I have is not supported for such developer mode.
In the readme page for the mi home binding there is this step that the gateway 3 is mentioned:
ā€¢Add Gateway 2 or 3 to your WiFi Network

It is that one:
https://pt.aliexpress.com/item/2017-Xiaomi-Smart-Home-Gateway-3-Aqara-Smart-Light-Control-ZiGBee-Wifi-Wireless-Key-and-Wall/32790262169.html
However In the xiaomi mi page they mention only as a air condition companion.
https://xiaomi-mi.com/sockets-and-sensors/xiaomi-aqara-air-conditioning-companion-temperature-humidity-sensor/

Has anyone succesfully used the ā€œgateway 3ā€?

this gateway is supported. there are different versions of it and it is the original gateway v3 - there is an older v2 of this which looks the same. these are montioned in the readmeā€¦