virtualDevice.json 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. [
  2. {
  3. "id":"6293953092084e2df303ba3e",
  4. "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
  5. "name": "三路开关",
  6. "productKey": "eDhXKwEzwFybM5R7",
  7. "devices": [
  8. "16538390097670switch0300100500143",
  9. "16538390048670switch0300100400141",
  10. "16538390008670switch0300100300145",
  11. "16538389971670switch0300100200140",
  12. "16538389915670switch030010010014c"
  13. ],
  14. "type": "thingModel",
  15. "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n\t \"rssi\":127-parseInt(Math.random()*127),\n\t \"powerstate_1\":Math.random()>0.5?1:0,\n\t \"powerstate_2\":Math.random()>0.5?1:0,\n\t \"powerstate_3\":Math.random()>0.5?1:0\n }\n }\n}",
  16. "trigger": "random",
  17. "triggerExpression": "second",
  18. "state": "running",
  19. "createAt": 1653839152090
  20. },
  21. {
  22. "id":"629391ae92084e2df303ba3d",
  23. "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
  24. "name": "温湿度传感器",
  25. "productKey": "6kYp6jszrDns2yh4",
  26. "devices": [
  27. "16538383943670wenshidu01008000139",
  28. "16538383910670wenshidu01007000136",
  29. "16538383880670wenshidu0100600013b",
  30. "16538383850710wenshidu01005000134",
  31. "16538383810690wenshidu01004000132",
  32. "16537594784840wenshidu0100300013a",
  33. "16537594752710wenshidu0100200013d",
  34. "16537594707840wenshidu0100100013c",
  35. "16538390097670switch0300100500143",
  36. "16514626218250abe124000010000011a"
  37. ],
  38. "type": "thingModel",
  39. "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"humidity\":parseInt(Math.random()*100),\n\t \"temperature\":parseInt(Math.random()*500)-38\n }\n }\n}",
  40. "trigger": "random",
  41. "triggerExpression": "second",
  42. "state": "running",
  43. "createAt": 1653838254989
  44. },
  45. {
  46. "id": "629390f492084e2df303ba3c",
  47. "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
  48. "name": "调光灯",
  49. "productKey": "xpsYHExTKPFaQMS7",
  50. "devices": [
  51. "16537595658790linght0010030000128",
  52. "16537595624750linght001002000012c",
  53. "16537595591780linght0010010000121",
  54. "16552594933210linght001007000012f",
  55. "16552594898210linght0010060000129",
  56. "16552594863210linght001005000012c",
  57. "16552594812210linght001004000012d"
  58. ],
  59. "type": "thingModel",
  60. "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"brightness\":parseInt(Math.random()*100),\n\t \"powerstate\":Math.random()>0.5?1:0\n }\n }\n}",
  61. "trigger": "random",
  62. "triggerExpression": "second",
  63. "state": "running",
  64. "createAt": 1653838068860
  65. },
  66. {
  67. "id": "62925cb72002b44c15caeb1c",
  68. "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
  69. "name": "虚拟门磁1",
  70. "productKey": "PN3EDmkBZDD8whDd",
  71. "devices": [
  72. "16537591055800menci0001003000012e",
  73. "16537590838150menci00010020000128",
  74. "16537590780810menci0001001000012b",
  75. "16552595723210menci0001008000012f",
  76. "16552595685220menci00010070000127",
  77. "16552595656210menci0001006000012d",
  78. "16501898583770f4cce4feffbd1bec164"
  79. ],
  80. "type": "thingModel",
  81. "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [];\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"rssi\":127-parseInt(Math.random()*127),\n \"power\":parseInt(Math.random()*100),\n\t \"doorStatus\":Math.random()>0.5?1:0\n }\n }\n}",
  82. "trigger": "random",
  83. "triggerExpression": "minute",
  84. "state": "running",
  85. "createAt": 1653759159567
  86. },
  87. {
  88. "id": "628fd800fba69e633a972e12",
  89. "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
  90. "name": "开关1",
  91. "productKey": "Rf4QSjbm65X45753",
  92. "devices": [
  93. "16465723451670abc123000030000011a",
  94. "16465723448670abc1230000200000115"
  95. ],
  96. "type": "thingModel",
  97. "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n return [{\n \"productKey\":service.productKey,\n \"deviceName\":service.deviceName,\n \"mid\":service.mid,\n \"type\":\"service\",\n \"identifier\":\"reboot_reply\",\n \"data\":{},\n \"code\":0\n },{\n \"mid\":getRequestId(),\n \"productKey\":service.productKey, \n \"deviceName\":service.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\n \"time\":new Date().getTime(),\n \"data\":{\n \"volt\":parseInt(Math.random()*100),\n\t \"powerstate\":Math.random()>0.5?1:0\n }\n }]\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"volt\":parseInt(Math.random()*100)\n }\n }\n}",
  98. "trigger": "cron",
  99. "triggerExpression": "0 * * * * ? ",
  100. "state": "running",
  101. "createAt": 1653594112764
  102. },
  103. {
  104. "id": "628fa6bc1b735b73cb260042",
  105. "uid": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
  106. "name": "虚拟插座12",
  107. "productKey": "cGCrkK7Ex4FESAwe",
  108. "devices": [
  109. "16534030209640test001230100000118",
  110. "16514626216250abe1230000200000114",
  111. "16514626214280abe1230000100000116",
  112. "16538390924670pulg0a001006000012a",
  113. "16538390885690pulg0a0010050000126",
  114. "16538390853670pulg0a0010040000121",
  115. "16538390820760pulg0a0010030000127",
  116. "16538390787670pulg0a0010020000124",
  117. "16538390738670pulg0a0010010000125",
  118. "16552594646210pulg0a0010160000122",
  119. "16552594604220pulg0a0010150000127",
  120. "16552594572370pulg0a001014000012e",
  121. "16552594542310pulg0a0010130000123",
  122. "16552594511210pulg0a001012000012c",
  123. "16552594475270pulg0a0010110000125",
  124. "16552594444210pulg0a0010100000128",
  125. "16552594405220pulg0a0010090000124",
  126. "16552594368340pulg0a0010080000126",
  127. "16552594320310pulg0a0010070000126"
  128. ],
  129. "type": "thingModel",
  130. "script": "\nvar mid=1000;\n\nfunction getMid(){\n mid++;\n if(mid>9999){\n\tmid=1;\n }\n return mid+\"\";\n}\n\nfunction getRequestId(){\n return \"RID\"+new Date().getTime()+getMid();\n}\n\n\nthis.receive=function(service,device){\n var identifier=service.identifier;\n var result= [{\n \"productKey\":service.productKey,\n \"deviceName\":service.deviceName,\n \"mid\":service.mid,\n \"type\":\"service\",\n \"identifier\":identifier+\"_reply\",\n \"data\":{},\n \"code\":0\n }]\n \n if(service.type==\"property\" && (identifier==\"get\" || identifier==\"set\")){\n\tresult.push({\n\t \"mid\":getRequestId(),\n\t \"productKey\":device.productKey, \n\t \"deviceName\":device.deviceName,\n\t \"type\":\"property\",\n\t \"identifier\":\"report\",\n\t \"occurred\":new Date().getTime(),\n\t \"time\":new Date().getTime(),\n\t \"data\":service.params\n\t});\n }\n \n return result;\n}\n\nthis.report=function(device){\n return {\n \"mid\":getRequestId(),\n \"productKey\":device.productKey, \n \"deviceName\":device.deviceName,\n \"type\":\"property\",\n \"identifier\":\"report\",\n \"occurred\":new Date().getTime(),\t//时间戳,设备上的事件或数据产生的本地时间\n \"time\":new Date().getTime(),\t\t//时间戳,消息上报时间\n \"data\":{\n \"rssi\":127-parseInt(Math.random()*127),\n\t \"powerstate\":Math.random()>0.5?1:0\n }\n }\n}",
  131. "trigger": "random",
  132. "triggerExpression": "second",
  133. "state": "running",
  134. "createAt": 1653581500076
  135. }
  136. ]