Xiaomi gateway integration - help needed

great, i’ll give that a try. this worked for you?

Yea, it works perfectly now :slight_smile:

ok, i got the router today and tried - unfortunately it still changed nothing it agains shows the “invalid key” notice.
i again checked the key via ios and android.

what i did: i got the new router (tplink archer c2) and linked it to the original router which is now just serving as a modem. then i attached rasp pi 3/hass.io to the new router and also added the xiaomi gateway to the network of the new router. a changed the details in the config, but nothing happens. it again shows the invalid key message. i did the same to test it with a smart plug, this worked perfectly.

could you give me a hint what i can still try to get this running? i really would like to use this gateway, as the temperature sensors are really reasonably priced and i would like to monitor all my rooms with them.

would be great, if you have fürther hints for me, thanks!

What’s the distance between router (archer c2) and your xiaomi gateway? Packet loss would be a big problem, too. cp. https://github.com/Danielhiversen/PyXiaomiGateway/issues/26

just to test it, i set them very close together. it’s less than 5 metres.

i just read, that another user solved it by using capitals instead of lower case for the key. i tried this already - but for another router - so i’ll give this another try with the archer c2. it’s the only thing i know left to try.

I would try a fresh install of raspbian and HA.

1 Like

Good day, want to try these WALL switches and would appreciate some information.
Do these provide state back to HA? So changes in the switch are seen in HA and vice versa?

And can I set 2 gateways to ensure proper coverage throughout the house?

Thank you
.

Anyone got one of these Xiaomi LCD thermometeres? I believe as they are bt they will need a completely different component?
https://www.gearbest.com/robot-vacuum-accessories/pp_1306883.html

@moskovskiy82 No but they look really nice!

There is a list of supported devices in de docs and a description on how to configure multiple gateways.

Hi,
Do you try to generate the key with android or iOS?
Generate key at iOS will not work at this moment. You get a wrong key.
Generate key at Android is the solution for me. I get the right key with lowercase.

Maybe this is a solution for you.

For what it’s worth, I generated my key on iOS and it worked fine. (Did it in mid-December 2017 I think)

Ive had the Xiaomi Gateway working for months without any issues. The day before yesterday friends discconected the GW by accident and it was off for a couple of hours. Now I cant get it to connect with HASS.

setup:
hass.io 0.61.1 on a raspberrypi3.
router is an ASUS RT-AC66U
my previous config was

xiaomi_aqara:
  gateways:
    key: txteldj5wtn8eeb8

Documentation shows that my config is out of date, but it was working. I couldn’t even get the GW to connect with the MI app properly. After hours of trying different config options and resetting the GW/password I’m at a loss. I haven’t updated my router so I doubt its a problem with my router.

(I think it somehow turned out to be a router problem. I ended up factory resetting my router and it seemed to fix it. The main tell for me was the MI Home Gateway app. If you go to general settings then to network info. It should say “local connection” instead of “Remote connection.” )

Hey guys,

This is my first post here. I just bought a Raspberry PI 3 B+ and setup Home Assistant. I had working fine with a PICO PI I had previously. All of the sudden Hass could not find my Xiaomi Gateway, after much troubleshooting I managed to pin point where my issue is.
First, this is what I started getting from Hass:

**=====**
**2018-06-20 17:24:48 ERROR (SyncWorker_5) [homeassistant.components.xiaomi_aqara] No gateway discovered**
**2018-06-20 17:24:48 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi_aqara: Component failed to initialize.**
**=====**

I noticed that after I started using OpenVPN that my issue started, and I believe it has to do with the static routes OpenVPN sets up when I establish a tunnel with my Cloud Server.

Original route (Hass find the Xiaomi Gateway, all works fine):

**=====**
**root@raspberrypi:~# route -n**
**Kernel IP routing table**
**Destination     Gateway         Genmask         Flags Metric Ref    Use Iface**
**0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 eth0**
**192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0**
**root@raspberrypi:~# ip route get 224.0.0.50**
**multicast e000:32:800:400:200:0:800:700 dev eth0 src 192.168.1.113**
**    cache <mc>**
**=====**

Once I start the VPN I noticed that the multicast address changes the route. Multicast going through the VPN:

**====**
**root@raspberrypi:~# route -n**
**Kernel IP routing table**
**Destination     Gateway         Genmask         Flags Metric Ref    Use Iface**
**0.0.0.0         10.8.0.13       128.0.0.0       UG    0      0        0 tun0**
**0.0.0.0         192.168.1.1     0.0.0.0         UG    202    0        0 eth0**
**10.8.0.1        10.8.0.13       255.255.255.255 UGH   0      0        0 tun0**
**10.8.0.13       0.0.0.0         255.255.255.255 UH    0      0        0 tun0**
**128.0.0.0       10.8.0.13       128.0.0.0       UG    0      0        0 tun0**
**162.242.211.145 192.168.1.1     255.255.255.255 UGH   0      0        0 eth0**
**192.168.1.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0**
**root@raspberrypi:~# ip route get 224.0.0.50**
**multicast e000:32:800:400:400:0:800:700 dev tun0 src 10.8.0.14**
**    cache <mc>**
**=====**

I tried adding a static route to multicast but no success:

**=====**
**root@raspberrypi:~# ip route get 224.0.0.50**
**224.0.0.50 via 192.168.1.1 dev eth0 src 192.168.1.113**
**    cache**
**=====**

Network and route always scared me. Anyone has any ideas to get around that? I need OpenVPN working otherwise I can access my Raspbian from outside.

Cheers,
Raf

Please edit your post so we can actually read it. Next post your config (using the < / > button!), and finally, note the RPI 3b+ is not supported yet.

Pretty rude to shout in your first post!

Hi,

I’m a newbie in linux etc…
How can I do this (step by step):
(and how can I check my host name?)

–net=host

(It should be explained better here (troubleshooting) xiaomi gateway)

Thx,

Hi @garvarma,

I also have a livebox. The gateway is discovered and listed on the home page but I can’t interact with it. (switch light on/off)
I’m just getting {“error”:”Invalid key”} when I try to switch the light on.

Have you find a way to make it work ?

Best regards,

You need the key in configuration.yaml - see the docs.

I updated the doc stating that multicast support is a must-have https://www.home-assistant.io/components/xiaomi_aqara/#connection-problem

(yes, the gw can be detected without multicast support but it needs to be enabled to communicate with it)

1 Like