调用该接口查询设备的食谱制作状态。该接口仅在云食谱应用中使用。
| 接口名称 | mtop.alibaba.aicloud.recipe.getDeviceCurrentStatus |
|---|---|
| 版本号 | 1.0 |
请求参数
| 名称 | 参数类型 | 是否必填 | 描述 |
|---|---|---|---|
| devId | String | 是 | 设备的ID。H5 SDK自动填写,您无需关注。 |
| productKey | String | 是 | 产品的Key,设备证书信息之一。创建产品时,生活物联网平台为该产品颁发的全局唯一标识。H5 SDK自动填写,您无需关注。 |
| params | String | 是 | 请求参数列表。 |
| openAccountId | String | 是 | params的子参数。用户账号的accountId。您可以在SaaS平台的应用开发 > 开发管理中查看。 |
| controlApiName | String | 是 | params的子参数。控制接口名。调用接口可获取该参数的值。 |
| releaseStatus | Number | 是 | params的子参数。表示发布的环境。取值范围如下。 - 1:预发环境 - 2:线上环境 |
| domain | Number | 是 | params的子参数。目前仅云食谱中使用该参数,固定配置为1。 |
| payload | Object | 是 | params的子参数。领域参数,请参见使用该接口的详细描述。 |
返回参数
| 名称 | 参数类型 | 描述 |
|---|---|---|
| success | Boolean | 请求的响应结果。 |
| model | String | 返回参数列表。 |
| retCode | String | model的子参数。接口返回码。此处返回的是字符串对像,需要先通过JSON.parse处理。 |
| retValue | JSON | model的子参数。服务端对设备端下发的控制指令的返回列表。 |
| contentRecipeId | String | 内容食谱ID。 |
| deviceId | String | 设备ID。 |
| runStatus | Integer | 食谱的运行状态。取值如下。 - 0:停止 - 1:运行 - 2:暂停 - 3:食谱完成 - 4:中断暂停 |
| totalTimeleft | Integer | 剩余时间总时间,单位:秒。 |
| productName | String | 产品名称 |
| productKey | String | 产品key |
| controlApiName | String | 控制接口名 |
| deviceStatusApiName | String | 设备状态接口名 |
| businessRecipeId | String | 行业食谱ID。 |
| totalTime | Integer | 总时间,单位秒。 |
| deviceStatus | JSON | 设备状态。 |
| interruptErrorInfo | JSON | 食谱中断的错误码。 |
| extentions | String | model的子参数。扩展参数,暂未启用,可忽略。 |
| statusCode | Object | 接口返回码。与retCode参数的值相同,200表示成功。 |
示例
请求示例
AI.aiRequestMtopProxy({api: 'mtop.alibaba.aicloud.recipe.getDeviceCurrentStatus',data: {devId: AI.devId,productKey: AI.productKey,params: JSON.stringify({openAccountId: "0yl8oK0WFDBwEheQxSMD4g==",deviceStatusApiName: "alibaba.ailabs.iot.saas.deviceStatus",releaseStatus: 2,releaseVersion: null,domain: 1,payload: JSON.stringify({"businessRecipeId": 2})})}}).then((res) => {console.log('返回信息', res);}).catch((res) => {console.log('失败返回', res);});
返回示例
"api": "mtop.alibaba.aicloud.recipe.getDeviceCurrentStatus","data": {"success": "true","model": {"retCode": 200, // 这里返回的是字符串对像,需要先通过JSON.parse处理"retValue": {"contentRecipeId": 1137111, // 内容食谱id"currentContentRecipeStepId": 9420204, // 当前食谱步骤id"deviceId": "a80171320100009715c507da78000000", // 设备id"runStatus": 1, // 运行状态,0 停止 1 运行 2 暂停 3 食谱完成 4 中断暂停"totalTimeleft": 180, // 剩余时间总时间,单位秒"productName": "智能LED灯泡", // 产品名称"productKey": "306", // 产品key"controlApiName": "alibaba.ailabs.iot.saas.devicecontrol", // 控制接口名"deviceStatusApiName": "alibaba.ailabs.iot.saas.deviceStatus", // 设备状态接口名"businessRecipeId": 100, // 行业食谱id"totalTime": 180 // 总时间,单位秒"deviceStatus": {"name":"start/开始","value":1} // 设备状态"interruptErrorInfo": {"code": 302007,"message":"设备处于离线状态"} // 中断错误码},"extentions": null},"statusCode": "200"}}
