Xiaomi Gateway Integration

use mainland china as the location.

ahhh thanks!!

how to check which version one has?

How to install this HA integration.
All the files are called xiaomi.py. I need ot put each xiamo.py in each custom_components subdirectories (sensor, swith, and so on), and the xiaomi.py in the cusotm_components root folder?

A bit confusing like this.

Other thing, which is the key
"Add the following line to the Configuration.yaml. You will need to get the Hub’s key in order to issue command to the hub like turning on and off plug. Follow the steps here http://bbs.xiaomi.cn/t-13198850

xiaomi:
key: xxxxxxxxxxxxxxxx"

The token, where the mac address is?

1 more for the camera, extremely cheap and very good quality. would be great to be able to add it to homeassistant ( it has no rstp stream)

That’s HA architecture. I can’t change that. And there’s only like 4 files in total… Can’t imagine how confusing it can be.

the key is 16 characters. the token is like 32 or more?

I find it confusing, and prone to make errors to developers and users, but understand is not your fault, but the architecture. Would rather called the files xiaomy_sensor.py and so on. But that’s my thing.

Unfortunately I don’t read chinese and from the app I can’t translate.

I have a 8 code in the about section (but if I press a symbol it changes the code, to, seems to me, random generated codes
and I have in another section of the about (can’t be more precise, is all chinese) where there is
version code: 121
ID45172400
Zigbee 25

{lots of stuff and also token:"alphanuymeric around 32 character code}

Wonder if anyone can help.

I´m running HA with the AIO raspberry.

i´ve moved all the 4 xiaomi.py folders into the components directory inside the src

switch > switch
sensor > sensor
binary_sensor > binary_sensor
xiaomi.py inside the root of component

also installed pycrypto inside the src with:
sudo su -s /bin/bash hass
source /srv/hass/hass_venv/bin/activate
pip3 install pycrypto

get this:

Requirement already satisfied: pycrypto in /srv/hass/hass_venv/lib/python3.4/site-packages

added the key after enabling development, and added it to the configuration.yaml

xiaomi:
key: sbrfcw4rt5j7jjre

but when starting ha, get this error:

16-12-28 14:24:11 homeassistant.bootstrap: Error during setup of component xiaomi
Traceback (most recent call last):
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/bootstrap.py”, line 151, in _async_setup_component
None, component.setup, hass, config)
AttributeError: ‘module’ object has no attribute ‘setup’

performing a check:

(hass_venv) hass@pihomeassistant:/home/pi$ hass --script check_config
Testing configuration at /home/hass/.homeassistant
Fatal error while loading config: ‘module’ object has no attribute ‘DOMAIN’

edit: something may have went wrong with the copy past. I´ve deleted the files from the src and add them to the custom_components in homeassistant configuration folder and is now working fine :slight_smile:

1 Like

I don’t read chinese as well but fortunately google translate works fine. The key is the random generated password in step 5 in the chinese link. 16 characters in total

HASS does not start, no activity in log … simply does not boot. If I take put xiaomi: and the key, it reboots …

xiami: goes in column 1 in configuration, and key in column 3, correct?

Maybe in first time tries to install pycrypto (I had installed before in virtual environment).?

EDIT 20 minutes has passed, it still does not boot up and no activity in log, I don’t know how to troubleshoot this …

is this different from the time displayed when you click the motion sensor itself?

if you installed as a service:
journalctl -f -u home-assistant@hass

sorry newb here, what do I have to do?

My HASS is on a raspberry pi 3 with AIO installer in a virtual environment

are you able to launch HASS without xiaomi module?

Yes.
If I take out xiaomi module, it starts as usual with no errors in the log
If I put xiaomi: it does not start, and no activity in the log

run Hass manually from command line and post the log

again, sorry newb here. How do you run hass manually?

p.s. I am in virtual environment

@rave Are you planing to add this to the official home assistant?

(homeassistant_venv) $ hass

Of course that would be great, just need to figure out how to do it