#### 2.在产品详情的物模型中创建设备上传的"key":"value"对应的物模型,如下图为例。
#### 3.在产品详情的可视化中添加低代码,如下图为例。
#### 4.点击设计编辑低代码,先编辑成产品的低代码用以添加平台的key与上传设备的key进行关联,如下图。
```
产品低代码例子,以实际产品为准:
{
"type": "form",
"api": {
"url": "iotapi/classes/Device/parse_objectid",
"method": "put",
"headers": {
"store": "localStorage",
"dgiotReplace": "parse_objectid"
},
"dataType": "json",
"requestAdaptor": "return {\r\n \"status\":0,\r\n \"msg\":\"\",\r\n \"data\":response\r\n }"
},
"body": [
{
"id": "u:52fbc3355570",
"mode": "inline",
"name": "Ctrl",
"type": "switch",
"label": "开关机",
"onText": "开",
"option": "",
"offText": "关",
"trueValue": 1,
"falseValue": 0,
"validateApi": {
"url": "iotapi/amis/Product/b5f75b59a3",
"method": "put",
"requestAdaptor": "return {\r\n ...api,\r\n data:{\r\n profile:{\r\n Ctrl:api.data.Ctrl \r\n }\r\n }\r\n}"
},
"submitOnChange": true
}
],
"title": "开关机控制器",
"trueValue": true,
"falseValue": false,
"submitText": "",
"optionAtLeft": false
}
```
#### 5.在产品详情的可视化中找到刚刚创建的低代码,点击预览,点击一下开关机添加平台key,如下图。
#### 6.在产品详情的物模型中找到刚刚创建的物模型,点击编辑,关联平台key与设备key,如下图。
#### 7.在产品详情的可视化中找到刚刚创建的低代码,点击设计,修改为设备的低代码,如下图。
```
设备低代码示例:
{
"type": "form",
"api": {
"url": "iotapi/classes/Device/parse_objectid",
"method": "put",
"headers": {
"store": "localStorage",
"dgiotReplace": "parse_objectid"
},
"dataType": "json",
"requestAdaptor": "return {\r\n \"status\":0,\r\n \"msg\":\"\",\r\n \"data\":response\r\n }"
},
"body": [
{
"id": "u:52fbc3355570",
"mode": "inline",
"name": "Ctrl",
"type": "switch",
"label": "开关机",
"onText": "开",
"option": "",
"offText": "关",
"trueValue": 1,
"falseValue": 0,
"validateApi": {
"url": "iotapi/amis/Device/parse_objectid",
"method": "put",
"headers": {
"store": "localStorage",
"dgiotReplace": "parse_objectid"
},
"requestAdaptor": "return {\r\n ...api,\r\n data:{\r\n profile:{\r\n Ctrl:api.data.Ctrl \r\n }\r\n }\r\n}"
},
"submitOnChange": true
}
],
"title": "开关机控制器",
"trueValue": true,
"falseValue": false,
"submitText": "",
"optionAtLeft": false
}
```
#### 8.设备模拟登录,方式一:MQTTX登录;方式二:ip:18083登录,用户名:admin,密码:public
##### 方式一:MQTTX登录
##### 方式二:ip:18083登录,用户名:admin,密码:public
用户名及密码获取方式,如下图:
#### 9.设备数据模拟上报,方式一:MQTTX上报;方式二:ip:18083上报
```
dgiot上报数据Topic
$dg/thing/{ProductId}/{DeviceAddr}/properties/report
dgiot下发控制命令Topic
$dg/device/{ProductId}/{DeviceAddr}/profile
```
可以在设备详情查看其对应Topic,如下图:
##### 方式一:MQTTX上报
###### 上报数据
###### 订阅到的控制指令
##### 方式二:ip:18083上报
###### 上报数据
###### 订阅到的控制指令