脚本调试模拟输入包括以下两种:
模拟输入类型 | 输入说明 | 示例 |
---|---|---|
设备上行数据 | 模拟设备上报自定义二进制数据 | 输入以0x开头的十六进制字符串,例如:0xffff |
设备下行数据 | 模拟平台下发物模型Json数据 | 输入json字符串,例如:{,"id":"16","version":"1.0","params":{"fileName":"12","size":12,"fileID":"12"},"method":"thing.service.$SyncGetFile.invoke"} |
1 // 属性上报 2 { 3 "id": "1001", 4 "version": "1.0", 5 "params": { 6 "power": { 7 "value":"30.5", 8 "time": 1524448722123 9 } 10 }, 11 "method": "thing.property.post" 12 } 13 14 // 事件上报 15 { 16 "id": "1001", 17 "version": "1.0", 18 "params": { 19 "identifier": { 20 "value":{ 21 "power": "on", 22 "switch": "on" 23 } 24 } 25 } 26 "method": "thing.event.post" 27 } 28 29 // 批量数据上报 30 { 31 "id": "1001", 32 "version": "1001", 33 "params": [{ 34 "properties": { 35 "power": { 36 "value":"30.5", 37 "time": 1524448722123 38 } 39 }, 40 "event":{ 41 "alarmEvent1": { 42 "value": { 43 "Power":"on", 44 "WF":"2" 45 }, 46 "time":1524448722000 47 }, 48 } 49 }], 50 "method": "thing.pack.post" 51 } 52 53 // 历史数据上报 54 { 55 "id": "1001", 56 "version": "1001", 57 "params": [{ 58 "properties": { 59 "power": [{ 60 "value":"30.5", 61 "time": 1524448722123 62 },{ 63 "value":"30.5", 64 "time": 1524448722170 65 }] 66 }, 67 "event":{ 68 "alarmEvent1": [{ 69 "value": { 70 "Power": "on", 71 "WF": "2" 72 }, 73 "time":1524448722000 74 },{ 75 "value": { 76 "Power": "on", 77 "WF": "10" 78 }, 79 "time":1524448722111 80 }] 81 } 82 }], 83 "method": "thing.history.post" 84 } 85 86 // 属性设置响应 87 { 88 "id": "1001", 89 "code": 200, 90 "msg":"success", 91 "method": "thing.property.set.reply" 92 } 93 94 // 属性获取响应 95 { 96 "id": "1001", 97 "code": 200, 98 "msg": "success", 99 "data": { 100 "power": "on" 101 } 102 "method": "thing.property.get.reply" 103 } 104 105 // 服务调用响应 106 { 107 "id": "1000", 108 "code": 200, 109 "msg": "success", 110 "data": { 111 "temperature" : "30.5" 112 }, 113 "method": "thing.service.{identifier}.reply" // identifier为服务标识 114 } 115 4. 物模型下行输出格式定义 116 物模型下行输出类型包括:属性设置、属性获取、服务调用及设备上报响应。 117 118 119 // 属性设置 120 { 121 "id": "1001", 122 "version": "1.0", 123 "params": { 124 "power": "27" 125 }, 126 "method": "thing.property.set" 127 } 128 129 // 属性获取 130 { 131 "id": "1001", 132 "version": "1.0", 133 "params": ["power","switch"], 134 "method": "thing.property.get" 135 } 136 137 // 服务调用 138 { 139 "id": "1001", 140 "version": "1.0", 141 "params": { 142 "power": "28", 143 "switch": "on" 144 }, 145 "method": "thing.service.{identifier}.invoke" // identifier为服务标识 146 } 147 148 // 设备上报响应 149 { 150 "id": "1001", 151 "code": 200, // 200为成果 152 "msg": "success", 153 "method": "thing.post.reply" 154 }uplink/downlink
标签:脚本,Onenet,power,平台,id,thing,version,method,1001 From: https://www.cnblogs.com/lumao1122-Milolu/p/17043589.html