Search code examples
node.jsiotgatewayxiaomi

How is Xiaomi2mqtt connected to Aquara hardware device


I've already read the xiaomi2mqtt documentation. What I want to know is that how xiaomi2mqtt is connected to the actual hardware device (Aquara) over the Internet? In another world, I don't understand this part of the documentation:

//Device list:

{
  "device_id": "Nice name",
  "158d000aaa2888": "Bedroom window",
  "158d000aaa5b35": "Frontdoor",
  "gateways": {
    "gateway_id": "password"
  }
}

"158d000aaa2888", "158d000aaa5b35, "gateway_id", "password"

What are these? Where do they from ? What are they used for?


Solution

  • The gateway connects to a chinese cloud service, but it is pretty undocumented.

    Next to that you can enable local network mode. This is what is used by the xiaomi2mqtt app. How to enable it, is documented on the wiki, https://github.com/svrooij/node-xiaomi2mqtt/wiki/Network-mode-iOS

    It works like this

    Gateway -> Wifi -> Chinese cloud api -> MiHome app

    but the xiaomi2mqtt app uses the following:

    Gateway (with local mode enabled) -> Wifi (multicast messages) -> xiaomi2mqtt (running on device on same network).

    Ps. posting stuff in closed unrelated issues, doesn't really help...