AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.46k stars 343 forks source link

Xiaomi Multimode Gateway 2 (EU) - Device Offline #1045

Closed AdrianKuta closed 1 year ago

AdrianKuta commented 1 year ago

Currently I have two gateways in my network:

  1. Xiaomi Gateway v3 - ZNDMWG03LM
  2. Xiaomi Multimode Gateway 2 (EU) / Xiaomi Smart Home Hub 2- ZNDMWG04LM - lumi.gateway.mgl001

Both are in the same network. I was able to add integration for the first one, without any problems. But I can't connect to my second gateway. Gateway is added to my Xiaomi Home app and is online. I used mail and password to add integration in Home Assistant. So when I clicks 'Add integration -> Xiaomi Gateway 3' I see option for my second gateway (ip address is correct):

image

But every time I try to add it, I received error "can't connect to gateway" - or similar. And in system logs I see info "Device offline":

image

Do any of you have any ideas what could be wrong?

AlexxIT commented 1 year ago

Are you sure that IP address correct? Your server in same LAN network segment? And you don't have any restrictions between local devices?

AdrianKuta commented 1 year ago

Ok, server was in subnet 192.168.23.0/24 and gateway was in 192.168.7.0/24. I moved gateway to the same subnet as server, and now it's working 👍 Second gateway (Xiaomi Gateway v3 - ZNDMWG03LM) is working even if it's in different subnet 🤔

Thank you for your help!

AlexxIT commented 1 year ago

The problem will be only after gateway restart. Integration uses miio protocol only for opening telnet. But miio protocol won't answer on request from another subnet. The first gateway will execute the command from the other subnet, but will not respond to it. How the second gateway will behave, I do not know. I haven't tried it.