Mi(Xiaomi) Smart home bindings?

@Ondrej_Pecta, this is fantastic. Thank you so much for your work.
I just received my Gateway with the door, motion and button sensors. I got the door sensor and button up and running just fine with your binding. Motion however doesn’t trigger for me. I get the report for it in log, but the item does not update.

Log:
2017-01-05 21:04:34.786 [INFO ] [o.o.b.x.i.XiaomiGatewayBinding] - Xiaomi received packet: {“cmd”:“report”,“model”:“motion”,“sid”:“158d00010efcaa”,“short_id”:59354,“data”:"{“status”:“motion”}"}

Items file entry:
Contact XiaomiMotion “Xiaomi motion [%s]” { xiaomigateway=“158d00010efcaa.motion” }

Sorry this binding won’t work with Mi Air. But I found something interesting regarding this cloud solution - look here: https://github.com/louisZL/aiot-open-2b
There seems to be some cloud platform documentation and it has BTW support for this Xiaomi gateway with codename lumi.gateway.v3 (https://github.com/louisZL/aiot-open-2b/blob/master/resource_definition.md).
Maybe it supports other xiaomi products as well…

@acittlau thank you very much for testing my binding and sharing log entries. Since I have no motion sensor, the support was missing.
I’ve just added support for motion sensor, can you please test it?
Please see this new version and let me know…
If you find it working I’ll push it to master and release a new official snapshot
Thanks.

1 Like

@Ondrej_Pecta I can confirm that this new version works perfectly for the motion sensor also! Again, thank you for your work.

2017-01-05 23:29:16.895 [INFO ] [o.o.b.x.i.XiaomiGatewayBinding] - Xiaomi received packet: {"cmd":"report","model":"motion","sid":"158d00010efcaa","short_id":59354,"data":"{\"status\":\"motion\"}"}
2017-01-05 23:29:16.895 [INFO ] [runtime.busevents             ] - XiaomiMotion state updated to OPEN

@Ondrej_Pecta you are using my version? did you try my newest version? that one should support every sensor. in the first version i pushed here it was only the temperature sensor. now all should work fine. I have tested all here. Or if it was my new version, can you tell me what was buggy so i can fix it? :slight_smile:
I now have a nice setup for testing the button/switch. Works fine together with a rule that turns on/off a yeelight :slight_smile:.
On the links you published above they show many values available for the xiaomi gateway. I wonder how we can access them or even set them (light the light on the gateway). Do you know where to find such information? As well the plug seems to have power consumption values. Those are never sent over the network though. Do you or anyone else know how to get them? Would like to make this binding support all features. If possible even audio if someone knows how to send audio to the gateway.

Sorry, someone on OH2 must test your version, I am still on OH1 and I am using only my version. All sensor types and button have been tested so far, now we need to test controlling of switches. Moreover I have ordered a Xiaomi cube and I am eager to test it, but unfortunately I’ve heard no events from cube are broadcasted on local network yet - so we have to wait for a new firmware which (hopefully) enables other features including cube events…
Manipulation with gateway light is described here, but I haven’t manged to get it working, I’m getting an error of unknown sid, when I write something to my gateway…
I guess we need to wait either for a new gateway firmware which will spread more events to local network/enable controlling of other features or get an access to this cloud platform (e.g. by reverse engineering an android Mi Home application which must do this job)

I see. On your binding :). I actually based most my stuff on your binding. I actually used your code and just rewrote most of it to work with OH2. Great job you did! For how to getting stuff to work, you can just check my code. Should be fairly easy I think.
Thanks for the link for the gateway light! Will give it a try soon :slight_smile:. Hope I can get it to work.

@Ondrej_Pecta
Awesome work! I’m just waiting for my kit to arrive. It’s Out of stock at the moment
Can’t wait to try it.

I can confirm the RGB control works fine with the latest gateway firmware, I’ll release an updated binding version soon :slight_smile:

2 Likes

hi all, please help. sensors may be added without using the application on your smartphone?

Since firmware update to 1.4.1_143.0141 I cannot add new devices via the mihome app.

Will i get a notification when battery from the sensor is weak?

I’d like to know this as well. My sensors are still in the transit, so I can’t check it but someone might want to put an ‘used’ battery to see if the device(s) report anything to the gateway that we can capture somehow.

I don’t think so - you have to switch the gateway to learning mode. AFAIK there is no other way than using Mi Home application.

Thank you so much. When a new version mihome binding will be possible?

You can find new releases here: https://github.com/octa22/org.openhab.binding.xiaomigateway/releases

1 Like

It does not work for me. -SNAPSHOT5 Everything is fine, but -SNAPSHOT6 not work. Changed developer key, did not help. help me please.

2017-01-17 13:24:10.068 [WARN ] [org.openhab.binding.xiaomigateway ] - FrameworkEvent WARNING - org.openhab.binding.xiaomigateway
2017-01-17 13:24:11.701 [ERROR] [org.openhab.binding.xiaomigateway ] - [org.openhab.binding.xiaomigateway.binding(4)] The activate method has thrown an exception
at org.openhab.binding.xiaomigateway.internal.XiaomiGatewayBinding.readConfiguration(XiaomiGatewayBinding.java:129)
at org.openhab.binding.xiaomigateway.internal.XiaomiGatewayBinding.activate(XiaomiGatewayBinding.java:115)
2017-01-17 13:24:11.749 [WARN ] [org.openhab.binding.xiaomigateway ] - FrameworkEvent WARNING - org.openhab.binding.xiaomigateway
2017-01-17 17:19:50.517 [WARN ] [org.apache.felix.fileinstall ] - A bundle with the same symbolic name (org.openhab.binding.xiaomigateway) and version (1.9.0.201701121531) is already installed. Updating this bundle instead.
2017-01-17 17:20:23.205 [ERROR] [org.openhab.binding.xiaomigateway ] - [org.openhab.binding.xiaomigateway.binding(4)] The activate method has thrown an exception
at org.openhab.binding.xiaomigateway.internal.XiaomiGatewayBinding.readConfiguration(XiaomiGatewayBinding.java:129)
at org.openhab.binding.xiaomigateway.internal.XiaomiGatewayBinding.activate(XiaomiGatewayBinding.java:115)

Oh, i really like this!

i looked at the Xiami smart home before, but found that it was completly closed.
now i see this i want them! :smiley:

Anyone any good source where to get the set for a good price?
the http://www.gearbest.com/smart-home/pp_197862.html is the cheapest one i could find, but sold out.

Some other sites that are close to this are also sold out, the rest is starting around 60+ USD with the set.
i dont mind paying, but it seems there are cheaper sites.

anyone any ideas?

The gateway is available on gearbest:

They also sent me a free EU adapter, but in black color.

I have two temperature sensors and I want to get their temperatures, can someone tell me what I am doing wrong.

  • I downloaded the latest openHab runtime (ver 1.8.3) and copied the org.openhab….SNAPSHOT.jar to the addon folder

  • Created the default.items file


`Number  RoomTemperature "Temperature  [%.1f °C]" <temperature> { xiaomigateway="158d0001182814.temperature" }`
  • Created the default.sitemap file

sitemap default label=”Main Menu” {
	Frame {
		Text item =  RoomTemperature
	}
}

This is the first time I use openhab :confused:, so i will appreciate your help. :cry: