产品低代码例子,以实际产品为准:
{
"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
}COPY
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
}COPY
8.设备模拟登录,方式一:MQTTX登录;方式二:ip:18083登录,用户名:admin,密码:public方式一:MQTTX登录