APP SDK

If needs to integrate the Aqara device into a third-party APP, the developer can choose to integrate the SDK.

There are currently two types of SDK: SDK without UI, all front-end pages need to be designed and developed by the developer; SDK with UI, provides SDK and demo with Aqara style, developers can also replace with their own brand UI interaction style.

The APP SDK is generally suitable for virtual account authorization. For the authorization process, please refer to "Authorization management-Obtain virtual account authorization through API" page.

SDK without UI

The SDK is only used for add gateway device, and add the sub-device through the write.device.openConnect interface.

The process is as follows:

SDK process

Note: Since IOS is mandatory for Homekit, the device with Homekit function needs to be equipped with Homekit process when adding it using IOS mobile phone.

SDK with UI

The SDK with UI will provide a standardized UI interactive page in Aqara style. Developers can use it directly or change the interactive UI design according to their own APP style.

SDK integration instructions

Integration process is as follows:

UISDK API

Currently we haven't provided download link for this SDK. If you have any requirements, please consult Lumi Oversea Business. Thanks.

Get UI-SDK initialization parameter interface

  • Request parameters: NA

  • Request demo

{
    "intent": "config.app.init", 
    "data": {
    }
}
  • Response parameters
Name Type Description
userId String Aqara user unique id
token String APP sdk access token for lumi service
appRequestDomain String Service domain address requested by APP-SDK
expiresIn Int Token expiration time, in seconds
positionId String Default position
baseH5Url String H5 URL of SDK
baseImageUrl String Image CDN address of SDK
appId String SDK initialization parameter
appKey String SDK initialization parameter
  • Response demo
{
"code": 0,
    "requestId": "",
    "message": "Success",
    "msgDetails": null,
    "result": {
        "expiresIn":2592000,
        "baseImageUrl":"https://xxxxx.aqara.com",
        "appRequestDomain":"xxxx.aqara.cn",
        "appKey":"axasdasxasdsadasxxxxx",
        "baseH5Url":"https://xxxxx.aqara.com/index.html",
        "userId":"U0211163631238521600",
        "token":"open9ee4f2c01234504b540ac8f0458de6807cd5",
        "appId":"2070959b27312310327168c4"
    }
}

Notify token expiration interface

  • Request parameters
Name Type Is required? Description
token String Yes APP sdk access token for lumi service
  • Request demo
{
    "intent": "config.app.tokenExpire", 
    "data": {
        "token": "xxx"
    }
}
  • Response parameters: NA

  • Response demo

{
"code": 0,
    "requestId": "",
    "message": "Success",
    "msgDetails": null
}

Message Push

The message push process is as follows:

UISDK MESSAGE

Request Description

Request URL: The message receiving address configured on the message push page. (Login to Aqara Developer Platform-Console, Application Management-Message push settings page), example: https://xx.xx.com/aqara/app/message

Request Method: HTTP POST (application/json)

Request header parameters:

Name Type Is required? Description
time String Yes Request time
nonce String Yes Request a random number to guarantee the uniqueness of the request
appkey String No Request the signature key
If the configuration is turned on, it will be returned.
sign String No Request signature
If the configuration is turned on, it will be returned.

Signature rules:

  1. The parameters(appkey, nonce, time) requested by the head are first sorted according to the ASCII code, and then spliced.

    Splice method: appkey=xxx&nonce=xxx&time=xxx

  2. Splice appSecret with the string generated in the second step.

    Example: appkey=xxx&nonce=xxx&time=xxx&appSecret

  3. Do lowercase processing for the string generated in the second step.

  4. MD5 32-bit for the character generated in the third step, and the generated number is the value of Sign.

Note: Sign is not enabled by default. If you need to enable signature, you need to configure appKey (signature Key) and appSecret (signature secret key) on Aqara Developer Platform -Console, Application Management-Message push settings page.

------------------------------------Step 1: splicing header parameters ---------------------
appkey=532cad73c5493193d63d367016b98b27&Nonce=C6wuzd0Qguxzelhb&Time=1618914078668
------------------------------------Step 2: Splicing appSecret parameters ------------------
appkey=532cad73c5493193d63d367016b98b27&Nonce=C6wuzd0Qguxzelhb&Time=1618914078668gU7Qtxi4dWnYAdmudyxni52bWZ58b8uN
------------------------------------Step 3: Lowercase the string ---------------------------
appkey=532cad73c5493193d63d367016b98b27&nonce=c6wuzd0qguxzelhb&time=1618914078668gu7qtxi4dwnyadmudyxni52bwz58b8un
------------------------------------Step 4: MD5 32-bit encryption --------------------------
0e27da9f4c88c27896d1393a64d70392

Request Body parameters

Name Type Is required? Description
token String Yes Terminal push id
Corresponding to push the clientId generated by the third party to the app-sdk, separated by English commas when there are multiple.
data String Yes Specific data pushed to app-sdk

Request Demo

{
    "token":"xxx,xxx",
    "data":"xxxx"
}

Response Format

{
    "code":0
}

Note: When the third-party system receives the pushed HTTP message, please return it according to the above example. If the return format does not meet the requirements, the Aqara system will consider the third-party receiving message system service abnormal, and will stop performing the third-party system under certain conditions.

Copyright © 2023 Lumi United Technology Co., Ltd. all right reserved,powered by GitbookFile Modify: 2024-09-27 21:51:47

results matching ""

    No results matching ""