Xiaomi Gateway Integration

Because I would like to have 1 intermediate level of abstraction between propietary-protocol home devices and home hub software (I can change home ‘hub’ to any other supporting MQTT) I have choosed to integrate Aqara to MQTT server and then integrate MQTT in home assistant.

So, here is mine integration to mqtt, thx to rave’s code :wink:

2 Likes

Turning off the motion sensor after one minute (and some extra seconds for margin) is a good idea. Still, pooling would make the whole system more reliable. Even if it only pools the gateway once per minute, it would make sure the sensors have the correct state. Since it only sends broadcasts, I’m pretty sure some messages will get lost for some people.

Good news folks, I’ve fixed the hanging motion sensor.
Will create a pull request within a few hours to merge it with @rave his code.

4 Likes

anyone tried to use the temperature and humidity’s value as a trigger (above and below)? I already converted it to float but it’s not triggering.

If the sensor is correctly updating, thee is probably something wrong with your automation.
I would suggest that open a new thread, and post your automation.

did your code change significantly from 1 week ago? Will it be included in the next release?

I still have problems with your component. I like since I bought so many xiaomi product, but for me is still not working well (it works, then it crashes HA, restart is not working, restart it works again … and so on)

That is great! can’t wait to make them work good again :slight_smile:

That’s interesting. I set this up a week or so ago; currently with 1 PIR, 2 temp/humidity sensors, 2 buttons, 1 door/window sensor, 1 plug, and 1 gateway. It’s been rock solid since, and everything is updating and working as expected. I’m looking forward to multiple gateway support (as I have 2 on hand) to help extend my Xiaomi network, since I plan to buy PIR’s for every room and probably another 2 plugs for network extending as well. Maybe more door/window sensors. This has been a solid and cheap way to extend Home Assistant, but this code is still beta. It will only get better with time.

1 Like

it seems I am the only one with problems. Spent already too much time trying to resolve it.

I either format all HASS installation and redo new, or wait a change in code, maybe fixes by itself (it did for other components in the past)

where you from? I wish they made EU plug…

I have
1 door sensor (3 more arriving)
2 button arriving
2 PIR
1 flower light sensor (I think is not good though)
1 gateway

The Mihome app is good, I actually like it, miss the integration with HA (Xiaomi, Aleva, Hue and Broalink, Sonoff, all together). And I think I stop with this 4 brands, nothing more, too much trouble already

Hey rave,

Thanks for this great work.
Just implemented it and it’s working great.
You earned a beer :wink:

Cheers!

I’m in the US. Using an adapter plug. I have a LED strip on the Xiaomi plug, mainly because it’s a low-powered light that would put this plug (which acts as a repeater) in the middle of my house.

@rave created a pull request for the hanging motion sensor.

For those who cannot wait, you can copy/paste the sensor code here:
https://github.com/lazcad/homeassistant/pull/5

2 Likes

my sensor look like this (left is door sensor, right is motion

I see other in this thread have this below. Why this difference, can it be changed?

Since the message used for the “off” state was wrong, how could the sensor go back to off sometimes? I mean, my cat has been walking in front of the sensor all day, and it has been on and off, despite getting stuck on “on” for long times. Does the gateway send an update for all sensors from time to time, with {‘status’: ‘no_motion’} ?

I don’t know what triggers the hub to send a current status update for the sensors.
Maybe @rave knows this? But this kind of data was processed fine.

In the use-case the sensor was sending the no_motion event after 2 min wasn’t working anymore.

Hi @anon35356645,

In my case now i have 1 motion sensor and 1 door sensor with the gateway in HA and works well. The only thing is that i used @fooxy code.

In my case i dunno why you have this icon for the door sensor, but i can tell you that you can customize the icon of this device in HA.

The only is that you be sure that door sensor works well on HA.

for all xiaomi devices fooxy code?

Where is it?

Hi @garvarma,

can you tell me how you got the door and motion sensors to display on the page like that?