Xiaomi Gateway Integration

Well still can’t get a single “alert” action on cube - any tips?

Ans also instead of swing get the following with chinese lady speaking out of gateway
2017-08-12T22:07:34.034435+03:00 home hass[10638]: #033[32m2017-08-12 22:07:34 INFO (MainThread) [homeassistant.core] Bus:Handling <Event cube_action[L]: entity_id=binary_sensor.cube_15xxx, action_type=iam>#

Regarding the subdevice question.

I cannot connect the power outlet that I manage with xiaomi, but I have the indication that is supported. It’s the following:
http://www.gearbest.com/living-appliances/pp_344666.html1

Should I install some kind of add-on to control this power outlet?

Tks!

Hi fastrax!

I also have this wifi plug. Were you able to solve this issue??

This (“iam”) is the pairing event. I don’t remember. Does the cube have a pairing button inside? The voice appears if you press the pairing button of an already paired device. This happens on the wireless wall switch sometimes if you press both buttons at the same time, because the device doesn’t have a pairing button and the pairing is bound to this combination.

What’s the firmware version of your gateway? Try to add the device without the mi home app: Press the button of the gateway three times and the pairing button of the device once. If the device was already paired with another gateway (by accident?) press the pairing button for 20 seconds. The device/blue led will blink a few times. Now you can pair the device again: Gateway button 3 times + Pairing button of the device once.

I wrote a custom component to integrate the xiaomi wifi plug into home assistant:

It’s discussed here: https://community.home-assistant.io/t/xiaomi-mi-wifi-plug-air-purifier/

1 Like

thanks! mine is the single button switch so I am guessing that is the same… dead dead dead and useless now :frowning:

To clarify it: There is a “wifi version” and a “zigbee” version. The zigbee version works fine with the xiaomi component, because it’s zigbee and paired like any other device. The wifi version needs another protocol and must be integrated separately into home assistant. f.e. by the xiaomiplug custom component.There is no official support of the device so far.

Furthermore: The wifi version cannot measure power consumption / load / is used. The zigbee version reports this values. If you want to buy one of these devices: Take the zigbee one. :wink:

Did I get it right: It’s possible to create a automation (at the mi home app), which connects a wireless button (or another subdevice) which the arm/disarm function of the gateway? In this case the automation could be triggered by a virtual button event.

Yes and such automation was already activated on Mi Gateway first time I installed it.

1 Like

I made a pull request for a breaking change of the xiaomi zigbee plug attributes (@nikno, @anon35356645, @davidlamd89)! If you are using some attributes of the xiaomi plug your templates needs to be updated soon:


The attributes can be accessed by “load_power”, “power_consumed” and “in_use” in future.

2 Likes

Hi guys, I used to use the xiaomi_gw to interact with the Xiaomi Gateway.
The HA instalation is HASSio
After seeing this topic I have tried to use this way of integration.
What I have done till now:

  • replaced
xiaomi:
  gateways:
   - mac:
     key: xyz

with

xiaomi:
gateways:

  • sid:
    key: xyz
  • created a new directory called custom_components and pasted the archive content:

core-ssh:/config/custom_components# ls -alh
total 48
drwxrwxrwx 7 root root 4.0K Aug 13 11:30 .
drwxr-xr-x 5 root root 4.0K Aug 13 12:08 …
drwxr-xr-x 2 root root 4.0K Aug 13 11:30 pycache
drwxr-xr-x 2 root root 4.0K Aug 13 11:25 binary_sensor
drwxr-xr-x 2 root root 4.0K Aug 13 11:25 light
drwxr-xr-x 2 root root 4.0K Aug 13 11:25 sensor
drwxr-xr-x 2 root root 4.0K Aug 13 11:25 switch
-rwxr–r-- 1 root root 17.8K Jun 25 09:33 xiaomi.py

After rebooting the HA I get some errors:

2017-08-13 11:57:59 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”, line 194, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/lib/python3.6/asyncio/futures.py”, line 331, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/xiaomi.py”, line 60, in setup
sid = gateway[‘sid’]
KeyError: ‘sid’

From were should I start to solve this issue?
Thanks in advance

Remove the xiaomi component from the custom_component folder. If you use home assistant > 0.50 the xiaomi component is already included.

Should I remove xiaomi.py from custom_components? Yes, I’m using HA ver. 0.51.0

-rwxr–r-- 1 root root 17.8K Jun 25 09:33 xiaomi.py

`

Please post the complete content of your custom_component folder (“find custom_component”). I assume you can remove all files. :wink:

custom_component content:

core-ssh:/config/custom_components# ls -alh
total 28
drwxrwxrwx 7 root root 4.0K Aug 13 12:43 .
drwxr-xr-x 5 root root 4.0K Aug 13 12:46 …
drwxr-xr-x 2 root root 4.0K Aug 13 11:30 pycache
drwxr-xr-x 3 root root 4.0K Aug 13 12:37 binary_sensor
drwxr-xr-x 3 root root 4.0K Aug 13 12:37 light
drwxr-xr-x 3 root root 4.0K Aug 13 12:37 sensor
drwxr-xr-x 3 root root 4.0K Aug 13 12:37 switch
core-ssh:/config/custom_components# pwd
/config/custom_components

I ran logger in HA for Xiaomi and can confirm the switch status click on the single switch doesn’t get recorded in HA

I’ve been trawling through this thread to try and find the difference between the new and old button.

So apologies if it’s already been answered but is there a difference in terms of functionality? E.g double click, long press etc? Thanks :slight_smile:

Please use “find .” instead of “ls -alh” in the custom_component folder. I’m interested in the content of binary_sensor, light, sensor and so on. Please remove all xiaomi.py files. There must be one per folder. The light is another custom_component I think. Please don’t touch it.