Xiaomi Gateway Integration

Will do once I get home. I’ll share

By the way do I need to configure all the sensors or it would pick up automatically ?

It will pick up all sensors and switches but you’ll have to give it a friendly name in the configuration file although you don’t have to…

Small donation by me, thank you very much!

Wow, that’s great! thanks! Time for another beer :grinning:

1 Like

It seems Xiaomi released a new 5 in 1 kit, but at the time it’s more expensive than buying the individual components.

Great! I have commited the latest code. Right now, the event data should make more sense. I have renamed the button_name into entity_id. And all you have to do is copy the Entity Id directly from the website (developer tools -> States)

entity_id: binary_sensor.158d000xxxxxc2_switch
click_type: single

@rave U’ve made some changes to the source code and now we can display custom date such as battery, so can we display power consumption data of the power plug. I want to make my home power accountant :slight_smile:

Lol. Its not yet ready yet… battery is in there and hub should send the battery status but for some reason, i still couldn’t get any info from the hub. So i just throw it out there if someone can get it working. For the power consumption, its the same, hub should send some data every 10 or 20 minutes but i’m not seeing anything yet…

1 Like

from the smart plug??

yeah. Hub should send power consumption data for the zigbee plug

Playing with the configuration file and it seems very flexible. Gonna try and see if i can display the last detected motion time similar to Mi Home app

1 Like

Yep the site says 2 years but I’m dubious, friend of mine told me to stay away from battery sensors, and they always under bake the usage… be interesting to see if we can get battery monitors working that would be ace

Total N00b question here… where is the root location? :disappointed:

I’ve mostly be playing on my mac using terminal so im familiar with this sort of location /Users/stewart/.homeassistant still trying to understand all of this, once its all working how I want it on my mac I will migrate it across to a Pi

I tried just dropping it in that folder :rolling_eyes: but of course it didn’t work

ERROR:homeassistant.loader:Unable to find component xiaomi

Also tried a search on my mac for homeassistant_venv , python3.4 even “components” folder without anything coming up…

Which guide did you follow to install it on your mac? There’s usually some path involved. Or you can ask around in the forum. I’m new as well to HA :grinning:

If I use docker to setup HA, how can I copy the files into components?

Check this thread

I might consider removing the requirement to put the files to installation directory. But that means the code will be harder to maintain but i don’t think that will be an issue for now. So look for an update in a day or so. Then you should be able to use Xiaomi component by placing the files to custom_components folder

Managed to get it to work :smiley: . Now the only issue that I am having is the door sensors , it shows the status is on , after there is no movement , it just toggles the status to off.

I think i’m in the right place…


this is a simple “hello world” example to show the basics of registering a service. To use this example, create the file /custom_components/hello_service.py and copy the below example code.

OS Path
macOS ~/.homeassistant

Custom components are new to me… and that longer location threw me off.

I’ve throw all the files in the root… still getting the same error but potentially due to the lack of the gateway key which I can’t seem to obtain with iOS… so I’ll need to find an android to get setup.

great job setting that up. You should be able to use any 16 characters dummy key for the moment if you just want to get data from the hub. For the errors, if you post the log, i can look into that.

great! door sensor or motion sensor?? Here’s the status for the sensors

Motion Sensor - Will turn on if there’s motion
Door Sensor - Will turn on if the door is opened