产品

参考光照温湿度传感器产品

产品流文件

  • 流文件适用厂商

山东威盟士科技有限公司

网址: https://www.sdvms.com
  • 流文件适用厂商产品

光照温湿度变送器(485型)

  • 流文件
[
   {
        "id": "a7dc330937a81b7d",
        "type": "inject",
        "z": "${deviceId}",
        "name": "采集任务",
        "props": [
            {
                "p": "edgeboxId",
                "v": "${edgeboxId}",
                "vt": "str"
            },
            {
                "p": "deviceId",
                "v": "${deviceId}",
                "vt": "str"
            },
            {
                "p": "unitid",
                "v": "1",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 150,
        "y": 100,
        "wires": [
            [
                "b3dfdd522313a643"
            ]
        ]
    },
    {
        "id": "b3dfdd522313a643",
        "type": "function",
        "z": "${deviceId}",
        "name": "采集指令组装",
        "func": "msg.payload = {\n    'fc': 3,\n    'unitid': msg.unitid,\n    'address': 0,\n    'quantity': 7\n};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 100,
        "wires": [
            [
                "1aea4aa514065ddb"
            ]
        ]
    },
    {
        "id": "1aea4aa514065ddb",
        "type": "modbus-flex-getter",
        "z": "${deviceId}",
        "name": "信息采集",
        "showStatusActivities": true,
        "showErrors": true,
        "logIOActivities": false,
        "server": "8f575d98f4f32633",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": true,
        "keepMsgProperties": true,
        "x": 480,
        "y": 100,
        "wires": [
            [
                "28c9ba29c7a68f34"
            ],
            [
                "28c9ba29c7a68f34",
                "96c36516f90d8ac8"
            ]
        ]
    },
    {
        "id": "28c9ba29c7a68f34",
        "type": "modbus-response",
        "z": "${deviceId}",
        "name": "",
        "registerShowMax": 20,
        "x": 670,
        "y": 100,
        "wires": []
    },
    {
        "id": "2cc45d7385ea9f50",
        "type": "function",
        "z": "${deviceId}",
        "name": "上报指令组装",
        "func": "var data = msg.payload.data;\nvar payload = {\n    deviceId:msg.deviceId,\n    properties:{\n        Illuminance: data[6],\n        temperature: data[1]/10,\n        humidity: data[0]/10\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": 840,
        "y": 140,
        "wires": [
            [
                "e63cd7de8db6535c"
            ]
        ]
    },
    {
        "id": "e63cd7de8db6535c",
        "type": "mqtt out",
        "z": "${deviceId}",
        "name": "消息发布",
        "topic": "",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "${edgeboxId}_mqtt",
        "x": 1000,
        "y": 160,
        "wires": []
    },
    {
        "id": "96c36516f90d8ac8",
        "type": "function",
        "z": "${deviceId}",
        "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": 660,
        "y": 160,
        "wires": [
            [
                "2cc45d7385ea9f50"
            ],
            [
                "d9245c9f4dc1a631"
            ]
        ]
    },
    {
        "id": "d9245c9f4dc1a631",
        "type": "function",
        "z": "${deviceId}",
        "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": 840,
        "y": 180,
        "wires": [
            [
                "e63cd7de8db6535c"
            ]
        ]
    },
    {
        "id": "8f575d98f4f32633",
        "type": "modbus-client",
        "name": "ModbusRTU",
        "clienttype": "simpleser",
        "bufferCommands": true,
        "stateLogEnabled": true,
        "queueLogEnabled": true,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "COM3",
        "serialType": "RTU",
        "serialBaudrate": "4800",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "500",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true
    }
]
  • 导入编排引擎

产品设备上线

文档更新时间: 2022-09-28 10:42   作者:管理员