The pairing process involves transitioning a device from Access Point (AP) mode to a connected state on a domestic Wi-Fi network using an MQTT broker.
- AP Mode: The device creates an open Wi-Fi network named
Meross_<STR1>_<STR2>. - MQTT Configuration: The client app sends a
POST request to the device's IP at /config with the Appliance.Config.Key namespace. This provides the MQTT_HOST, MQTT_PORT, userId, and a secret key. - Wi-Fi Configuration: The client app sends a second
POST request to /config with the Appliance.Config.Wifi namespace, containing the ssid and password (both Base64 encoded). - Connection: The device reboots, connects to the Wi-Fi, and then attempts to connect to the MQTT broker.
# Step 1: Configure MQTT credentials
POST /config HTTP/1.1
Host: <PLUG_IP_ADDRESS>
Content-Type: application/json
{
"header": {
"from": "{{FROM_DEVICE}}",
"messageId": "{{MESSAGE_ID}}",
"timestamp": {{TIMESTAMP}},
"sign": "{{SIGNATURE}}",
"method": "SET",
"namespace": "Appliance.Config.Key",
"triggerSrc": "Android",
"uuid": "{{TARGET_DEVICE_UUID}}"
},
"payload": {
"key": {
"gateway": {
"host":"{{MQTT_HOST}}",
"port":"{{MQTT_PORT}}"
},
"key": "{{KEY}}",
"userId": "{{USER_ID}}"
}
}
}
# Step 2: Configure Wi-Fi credentials
POST /config HTTP/1.1
Host: <PLUG_IP_ADDRESS>
Content-Type: application/json
{
"header": {
"from": "http://10.10.10.1/config",
"messageId": "{{MESSAGE_ID}}",
"timestamp": {{TIMESTAMP}},
"sign": "{{SIGNATURE}}",
"method": "SET",
"namespace": "Appliance.Config.Wifi"
},
"payload": {
"wifi": {
"ssid": "{{BASE64_ENCODED_SSID}}",
"password": "{{BASE64_ENCODED_PASSWORD}}"
}
}
}