MQTT - danielfernau/ha-ecoflow-powerocean GitHub Wiki

Retrieve credentials

POST https://api-e.ecoflow.com/auth/login

Body

{
  "source": "IOT_APP",
  "scene": "IOT_APP",
  "oauth": {
    "bundleId": "com.ef.EcoFlow"
  },
  "countryCode": "DE",
  "email": "[email protected]",
  "password": "base64encodedpassword",
  "userType": "ECOFLOW",
  "os": "linux",
  "osVersion": "5.15.153.1-microsoft-standard-WSL2",
  "appVersion": "0.1.0"
}

returns

{
    "code": "0",
    "message": "Success",
    "data": {
        "user": {
            "userId": "numericalUserId",
            "account": 12345678987654321,
            "email": "[email protected]",
            "name": "username",
            "icon": "https://cdn-ecoflow-service-eu-prod.ecoflow.com/symlink/*************",
            "state": 0,
            "regtype": "email",
            "createTime": "2022-01-01 23:46:57",
            "destroyed": "NORMAL",
            "registerLang": "en_US",
            "source": "SHOPIFY_USA",
            "administrator": false,
            "appid": 7,
            "countryCode": "DE"
        },
        "token": "veryLongBearerToken",
        "oauth": {
            "bundleId": "com.ef.EcoFlow"
        }
    },
    "eagleEyeTraceId": "*****",
    "tid": ""
}

Retrieve MQTT login details

GET https://api-e.ecoflow.com/iot-auth/app/certification

Authorization type Bearer with token from previous response.

Returns

{
    "code": "0",
    "message": "Success",
    "data": {
        "url": "mqtt-e.ecoflow.com",
        "port": "8883",
        "protocol": "mqtts",
        "certificateAccount": "app-*******",
        "certificatePassword": "*******"
    },
    "eagleEyeTraceId": "ea1a2a582517256354093661742d0007",
    "tid": ""
}

Connecting to MQTT Server

Use protocol, URL, and port from previous response with MQTTv5 client.

ID needs to be in format WEB_{random_uuid}_{userId}, where userId can be found in response from first authentication step.