example_config.json 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. {
  2. "version":"1.0",
  3. "profile":{
  4. "ProductId":"G5OV4CREFI",
  5. "CategoryId":"3"
  6. },
  7. "properties":[
  8. {
  9. "id":"power_switch",
  10. "name":"电灯开关",
  11. "desc":"控制电灯开灭",
  12. "required":true,
  13. "mode":"rw",
  14. "define":{
  15. "type":"bool",
  16. "mapping":{
  17. "0":"关",
  18. "1":"开"
  19. }
  20. }
  21. },
  22. {
  23. "id":"color",
  24. "name":"颜色",
  25. "desc":"灯光颜色",
  26. "mode":"rw",
  27. "define":{
  28. "type":"enum",
  29. "mapping":{
  30. "0":"Red",
  31. "1":"Green",
  32. "2":"Blue"
  33. }
  34. }
  35. },
  36. {
  37. "id":"brightness",
  38. "name":"亮度",
  39. "desc":"灯光亮度",
  40. "mode":"rw",
  41. "define":{
  42. "type":"int",
  43. "unit":"%",
  44. "step":"1",
  45. "min":"0",
  46. "max":"100",
  47. "start":"1"
  48. }
  49. },
  50. {
  51. "id":"name",
  52. "name":"灯位置名称",
  53. "desc":"灯位置名称:书房、客厅等",
  54. "mode":"rw",
  55. "required":true,
  56. "define":{
  57. "type":"string",
  58. "min":"0",
  59. "max":"64"
  60. }
  61. }
  62. ],
  63. "events":[
  64. {
  65. "id":"status_report",
  66. "name":"DeviceStatus",
  67. "desc":"Report the device status",
  68. "type":"info",
  69. "required":true,
  70. "params":[
  71. {
  72. "id":"status",
  73. "name":"running_state",
  74. "desc":"Report current device running state",
  75. "define":{
  76. "type":"bool",
  77. "mapping":{
  78. "0":"normal",
  79. "1":"fault"
  80. }
  81. }
  82. },
  83. {
  84. "id":"message",
  85. "name":"Message",
  86. "desc":"Some extra message",
  87. "define":{
  88. "type":"string",
  89. "min":"0",
  90. "max":"64"
  91. }
  92. }
  93. ]
  94. },
  95. {
  96. "id":"low_voltage",
  97. "name":"LowVoltage",
  98. "desc":"Alert for device voltage is low",
  99. "type":"alert",
  100. "required":false,
  101. "params":[
  102. {
  103. "id":"voltage",
  104. "name":"Voltage",
  105. "desc":"Current voltage",
  106. "define":{
  107. "type":"float",
  108. "unit":"V",
  109. "step":"1",
  110. "min":"0.0",
  111. "max":"24.0",
  112. "start":"1"
  113. }
  114. }
  115. ]
  116. },
  117. {
  118. "id":"hardware_fault",
  119. "name":"Hardware_fault",
  120. "desc":"Report hardware fault",
  121. "type":"fault",
  122. "required":false,
  123. "params":[
  124. {
  125. "id":"name",
  126. "name":"Name",
  127. "desc":"Name like: memory,tf card, censors ...",
  128. "define":{
  129. "type":"string",
  130. "min":"0",
  131. "max":"64"
  132. }
  133. },
  134. {
  135. "id":"error_code",
  136. "name":"Error_Code",
  137. "desc":"Error code for fault",
  138. "define":{
  139. "type":"int",
  140. "unit":"",
  141. "step":"1",
  142. "min":"0",
  143. "max":"2000",
  144. "start":"1"
  145. }
  146. }
  147. ]
  148. }
  149. ],
  150. "actions":[
  151. {
  152. "id":"light_blink",
  153. "name":"light_blink",
  154. "desc":"根据time和color实现灯的闪烁",
  155. "input":[
  156. {
  157. "id":"time",
  158. "name":"time",
  159. "define":{
  160. "type":"int",
  161. "min":"0",
  162. "max":"10",
  163. "start":"0",
  164. "step":"1",
  165. "unit":"秒"
  166. }
  167. },
  168. {
  169. "id":"color",
  170. "name":"color",
  171. "define":{
  172. "type":"bool",
  173. "mapping":{
  174. "0":"red",
  175. "1":"green"
  176. }
  177. }
  178. },
  179. {
  180. "id":"total_time",
  181. "name":"total_time",
  182. "define":{
  183. "type":"int",
  184. "min":"0",
  185. "max":"100",
  186. "start":"0",
  187. "step":"1",
  188. "unit":"秒"
  189. }
  190. }
  191. ],
  192. "output":[
  193. {
  194. "id":"err_code",
  195. "name":"code",
  196. "define":{
  197. "type":"int",
  198. "mapping":{
  199. "0":"ok",
  200. "1":"failed"
  201. }
  202. }
  203. }
  204. ],
  205. "required":false
  206. }
  207. ]
  208. }