产品

参考飞企网关主机产品

产品流文件

  • 流文件适用厂商

广州翊创智能科技有限公司

邮箱: easyctrlyc@foxmail.com
网址: http://www.easyctrl.net
  • 流文件适用厂商产品

网关主机

  • 流文件
[
    {
        "id": "b7eb6478068ebfcc",
        "type": "tab",
        "label": "飞企网关主机",
        "disabled": false,
        "info": ""
    },
    {
        "id": "5489d7acec64878d",
        "type": "inject",
        "z": "b7eb6478068ebfcc",
        "name": "采集任务",
        "props": [
            {
                "p": "unitid",
                "v": "245",
                "vt": "str"
            },
            {
                "p": "edgeboxId",
                "v": "edgebox02",
                "vt": "str"
            },
            {
                "p": "deviceId",
                "v": "FE_electric_gateway_02",
                "vt": "str"
            }
        ],
        "repeat": "10",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 130,
        "y": 140,
        "wires": [
            [
                "1aa10142979ec872"
            ]
        ]
    },
    {
        "id": "5bd1f071fa55a65e",
        "type": "modbus-response",
        "z": "b7eb6478068ebfcc",
        "name": "",
        "registerShowMax": 20,
        "x": 650,
        "y": 140,
        "wires": []
    },
    {
        "id": "fb0f7952fad6ed89",
        "type": "modbus-flex-getter",
        "z": "b7eb6478068ebfcc",
        "name": "",
        "showStatusActivities": true,
        "showErrors": true,
        "logIOActivities": false,
        "server": "d315b614063fabaf",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": true,
        "keepMsgProperties": true,
        "x": 450,
        "y": 140,
        "wires": [
            [
                "5bd1f071fa55a65e"
            ],
            [
                "5bd1f071fa55a65e",
                "c0a08ab06cc263e8"
            ]
        ]
    },
    {
        "id": "1aa10142979ec872",
        "type": "function",
        "z": "b7eb6478068ebfcc",
        "name": "状态查询",
        "func": "msg.payload = {\n    'fc': 1,\n    'unitid': msg.unitid,\n    'address': 1,\n    'quantity': 63\n};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 140,
        "wires": [
            [
                "fb0f7952fad6ed89"
            ]
        ]
    },
    {
        "id": "c0a08ab06cc263e8",
        "type": "function",
        "z": "b7eb6478068ebfcc",
        "name": "终端连接状态",
        "func": "// 是否连接异常\nif(msg.error!=null){\n    // 离线通知\n    return  [null,msg];\n}\n\n// 数据上报\nreturn  [msg,null];",
        "outputs": 2,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 200,
        "wires": [
            [
                "5ef1b5321b845bc7"
            ],
            [
                "ad420f26443719e3"
            ]
        ]
    },
    {
        "id": "5ef1b5321b845bc7",
        "type": "function",
        "z": "b7eb6478068ebfcc",
        "name": "上报指令组装",
        "func": "var data = msg.payload.data;\nvar qty = 0;\nvar deviceid_list = new Array();\nfor(var i=0;i<data.length;i++){\n    if(data[i]==true){\n        qty++;\n        deviceid_list.push(i);\n    }\n}\nvar payload = {\n    deviceId:msg.deviceId,\n    properties:{\n        device_qty: qty,\n        deviceids: deviceid_list\n    }\n};\n\n// 全局变量设置,用于避免重复上报\nvar flow_str = JSON.stringify(payload);\nif(flow.get(msg.deviceId) == flow_str){\n    return null;\n}\nflow.set(msg.deviceId,flow_str);\n// 全局变量设置,用于设备数量、在线状态监测\nglobal.set(msg.deviceId,{device_state:true});\n\nmsg.payload = payload;\nmsg.topic = \"/edgebox/\"+msg.edgeboxId+\"/child/\"+msg.deviceId+\"/properties/report\";\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 180,
        "wires": [
            [
                "74d55b7846804998"
            ]
        ]
    },
    {
        "id": "74d55b7846804998",
        "type": "mqtt out",
        "z": "b7eb6478068ebfcc",
        "name": "消息发布",
        "topic": "",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "534d0e6087f67d4e",
        "x": 1000,
        "y": 220,
        "wires": []
    },
    {
        "id": "ad420f26443719e3",
        "type": "function",
        "z": "b7eb6478068ebfcc",
        "name": "离线指令组装",
        "func": "var payload = {\n    deviceId:msg.deviceId\n};\n\n// 全局变量设置,用于避免重复上报\nvar flow_str = JSON.stringify(payload);\nif(flow.get(msg.deviceId) == flow_str){\n    return null;\n}\nflow.set(msg.deviceId,flow_str);\n// 全局变量设置,用于设备数量、在线状态监测\nglobal.set(msg.deviceId,{device_state:false});\n\nmsg.payload = payload;\nmsg.topic = \"/edgebox/\"+msg.edgeboxId+\"/child/\"+msg.deviceId+\"/offline\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 220,
        "wires": [
            [
                "74d55b7846804998"
            ]
        ]
    },
    {
        "id": "d315b614063fabaf",
        "type": "modbus-client",
        "name": "网关主机ModbusTCP",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "tcpHost": "192.168.1.230",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": 1,
        "commandDelay": 1,
        "clientTimeout": 1000,
        "reconnectOnTimeout": true,
        "reconnectTimeout": 2000,
        "parallelUnitIdsAllowed": true
    },
    {
        "id": "534d0e6087f67d4e",
        "type": "mqtt-broker",
        "name": "飞企IOT-MQTT",
        "broker": "10.62.16.222",
        "port": "31884",
        "clientid": "edgebox02",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "/edgebox/edgebox02/online",
        "birthQos": "0",
        "birthPayload": "{\"deviceId\":\"edgebox02\" }",
        "birthMsg": {},
        "closeTopic": "/edgebox/edgebox02/offline",
        "closeQos": "0",
        "closePayload": "{\"deviceId\":\"edgebox02\" }",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]
  • 导入编排引擎

产品设备上线

文档更新时间: 2022-09-09 18:00   作者:管理员