Support for more Mi-Home Aqara items

Hi,

First thanks for the great work done around openhab. Even if I’m not fan of having such a big and slow machinery around home automation, I have to say I’m impressed by the work that is done.

I played a little bit with my gateway and noticed few of my xiaomi items were not discovered by openhab. So I plugged wireshark in the loop and noticed some UDP packets sent to openhab.
If some one of the xiaomi binding developers could take a look and add them in the bindings that would be great, the last version, as of today, don’t contain these models. Here are some (json ?) traces from wireshark, I think that should be more than enough to add them.

square aqara temp,humidity and pressure sensor:

{“cmd”:“report”,“model”:“weather.v1”,“sid”:“158d0001a4bxxx”,“short_id”:27095,“data”:“{"temperature":"2281"}”}
{“cmd”:“report”,“model”:“weather.v1”,“sid”:“158d0001a4bxxx”,“short_id”:27095,“data”:“{"humidity":"6914"}”}
{“cmd”:“report”,“model”:“weather.v1”,“sid”:“158d0001a4bxxx”,“short_id”:27095,“data”:“{"pressure":"100847"}”}
{“cmd”:“heartbeat”,“model”:“weather.v1”,“sid”:“158d0001a4bxxx”,“short_id”:27095,“data”:“{"voltage":3065,"temperature":"2281","humidity":"6914","pressure":"100847"}”

aqara door sensor:

{“cmd”:“report”,“model”:“sensor_magnet.aq2”,“sid”:“158d0001a64xxx”,“short_id”:50997,“data”:“{"status":"open"}”}
{“cmd”:“report”,“model”:“sensor_magnet.aq2”,“sid”:“158d0001a64xxx”,“short_id”:50997,“data”:“{"status":"close"}”}
{“cmd”:“heartbeat”,“model”:“sensor_magnet.aq2”,“sid”:“158d0001a64xxx”,“short_id”:50997,“data”:“{"voltage":3145,"status":"close"}”}

square aqara wireless switch:

{“cmd”:“report”,“model”:“sensor_switch.aq2”,“sid”:“158d0001a66xxx”,“short_id”:37302,“data”:“{"status":"double_click"}”}
{“cmd”:“report”,“model”:“sensor_switch.aq2”,“sid”:“158d0001a66xxx”,“short_id”:37302,“data”:“{"status":"click"}”
{“cmd”:“heartbeat”,“model”:“sensor_switch.aq2”,“sid”:“158d0001a66xxx”,“short_id”:37302,“data”:“{"voltage":3105}”}

For users of the android Mi-home app, the square wireless switch doesn’t show up in the app (it seems ok in IOS app). However the gateway recognizes them and send events through the API. So as soon as openhab xiaomi bindings are updated, you could use it.

Hope that helps !

Hey @nekenk ,
@Ondrej_Pecta mentioned he’ll dive into more sensors support.
See this post for the details on how to approach this, in case you’re interested in submitting a Pull Request yourself :wink:

Thanks for the logs, btw! Could you wrap them in the code fences (``` at the beginning and the end) so they’re more readable?
Cheers!

Thanks! What is the easiest way to have openhab2 ready to be modified in eclipse will all the required plugins installed ? Is there a how to compile openhab 2 somewhere, I’m sure there is… But some coding guide lines, etc, etc…

Ok I’m reading http://docs.openhab.org/developers/

I’ve already started coding support for the temp, humidity, pressure sensor and for the door/window sensor as I also have those devices. I don’t have the wireless switch though.

1 Like

@danielwalters86: did you open a pull request ? I didn’t see any. Is there an issue created about it ? I didn’t see any either, that’s why I started coding. And after 2 hours of setup and a little bit of coding, I got everything working !

3 Likes

I’ve just sent the PR. Feel free to have a look and leave any feedback or comments from your own experience.

I did the same changes (but I reused the original classes instead of copying them) and I added the wireless switch. I could pull a request only for the switch…

1 Like

Hey @nekenk @danielwalters86 thank you so much for working on this! :beers:

You could open a pull pequest against Daniel’s repository to speed up the work :slight_smile:
Note that there are some remarks for the code already, so you two might want to collaborate on these.

Cheers

Thanks @kubawolanin, I didn’t think about opening a pull request on Daniel’s repository ! I’m a TFS/VS guy, I don’t have the git thinking yet !
I saw the comments, Daniel did copy a bunch of code where most of the problems are. It’s not needed to copy those files.

1 Like

I don’t know if the jar file in the repo (https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.mihome/2.2.0-SNAPSHOT/) already has the new functionality, but if so, I’m willing to test the square temp/hum/pressure sensor.
The new ‘human body’ sensor is also on it’s way.

I believe it should do.

Hello, I’ve downloaded the latest snapshot as of 03/08/17 and put it in the addons folder under /usr/share/openhab2/addons/ then uninstalled the 2.1 version built into OpenHAB 2.1. Checked in Console and confirmed that it is running. However I can’t see any of the new Aqara sensors (square ones). I have 3 temperature sensors, 1 button and 1 door sensor.

Try this jar then.

Hi @danielwalters86 I tried your jar but no result. I checked and I have the bundle running:

Should I try a different jar?

This one worked: https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.mihome/2.2.0-SNAPSHOT/

I can confirm that it now works with the 04/08/17 snapshot.

Any chance we can get support for the square Aqara button too?

I can also comfirm that my square sensors are working with snapshot of 05/08. Thanks for the great support!

Thank you very much to the developer(s). I can now see my Aqara wireless switch. I haven’t tested it yet but does it doesn’t seem to support double-press unless the button action sends the number of presses! I don’t now yet.

Would it be possible to add the new Aqara presence sensor?

Thank you in advance

HI All,

I really like OH2 and the Xiaomi devices.

I just bought some aqara motion sensor which are a little more powerful than the basic mi motion sensor.
They have in addition a light sensor.
It looks like they do not appear in the list of things after having connected them to the gateway.

I tried to check the github and it looks like some of the aqara devices are supported but no this one.

Any chance to get them supported?

Thanks,
OvO

1 Like