使用ThingsBoard-GateWay做物联网网关时,modbus串口总线的配置方法说明

ThingsBoard-GateWay做网关时,说明不是很丰富,经过反复试验和总结,总算弄明白了,把结果和说明分享给大家。

{
  "server": {
    "name": "Modbus Default Server",    ----主站部分的参数,参照我下面的写,懂485,这里没啥难懂的
    "type": "serial",
    "method": "rtu",
	"port": "COM3",
    "baudrate": 9600,
    "stopbits": 1,
    "bytesize": 8,
    "parity": "N",
    "strict": true,
    "timeout": 35,
    "byteOrder": "LITTLE",
    "wordOrder": "BIG",
    "devices": [
      {
        "unitId": 11,                     ----总线中,设备的地址码
        "deviceName": "ModbusDevice001",  ----上传到上位机的名字
        "attributesPollPeriod": 500000,
        "timeseriesPollPeriod": 5000,    ----取实时数据的频率
        "sendDataOnlyOnChange": true,
        "attributes": [
          {
            "tag": "开发间温湿度",
            "type": "16uint",
            "functionCode": 3,
            "objectsCount": 1,
            "address": 1
          }
        ],
        "timeseries": [
           {
            "tag": "湿度",
            "type": "16uint",
            "functionCode": 3,
            "registersCount": 1,
            "address": 0,
            "divider": 10
          },
          {
            "tag": "温度",
            "type": "16uint",     ----寄存器中存数的类型
            "functionCode": 3,    ----模式设置成从寄存器中取数据
            "registersCount": 1,  ----取寄存器中取一个数
            "address": 1,         ----从寄存器中取数的开始地址
            "divider": 10         ----取出的数据,网关进行初步加工,这里是除以10,还有乘以一个数
          }
        ]
      }
    ]
  }
}

你可能感兴趣的:(IOT,thingboard,gateway,modbus,serial,串口)