消息规范
本平台消息规范
你通过IDE编写消息的时候,必须按照格式规范才能被NexIoT识别,这里参考了 jetlinks
注意
事件和属性都可以是数组,表示同时多个事件或者属性
属性消息
json
{
"messageType": "PROPERTIES", //PROPERTIES代表属性
"properties": {
"openState": 0 //这里openState必须与物模型完全一致
}
}事件消息
json
{
"data": {},
"event": "offline", //事件标识,与物模型对齐
"messageType": "EVENT"
}功能调用(指令)
json
{
"data": {
"terminalPhone": "018220444386" //指令参数
},
"function": "queryLocation", //指令标识,与物模型对齐
"messageType": "FUNCTIONS"
}物模型示例
json
{
"events": [
{
"id": "online",
"name": "上线",
"valueType": {
"type": "string"
}
}
],
"functions": [
{
"config": false,
"id": "switchOnOff",
"inputs": [
{
"id": "meterSn",
"name": "表号",
"valueType": {
"expands": {
"maxLength": "12"
},
"type": "string"
}
},
{
"id": "operateType",
"name": "操作类型",
"valueType": {
"elements": [
{
"text": "分闸(断电)",
"value": "0"
},
{
"text": "合闸(来电)",
"value": "1"
}
],
"type": "enum"
}
}
],
"name": "断电合闸",
"output": {}
}
],
"properties": [
{
"config": false,
"id": "openState",
"mode": "rw",
"name": "通断电状态",
"source": "device",
"valueType": {
"elements": [
{
"text": "断电",
"value": "0"
},
{
"text": "通电",
"value": "1"
}
],
"type": "enum"
}
},
{
"id": "current",
"mode": "r",
"name": "电流",
"valueType": {
"expands": {
"precision": "3"
},
"type": "float",
"unit": "A"
}
}
],
"tags": []
}