Xiaomi Gateway Integration

Excuse me Claudio, where I can find a roadmap for the releases?
I want to be sure to be able to update my sensors before my holiday trip away from home!

I don’t know, usually is once a week, ten days. So should be any day soon.

Hope so, my gateway is due any day! Lol

Could you share how did you make it works?

Home assistant cannot find the component, I send the log. Any ideas?

Here’s the folder location:

components folder is in the .homeassistant folder

Your directory structure is wrong. Inside of “components” must be a xiaomi.py and subfolders with components (binary_sensor, sensor, switch,…).

1 Like

Thanks for the fast reply! It’s working now :slight_smile:

1 Like

For some reason I can’t find the temp/humidity sensor. Is it supported?

A simple search will get you the answer. :slight_smile:

I have the temp sensor and it’s on the gateway, I just can’t get it to be seen in HA. And also is there a way to convert it from C to F?

Well, I started with a working hassbian installation running HASS 0.49. backup everything from the .homeassistant folder, then go through the hass.io setup here. After that, just copy everything form the .homeassistant into hass.io’s config directory(smb://hassio.local/config), including the custom_components folder and restart.

You can leave behind the log file and the db file.

I feel totally stupid. The lazcad version is working nice. But as soon as I install Daniel’s version it fails.

Anybody ? Thanks in advance.

2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.sensor.xiaomi. 
Make sure all dependencies are installed Traceback (most recent call last): 
File "/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py", line 141, 
in get_component module = importlib.import_module(path) File "/usr/lib/python3.4/importlib/__init__.py", line 109, 
in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", 
line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", 
line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", l
ine 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/home/hass/.homeassistant/custom_components/sensor/xiaomi.py", line 4, in <module> from homeassistant.components.xiaomi import (PY_XIAOMI_GATEWAY, XiaomiDevice) ImportError: No module named 'homeassistant.components.xiaomi' 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Unable to find component sensor.xiaomi 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.xiaomi: Platform not found. 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.light.xiaomi. Make sure all dependencies are installed Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py", line 141, in get_component module = importlib.import_module(path) File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/home/hass/.homeassistant/custom_components/light/xiaomi.py", line 5, in <module> from homeassistant.components.xiaomi import (PY_XIAOMI_GATEWAY, XiaomiDevice) ImportError: No module named 'homeassistant.components.xiaomi' 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Unable to find component light.xiaomi 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform light.xiaomi: Platform not found. 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.binary_sensor.xiaomi. Make sure all dependencies are installed Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py", line 141, in get_component module = importlib.import_module(path) File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/home/hass/.homeassistant/custom_components/binary_sensor/xiaomi.py", line 5, in <module> from homeassistant.components.xiaomi import (PY_XIAOMI_GATEWAY, XiaomiDevice) ImportError: No module named 'homeassistant.components.xiaomi' 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Unable to find component binary_sensor.xiaomi 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform binary_sensor.xiaomi: Platform not found. 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.switch.xiaomi. Make sure all dependencies are installed Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py", line 141, in get_component module = importlib.import_module(path) File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/home/hass/.homeassistant/custom_components/switch/xiaomi.py", line 5, in <module> from homeassistant.components.xiaomi import (PY_XIAOMI_GATEWAY, XiaomiDevice) ImportError: No module named 'homeassistant.components.xiaomi' 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Unable to find component switch.xiaomi 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.xiaomi: Platform not found. 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.cover.xiaomi. Make sure all dependencies are installed Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py", line 141, in get_component module = importlib.import_module(path) File "/usr/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 2254, in _gcd_import File "<frozen importlib._bootstrap>", line 2237, in _find_and_load File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked File "<frozen importlib._bootstrap>", line 1129, in _exec File "<frozen importlib._bootstrap>", line 1471, in exec_module File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed File "/home/hass/.homeassistant/custom_components/cover/xiaomi.py", line 5, in <module> from homeassistant.components.xiaomi import (PY_XIAOMI_GATEWAY, XiaomiDevice) ImportError: No module named 'homeassistant.components.xiaomi' 2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.loader] Unable to find component cover.xiaomi 
2017-07-28 21:43:43 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform cover.xiaomi: Platform not found.

Have you looked into the developer states (open the left hand menu and then click the second button from left in the row of 5 below where it says Developer Tools)?

Look for something like sensor.temperature_158dxxxxxxxxxx or sensor.humidity_158dxxxxxxxxxx (the x will be replaced by characters specific to your sensor).

If you can’t find it, have you restarted HASS already after adding the sensor to Mi Home? I suppose you have the developer mode activated for the gateway already, have you?

As far as I could check Xiaomi component only returns values in Celsius, but you can always convert it to Fahrenheit with the help of a template sensor in HASS.

There is no sensor.temperature*** and yes I have the key entered into hass and used the mac address as sid.

Do you have any other sensor that appears?

Yes the door sensors and gateway light I have are showing up and are functioning.

And have you tried restarting HASS, disconnecting the gateway, the normal things?

I’ve rebooted the gateway a couple times and restarted hass. I haven’t tried to reboot the hass server tho.

Next thing would be to activate debug logger for xiaomi component and see what HASS says about it.