Xiaomi Gateway Integration

Same for me as well. I upgraded to the newest version of the firmware when reconnecting it to my wifi, which apparently was a mistake, and sadly it isn’t working anymore (it’s giving me the same error niai posted.

It had been working properly with an older firmware version for months now, so it’s definitely related to the upgrade.

Oooh! I mixed up “double_click” and “both_click” and the 86sw2 (wall double switch) with the wireless button. :frowning:

May be this messages can help to implement both_click of the 86sw2:

MCAST (report) << {'cmd': 'report', 'data': '{"dual_channel":"both_click"}', 'short_id': 51102, 'model': '86sw2', 'sid': '158d000xxxxxxx'}
PUSH >> <Entity Wall Switch (Left)_158d000xxxxxxx: off>: {'dual_channel': 'both_click'}
PUSH >> <Entity Wall Switch (Right)_158d000xxxxxxx: off>: {'dual_channel': 'both_click'}

I have implemented the both_click event: https://github.com/Danielhiversen/homeassistant/pull/14

Thanks, just merged it

@syssi what is in the log when you press both buttons? All three switches reports both_click?

Take a look here: https://github.com/Danielhiversen/homeassistant/pull/14

The message is filtered by the data key “channel_{0,1}” vs. “dual_channel”. Therefore the event is just fired once by:

[homeassistant.core] Bus:Handling <Event click[L]: entity_id=binary_sensor.wall_switch_both_158d000xxxxxxx, click_type=both>

hey guys, just received my Hub but I’m not able to find the options to get the Hub’s key (as explained at http://bbs.xiaomi.cn/t-13198850)

This is what I get!

I’ve searched all around the app but there’s no way to access network settings or something like that. Am I missing something?

Choose ‘About’ and then you should see a screen like this:

Touch repeatedly on the blank space right below Tutorial until this appears:

After this, I think you can follow the instructions that you can find here.

1 Like

thanks so much man! I didn’t see the “touch repeatedly” to show these options on the tutorial website!

No worries, I went through the same, it was still fresh in my mind.

Yea, I had missed enabling the local LAN control as it wasnt in English on my app… So now my YAML looks like
- sid: redacted
key: redacted

but I still get
2017-05-31 12:36:30 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 188, in _async_setup_component
None, component.setup, hass, processed_config)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/pi/.homeassistant/custom_components/xiaomi.py”, line 61, in setup
gateway[‘sid’] = gateway[‘sid’].replace(":", “”).lower()
AttributeError: ‘int’ object has no attribute ‘replace’

Any ideas?

I might do a PR to the repository to explain this better using your post!

I only have these settings as I only have one gateway, try as the follows:

    - sid:
      key: REDACTED

Only add your key!

The procedure is already documented in fooxys repo here:

This is linked in this thread (more than once I think) but its tricky for new users to find since its not linked directly from rave or daniels repos.

If I only use my key, I get
2017-05-31 13:23:58 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/setup.py”, line 188, in _async_setup_component
None, component.setup, hass, processed_config)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/pi/.homeassistant/custom_components/xiaomi.py”, line 77, in setup
File “/home/pi/.homeassistant/custom_components/xiaomi.py”, line 167, in discover_gateways
self.gateways[ip_add] = XiaomiGateway(ip_add, port, sid, gateway_key, self._socket)
File “/home/pi/.homeassistant/custom_components/xiaomi.py”, line 262, in init
if self._discover_devices():
File “/home/pi/.homeassistant/custom_components/xiaomi.py”, line 271, in _discover_devices
File “/home/pi/.homeassistant/custom_components/xiaomi.py”, line 368, in update_key
from Crypto.Cipher import AES
File “/home/pi/.homeassistant/deps/Crypto/Cipher/AES.py”, line 50, in
from Crypto.Cipher import _AES
ImportError: cannot import name ‘_AES’

Edit: I get get this w/ both pycrypto and pycryptodome

Does anybody use aqara wall plug? It’s still unsupported now.

Hello @all

I want to automate my heating in my house (I have 10+ electric heater), I already have temperateur sensor in all rooms, I want to simply start/stop heater depending on sensors.

Question is : how can I control my heaters with Xiaomi devices ?

(I was about to add Chacon 54755 micro modules and a rfxcom but maybe there’s a trick I did not get)

My heaters are not connected to a plug, they are directly linked to wires so using a wall plug is not the “easy” solution… (maybe someone has already “opened” a Xiaomi plug and solder wire directly on it ?)

You would be better off with a SONOFF http://sonoff.itead.cc/en/products/sonoff/sonoff-basic

1 Like

100% agree. The sonoffs are pretty much exactly what you are after:
Cheap, designed to be connected inline (as opposed to a socket), supported by HA, can switch 10A (and also 16A versions)

Just remember to check how powerful your heaters are before buying as a quick google says the 10A has a power limit of 2200w and going over that could have very serious consequences, if you don’t like house fires. If they’re based on the same voltage the 16A can do ~3500w.

fyi The Xiaomi Zigbee/Wifi plugs are also 2200w and the Aircon Companion plug is 3500w, which probably isn’t a coincidence.