I'm building a Flutter application that should let users connect a Xiaomi Smart Air Purifier 4 Compact to their home Wi-Fi network — similar to how the official Mi Home / Xiaomi Home app does it during first-time device setup.
What I'm trying to achieve:
When you add a new Xiaomi/Mi device in the official app, it typically follows this flow:
Put the device into configuration/pairing mode (usually a blinking LED after a reset or button press).
The phone connects either to the device's temporary Wi-Fi hotspot (AP mode) or broadcasts Wi-Fi credentials to the device over the phone's own Wi-Fi (SmartConfig / EasyLink, which uses UDP multicast/broadcast packets encoding the SSID and password).
The device receives the credentials, joins the home network, and then registers itself with the Xiaomi cloud/account.
I want to replicate this device-to-Wi-Fi provisioning step in my own Flutter app using Dart, without relying on the Mi Home app.
What I've tried / researched so far:
Looked into the
wifi_iotandnetwork_info_plusFlutter packages to manage phone Wi-Fi connections and read SSID info.Found that Xiaomi devices commonly support a provisioning protocol (similar to ESP-Touch/SmartConfig used by many IoT vendors), but I haven't found official documentation or an open protocol spec for miIO-based devices.
Considered connecting to the purifier's AP hotspot directly using
wifi_iot'sconnect()method and then sending an HTTP/UDP request with the target SSID/password, but I'm unsure of the exact endpoint, port, or payload format the Xiaomi firmware expects.
My questions:
Is there a documented or reverse-engineered protocol for provisioning Xiaomi/Mi Home devices (specifically newer "miIO" or "MIoT" spec devices like the Air Purifier 4 Compact) over Wi-Fi from a custom app?
Are there any open-source Dart/Flutter packages or reference implementations (e.g., ports of
python-miioor similar) that handle this handshake?If direct provisioning isn't feasible without Xiaomi's proprietary cloud/SDK, is there a supported Xiaomi IoT Developer Platform API that allows triggering this pairing flow from a third-party app instead?