Xiaomi Gateway Integration

I don’t have the cube yet but i have added some code. If anyone has the cube, please try it out and see if it works.

My second gateway doesn’t work, after enabling developer mode, I still couldn’t connect to the gateway. I wonder if that gateway is faulty

Hi hardware model?

@rave Just wanted to let you know that my kit showed up today and I had a flawless experience setting this all up. Had a little confusion with the Mi Home app and getting the firmware updated, but beyond that, adding the custom component and setting it up in hass was cake!

One request, and not sure if this is even plausible or not, but the ability to rename entity_id’s would be superb. With Z-Wave, I rename all my entity_id’s via OZWCP and my OCD is going crazy over these entity_id names, hehe.

I originally bought the 5 piece starter kit to really test out the buttons, but I’m also really like the PIR and door/window sensors (super small, very responsive). Since then, I’ve placed 2 additional orders and will soon have 2 Gateway’s (not really sure why), 4 buttons, 3 PIR’s, 2 temp/humidity sensors, and 2 door/window sensors. Not sure if I’m going to use the plugs or not, since they don’t have 3-prong for US use (IEC Type B), but I may put one on the other end of my house if it acts as a repeater.

Regardless, big thanks for the work. I’ve donated once, but I expect to donate again in the coming days. Please work with the hass devs to get this component pushed into upstream! Should just need to make a pull request to the dev branch (https://github.com/home-assistant/home-assistant).

2 Likes

@rave
I agree with @tycoonbob that it would be great if you would start adding this to the official version.
It does not need to be perfect or have all the functionality before you open a pull request. In that way you will get feedback of what you have to change before we can merge it in.

2 Likes

I received last week my package with multiple buttons, temperature and motion sensors and a single gateway.

Integration with Hass was great.

A) Does anyone know if the Kettle can be controlled?
B) Can the Gateway scenes can be controlled? Seems like an easy way to enable the Gateway security Arm (blinks lights, siren sound)

Side notes:

2 Likes

Same as the other gateway i got. Everything is the same, firmware, hardware. Going to try in another router today and see if it works

Glad to hear it works :slight_smile: I’ll do a pull a request soon

2 Likes

HA newbe here:
I’m getting the the Mi Home Kit in a couple of days and doing some research around integration with HA and homebridge etc.
I have an Ubuntu server running for my media and would like to put the home automation on there, too.
So I’d need to:

  1. install home-assistant
  2. configure the hub with the devices
  3. add the Gateway Integration discussed here
  4. add homebridge to make it all available via HomeKit/Siri

is that correct or am I missing something?

That’s correct

Thanks. Works as described (temperature-humidity, motion, zigbee-plug)!
Tomorrow my cube will arrive and I will test it too.

I hope you can integrate zigbee-plug power monitoring in future (I think it might be separate ‘query’ for gateway - like ‘give me plug-xxx power consumption’?).

1 Like

This is exciting stuff. Thanks for your work on this. I only became interested in the Xiaomi HA stuff because of the Cube, so now that support has been added, I’m going to have to put this script to work. The only other item I have is the wireless button, which I had integrated with Jonathan’s script (https://notes.jmsinfor.com/blog/post/admin/Xiaomi-Hub), but now it’s time to get my cube working and pick up a couple more Mi items.

One thing that looks like it’s still missing in the cube functionality (at least from looking at the README) is rotate. Looking at the Xiaomi app, I can see that it tracks degree of rotation and direction of rotation. I imagine that’s more difficult to capture and parse since it’s not as straightforward as double tap, flip, or shake. Still, I can see some fun interactions that could happen if that data were exposed, like a counter-clockwise spin dimming the lights, and clockwise bringing them up, or volume control, with the degree of change dependent on the amount of rotation. But, yeah, I’m sure that’s a little trickier to deal with when it’s not just “action X has happened.”

But that’s daydreaming. I’m just happy to have a way to integrate my cube into my Home assistant set-up and have do more than play Chinese radio stations. Thanks for all the work. I can’t wait to try it out.

Hi all,

I started to use my Xiaomi devices with Home Assistant and it’s very impressive!
My temperature/humidity sensors, PIR sensor, switch, door sensor are working perfectly.
There is only one thing I miss: I don’t know how to control the Gateway light (and maybe audio, but that’s not a priority issue for me) from Home Assistant automation. Is it not yet implemented, or did I miss something?

Thanks in advance :slight_smile:

Does anybody get cube working?
I am using lazcad’s component and got following response for cube read_ack:
17-01-05 14:33:37 ERROR (Thread-6) [custom_components.xiaomi] Response: {'model': '', 'short_id': 39716, 'data': '{}', 'cmd': 'read_ack', 'sid': '158d00011065e3'}

Mine have empty model and no info in ‘data’ section.

Hi, we are having the same problem in Domoticz, empty model and data http://www.domoticz.com/forum/viewtopic.php?f=17&t=11520&p=112429#p112429

I haven’t looked into it, but looks like radio customization is possible at least - http://www.domoticz.com/forum/viewtopic.php?f=17&t=11520&start=220#p112345

Yep, sorry - cant register on domoticz forum (all my ips are banned O_o), cube doesn’t send reports on action(ex: it silent while flip90, rotate, etc). Will try to use wireshark to sniff all responses on ack.

p.s. while it silent in ack’s response - it works in gateway scenarios.
p.s.s Sometimes cube sends heartbeat:
('received message:', '{"cmd":"heartbeat","model":"","sid":"158d00011065e3","short_id":39716,"data":"{}"}')

Thanks, I will watch this thread also if you can report any news!

I’ll get the cube in 2 days. So i should be able to test it then

1 Like

Nice find!

Seems like Aqara is crowdsourcing a new in-wall outlet. Looks much nicer than Xiaomi Plug. You can see it from Mi Home App. I’m getting 2 of those :grin:

Also, Xiaomi has increased the price for temp/humidity sensor in their official website. So they have increased the price of all their sensors in the last 2 months. But they’re still cheap :grin: