迅鸣物联网文档

迅鸣物联网文档


实验平台协议

[TOC]

>> 实验平台使用MQTT通讯

topic定义:

节点功能topic:

下行:/xm/sh/request/mqtt/网关序列号/产品类型/节点ID/v2 上行:/xm/sh/response/mqtt/网关序列号/产品类型/节点ID/v2

网关功能topic: 上行:/xm/sh/response/mqtt/网关序列号/2018/v2

上下线消息

# 上线消息
#/xm/sh/response/mqtt/123456789/2018/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "123456789",
                "action": "online",
                "params": {
                },
                "serviceid": "20180101"
            }
        ]
    }
}
# 下线消息  心跳30s,连续三次未收到心跳,将认为设备离线
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "123456789",
                "action": "offline",
                "params": {
                },
                "serviceid": "20180101"
            }
        ]
    }
}

协议

一、产品类型:1021 (8继电器8IO)

属性 名称 类型 读写
11 继电器1状态 布尔值 可读写
12 继电器2状态 布尔值 可读写
13 继电器3状态 布尔值 可读写
14 继电器4状态 布尔值 可读写
15 继电器5状态 布尔值 可读写
16 继电器6状态 布尔值 可读写
17 继电器7状态 布尔值 可读写
18 继电器8状态 布尔值 可读写
21 IO1状态 布尔值 只读
22 IO2态 布尔值 只读
23 IO3态 布尔值 只读
24 IO4态 布尔值 只读
25 IO5态 布尔值 只读
26 IO6态 布尔值 只读
27 IO7态 布尔值 只读
28 IO8态 布尔值 只读

控制指令:

开关继电器

#下行 /xm/sh/request/mqtt/123456789/1021/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890b", # 网关序列号(123456789)+节点ID(0b)
                "action": "command", # command 执行写操作
                "params": {
                    "11": false # 将继电器1关闭
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1021/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890b",
                "action": "command",
                "params": {
                    "11": false
                },
                "serviceid": "10210101"
            }
        ]
    }
}

读取所有继电器状态

#下行 /xm/sh/request/mqtt/123456789/1021/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890b", # 网关序列号(123456789)+节点ID(0b)
                "action": "getStat", # getStat 读取继电器状态
                "params": {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1021/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890b",
                "action": "getStat",
                "params": {
                    "11": false,
                    "12": false,
                    ...
                    "18":false
                },
                "serviceid": "10210101"
            }
        ]
    }
}

读取所有IO状态

#下行 /xm/sh/request/mqtt/123456789/1021/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890b", # 网关序列号(123456789)+节点ID(0b)
                "action": "getIo", # getIo 读取IO状态
                "params": {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1021/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890b",
                "action": "getIo",
                "params": {
                    "21": false,
                    "22": false,
                    ...
                    "28":false
                },
                "serviceid": "10210101"
            }
        ]
    }
}

二、产品类型:1022(温湿度计)

属性 名称 类型 读写
11 温度 float 只读
12 湿度 float 只读

读取温湿度

#下行 /xm/sh/request/mqtt/123456789/1022/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890a", # 网关序列号(123456789)+节点ID(0a)
                "action": "getStat", # getStat 读取温湿度
                "params": {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1022/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890a",
                "action": "getStat",
                "params": {
                    "11": 36.5,
                    "12": 47.8
                },
                "serviceid": "10220101"
            }
        ]
    }
}

三、产品类型:1023 (压差)

属性 名称 类型 读写
11 压力1 int 只读
12 压力2 int 只读

读取压力

#下行 /xm/sh/request/mqtt/123456789/1023/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890c", # 网关序列号(123456789)+节点ID(0c)
                "action": "getStat", # getStat 读取压力
                "params": {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1023/节点ID/v2
{
    "header": {
        "timeStamp": ""
    },
    "payload": {
        "devices": [
            {
                "devicesn": "1234567890c",
                "action": "getStat",
                "params": {
                    "11": 99,
                    "12": 1
                },
                "serviceid": "10230101"
            }
        ]
    }
}

四、产品类型:1024 (变频器)

属性 名称 类型 读写
11 控制字 布尔值 只写
12 转速方向百分比 (-100到100) int 只写
13 转速 rpm int 只读
14 频率 赫兹 float 只读
15 方向 1正向 0未知 -1反向 int 只读
15 方向 1正向 0未知 -1反向 int 只读
305 故障字1 List<int> 只读
306 故障字2 List<int> 只读

故障字305包含的内容:

  • 0 过流
  • 1 过压
  • 2 传动过温
  • 3 短路
  • 4 ---
  • 5 直流欠压
  • 6 AI1 丢失
  • 7 AI2 丢失
  • 8 电机过温
  • 9 控制盘丢失
  • 10 ---
  • 11 电机堵转
  • 12 控制板过温
  • 13 外部故障1
  • 14 外部故障2
  • 15 接地故障

故障字306包含的内容:

  • 0 ---
  • 1 传感器故障
  • 2 OPEX连接故障
  • 3 OPEX电源故障
  • 4 电流测量故障
  • 5 ---
  • 6 ---
  • 7 ---
  • 8 ---
  • 9 传动识别故障
  • 10 配置文件出错
  • 11 串口1故障
  • 12 内置现场总线配置文件出错
  • 13 强制跳闸
  • 14 电机缺相
  • 15 输出线接地故障

要点:

a.变频器启动顺序:

  1. 初始化控制字
  2. 延时100ms+
  3. 设置频率及方向
  4. 启动电机

b.电机在不启动的状态下读取不到方向,频率,转速

初始化控制字

#下行 /xm/sh/request/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;, # 网关序列号(123456789)+节点ID(15)
                &quot;action&quot;: &quot;init&quot;, # init 初始化控制字
                &quot;params&quot;: {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;,
                &quot;action&quot;: &quot;init&quot;,
                &quot;params&quot;: {
                },
                &quot;serviceid&quot;: &quot;10240101&quot;
            }
        ]
    }
}

设置频率及方向:

#下行 /xm/sh/request/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;, # 网关序列号(123456789)+节点ID(15)
                &quot;action&quot;: &quot;command&quot;,
                &quot;params&quot;: {
                    &quot;12&quot;:50
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;,
                &quot;action&quot;: &quot;command&quot;,
                &quot;params&quot;: {
                    &quot;12&quot;:50
                },
                &quot;serviceid&quot;: &quot;10240101&quot;
            }
        ]
    }
}

启动电机:

#下行 /xm/sh/request/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;, # 网关序列号(123456789)+节点ID(15)
                &quot;action&quot;: &quot;command&quot;,
                &quot;params&quot;: {
                    &quot;11&quot;:true
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;,
                &quot;action&quot;: &quot;command&quot;,
                &quot;params&quot;: {
                    &quot;11&quot;:true
                },
                &quot;serviceid&quot;: &quot;10240101&quot;
            }
        ]
    }
}

关闭电机

#下行 /xm/sh/request/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;, # 网关序列号(123456789)+节点ID(15)
                &quot;action&quot;: &quot;command&quot;,
                &quot;params&quot;: {
                    &quot;11&quot;:false
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;,
                &quot;action&quot;: &quot;command&quot;,
                &quot;params&quot;: {
                    &quot;11&quot;:false
                },
                &quot;serviceid&quot;: &quot;10240101&quot;
            }
        ]
    }
}

读取状态

#下行 /xm/sh/request/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;, # 网关序列号(123456789)+节点ID(15)
                &quot;action&quot;: &quot;getStat&quot;,
                &quot;params&quot;: {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;,
                &quot;action&quot;: &quot;getStat&quot;,
                &quot;params&quot;: {
                    &quot;13&quot;:175,
                    &quot;14&quot;:2.5,
                    &quot;15&quot;:1
                },
                &quot;serviceid&quot;: &quot;10240101&quot;
            }
        ]
    }
}

读取故障字

#下行 /xm/sh/request/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;, # 网关序列号(123456789)+节点ID(15)
                &quot;action&quot;: &quot;getError&quot;,
                &quot;params&quot;: {
                    &quot;12&quot;:50
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1024/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;12345678915&quot;,
                &quot;action&quot;: &quot;getError&quot;,
                &quot;params&quot;: {
                    &quot;305&quot;:[],
                    &quot;306&quot;:[]
                },
                &quot;serviceid&quot;: &quot;10240101&quot;
            }
        ]
    }
}

五、产品类型 1025(异味)

属性 名称 类型 读写
11 PM2.5(ug/m³) int 只读
13 湿度(%) float 只读
14 温度(℃) float 只读
21 硫化氢(ppm) float 只读
27 氨气(ppm) float 只读
29 异味(ppm) float 只读

读取状态

#下行 /xm/sh/request/mqtt/123456789/1025/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;1234567890d&quot;, # 网关序列号(123456789)+节点ID(0d)
                &quot;action&quot;: &quot;getStat&quot;,
                &quot;params&quot;: {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1025/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;1234567890d&quot;,
                &quot;action&quot;: &quot;getStat&quot;,
                &quot;params&quot;: {
                    &quot;11&quot;: 25,
                    &quot;12&quot;: 25,
                    &quot;13&quot;: 28.3,
                    &quot;14&quot;: 23,
                    &quot;15&quot;: 0,
                    &quot;16&quot;: 0,
                    &quot;17&quot;: 0,
                    &quot;18&quot;: 3.97,
                    &quot;19&quot;: 8.066,
                    &quot;20&quot;: 0,
                    &quot;21&quot;: 0,
                    &quot;22&quot;: 0,
                    &quot;23&quot;: 0,
                    &quot;24&quot;: 0,
                    &quot;25&quot;: 0,
                    &quot;26&quot;: 0,
                    &quot;27&quot;: 0.396,
                    &quot;28&quot;: 0,
                    &quot;29&quot;: 0,
                    &quot;30&quot;: 30
                },
                &quot;serviceid&quot;: &quot;10250101&quot;
            }
        ]
    }
}

六、产品类型 1026(物位)

属性 名称 类型 读写
11 激光(mm) int 只读
12 超声波(mm) int 只读
13 限位开关 布尔值 只读

读取状态

#下行 /xm/sh/request/mqtt/123456789/1026/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;1234567890e&quot;, # 网关序列号(123456789)+节点ID(0e)
                &quot;action&quot;: &quot;getStat&quot;,
                &quot;params&quot;: {
                }
            }
        ]
    }
}
# ---
# 上行 /xm/sh/response/mqtt/123456789/1026/节点ID/v2
{
    &quot;header&quot;: {
        &quot;timeStamp&quot;: &quot;&quot;
    },
    &quot;payload&quot;: {
        &quot;devices&quot;: [
            {
                &quot;devicesn&quot;: &quot;1234567890e&quot;,
                &quot;action&quot;: &quot;getStat&quot;,
                &quot;params&quot;: {
                    &quot;11&quot;: 750,
                    &quot;12&quot;: 710,
                    &quot;13&quot;: false
                },
                &quot;serviceid&quot;: &quot;10260101&quot;
            }
        ]
    }
}

页面列表

ITEM_HTML