Xiaomi Gateway Integration

P.S. do you think the zigbee support in hass can allow to directly get the data from the sensors without going through the hub, similar to SmartThings?

Unfortunately i don’t think there’s any good Zigbee support in HA. Zwave is great using usb stick but there’s no similar tool for Zigbee

So you do need a Zigbee coordinator whether it’s ST hub or Xiaomi gateway.

It works! Thanks a lot viakruzis. :smiley:[quote=“viakruzis, post:911, topic:8213, full:true”]
I have solved this by deleting/renaming the folder /home/homeassistant/.homeassistant/deps/Crypto

In your install it should be /var/opt/homeassistant/deps/Crypto
[/quote]

I’ve had the same problem. I’ve solved it by changing gateway brightness in mi home app.

Is there anyway to make Xiaomi Gateway change color in Apple Home app? now it can change brightness only.

I didn’t try to reinitialize if you mean that, i just manual opened and closed the window.

i ordered now another gateway just to make sure its not a hardware bug, i don’t think so…but just to make sure… as in the mi home app itself the issue never appeared.

Did you update and commit the code already?.. as i will update and report back.

Strange is that it happens with loosing gateway connection… i was a couple posts before wrong, it sends the heartbeat wrong out not the report mcast.

Hey,

Can you share me your code?
did not working for me :frowning:

Hi all,

I am a SmartThings user thinking about switching at least part of my home automation to Home Assistant.

I have some questions and would be grateful if some of you good people could provide some info.

  1. When integrating the Xiaomi Gateway is all processing local? I am so tired of the SmartThings cloud related problems.
  2. Is it stable? Is it reliable? Would you trust xiaomi door sensors connected to the gateway that is integrated to sound a z-wave siren?
  3. Is there any possibility that Xiaomi can shut the project down via a FW update or any other way?
  4. Is it possible to have the Xiaomi Gateway integrated with both Home Assistant and home bridge??
  5. Would a Raspberry Pi 3 be enough for running both servers?

Thank you very much in advance.

  1. Just local
  2. No, I would not connect a siren to it
  3. yes, they can shut it down whenever they want to. And it also seams that the gateway needs an internet connection to work. That means that they can probably stop your access to the gateway when they want, (without any FW update).
  4. I would guess so.
  5. HA runs fine on a Pi, but do not know when it have to share the resources with home bridge

Thank you for your reply. It is not what I wanted to hear, but still it is what i needed to know.

:slight_smile:

[quote=“Danielhiversen, post:943, topic:8213, full:true”]
3) yes, they can shut it down whenever they want to. And it also seams that the gateway needs an internet connection to work. That means that they can probably stop your access to the gateway when they want, (without any FW update)[/quote]

I’ve shut off internet access to the gateway and it worked just fine. I think the only time it requires internet access is when adding sensors, but after that it kept on working. What’s your experience?

@ktsi I’m running home assistant and homebridge (interfacing only with home assistant) on a Raspberry Pi 2 and the average cpu load is 2-3%.

This is interesting. How about stability?

HASS used to go berserk and do 25% cpu (maxes out 1 core) but this was most probably caused by the z-wave component and that was fixed a few versions back and hasn’t resurfaced.

Would you trust the HASS & Xiaomi Gateway integration for security? Would you trigger a siren?

Just got this setup as I received my devices today. Such an easy process, thanks @rave !

It seems it doesn’t play nicely with the pilight component - I get the following error. If I remove the custom_components folder (which only contains Xiaomi), pilight works as it did previously.
Any ideas?

17-02-24 22:41:02 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component pilight
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/bootstrap.py", line 152, in _async_setup_component
None, component.setup, hass, config)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self  # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/pilight.py", line 67, in setup
pilight_client = pilight.Client(host=host, port=port)
AttributeError: 'module' object has no attribute 'Client'
  1. i have both HA and homebridge on the same pi. No issues so far.

Presuming this question is for me - NO! Currently I would not. As a matter of fact my PIR and my door/window sensor currently show motion and there is no motion. They are stuck in this state even though no motion was observed.

If you want something wireless to monitor motion and trigger a siren - go for zwave. My aeotec multisensor hasn’t had a false positive so far. Personally I wouldn’t trust anything but wired PIRs for security and firing up a siren.

I’ve been using the gateway and door sensors for more than 6 months. I’ve never received any complaints from my neighbors about continuous non stop false siren alarm.
This is not using the hass though, it’s where the problem is.

I’m wondering if anyone can help me solve my no history issue. I’ve been pulling my hair out on this one. Install is HASS on Ubuntu server 16.04. I’ve tried normal install, docker and also virtualenv. When I enable xiaomi in configuration.yaml, I don’t get history. Strangely this was working a 2 weeks ago, then I noticed one day that I don’t have any history anymore so I restarted HA and never hot history ever again.

It looks like something is really wrong with HA recorder. On startup I get the following error:

Exception in thread Thread-11:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/recorder/__init__.py", line 238, in run
    domain = split_entity_id(entity_id)[0]
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/core.py", line 66, in split_entity_id
    return entity_id.split(".", 1)
AttributeError: 'NoneType' object has no attribute 'split

I’m at the point where I’m thinking of just giving up on Linux and go back to a windows install!

@rave, I experienced another power outage and here’s what I got. Not all the sensors had this issue, only two motion sensors. I looked on the logs and it kept getting this logs for the 2 sensors:

17-02-25 20:34:35 DEBUG (MainThread) [custom_components.xiaomi] >> b'{ "cmd":"read","sid":"158d0001536dbf"}'
17-02-25 20:34:35 DEBUG (MainThread) [custom_components.xiaomi] << {'sid': '158d0001536dbf', 'data': '{"status":"motion"}', 'cmd': 'read_ack', 'model': 'motion', 'short_id': 51032}
17-02-25 20:34:35 DEBUG (MainThread) [custom_components.xiaomi] >> b'{ "cmd":"read","sid":"158d00012daec2"}'
17-02-25 20:34:35 DEBUG (MainThread) [custom_components.xiaomi] << {'sid': '158d00012daec2', 'data': '{"status":"motion"}', 'cmd': 'read_ack', 'model': 'motion', 'short_id': 47872}

So to resolve the issue, I had to trigger them manually. I got this logs and it now register properly on the hass interface:

17-02-25 20:45:57 DEBUG (MainThread) [custom_components.xiaomi] << {'sid': '158d00012daec2', 'data': '{"status":"motion"}', 'cmd': 'read_ack', 'model': 'motion', 'short_id': 47872}
17-02-25 20:46:07 DEBUG (MainThread) [custom_components.xiaomi] << {'sid': '158d00012daec2', 'data': '{"status":"no_motion"}', 'cmd': 'read_ack', 'model': 'motion', 'short_id': 47872}

I’m not sure how you can fix this since the log look exactly the same as normal working xiaomi sensors.