node-red-devbus-rules 0.1.6

Node-RED nodes of Devbus Rules

npm install node-red-devbus-rules

Node-RED nodes of Devbus Rules

test template

[
    {
        "id": "2372fc9c.d92ba4",
        "type": "tab",
        "label": "流程1"
    },
    {
        "id": "3476158.20d2bea",
        "type": "rules",
        "z": "2372fc9c.d92ba4",
        "name": "applyRules",
        "debug": false,
        "x": 610,
        "y": 340,
        "wires": [
            [
                "b065f510.277cc8",
                "cf8fe216.e02ee"
            ]
        ]
    },
    {
        "id": "71171622.d356b8",
        "type": "inject",
        "z": "2372fc9c.d92ba4",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 200,
        "y": 340,
        "wires": [
            [
                "ae5a8b84.f7aa88"
            ]
        ]
    },
    {
        "id": "ae5a8b84.f7aa88",
        "type": "function",
        "z": "2372fc9c.d92ba4",
        "name": "build-datas",
        "func": "\nconst payload = {\"raw\":[5,67,2,7,12,61,52.1,62.8],\"info\":{\"id\":\"XhgoHN-76hs\",\"name\":\"Siemence PLC演示系统\",\"datasourceList\":[{\"name\":\"Siemence PLC 演示系统数据泵\",\"dataItemList\":[{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":0,\"aliasName\":\"H0\",\"name\":\"H0\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"0\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":1,\"aliasName\":\"H1\",\"name\":\"H1\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"1\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":2,\"aliasName\":\"H2\",\"name\":\"H2\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"2\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":3,\"aliasName\":\"H3\",\"name\":\"H3\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"3\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":4,\"aliasName\":\"H4\",\"name\":\"H4\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"4\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":5,\"aliasName\":\"H5\",\"name\":\"H5\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"5\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":6,\"aliasName\":\"H6\",\"name\":\"H6\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"6\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":7,\"aliasName\":\"H7\",\"name\":\"H7\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"7\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":8,\"aliasName\":\"D0\",\"name\":\"D0\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"8\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":9,\"aliasName\":\"D1\",\"name\":\"D1\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"9\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":10,\"aliasName\":\"D2\",\"name\":\"D2\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"10\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":11,\"aliasName\":\"D3\",\"name\":\"D3\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"11\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":12,\"aliasName\":\"D4\",\"name\":\"D4\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"12\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":13,\"aliasName\":\"D5\",\"name\":\"D5\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"13\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":14,\"aliasName\":\"D6\",\"name\":\"D6\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"14\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":15,\"aliasName\":\"D7\",\"name\":\"D7\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"15\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":16,\"aliasName\":\"IB0\",\"name\":\"IB0\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"16\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"modbusAddr\":17,\"aliasName\":\"QB0\",\"name\":\"QB0\",\"access\":\"r\",\"datatype\":\"number\",\"fieldName\":\"17\",\"mapMode\":\"1:1\",\"maps\":[],\"category\":\"sample\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"aliasName\":\"volt\",\"mapMode\":\"N:1\",\"name\":\"电压\",\"category\":\"sample\",\"maps\":[{\"fieldName\":\"20\",\"modbusAddr\":18},{\"fieldName\":\"21\",\"modbusAddr\":19}],\"datatype\":\"number\",\"format\":\"ABCD\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"aliasName\":\"anpei\",\"mapMode\":\"N:1\",\"name\":\"电流\",\"category\":\"sample\",\"maps\":[{\"fieldName\":\"22\",\"modbusAddr\":20},{\"fieldName\":\"23\",\"modbusAddr\":21}],\"datatype\":\"number\",\"format\":\"ABCD\"},{\"sourceName\":\"Siemence PLC 演示系统数据泵\",\"aliasName\":\"power\",\"mapMode\":\"N:1\",\"name\":\"电能\",\"category\":\"sample\",\"maps\":[{\"fieldName\":\"24\",\"modbusAddr\":22},{\"fieldName\":\"25\",\"modbusAddr\":23}],\"datatype\":\"number\",\"format\":\"ABCD\"}],\"controller\":{\"config\":{\"rateUnit\":\"s\",\"rate\":5,\"quantity\":26,\"address\":0,\"functionCode\":4}}}]}}\nmsg.payload = payload\n\nreturn msg\n",
        "outputs": 1,
        "noerr": 0,
        "x": 404,
        "y": 340,
        "wires": [
            [
                "3476158.20d2bea"
            ]
        ]
    },
    {
        "id": "b065f510.277cc8",
        "type": "function",
        "z": "2372fc9c.d92ba4",
        "name": "to-influxdb",
        "func": "\nconst { _, fields } = msg.payload\nconst payload = {\n  fields,\n  measurement: \"TODO-ID\",\n  time: new Date().getTime(),\n  precision: \"ms\",\n}\nmsg.payload = JSON.stringify(payload)\n\nreturn msg\n",
        "outputs": "1",
        "noerr": 0,
        "x": 891,
        "y": 249,
        "wires": [
            [
                "2219b132.2d527e"
            ]
        ]
    },
    {
        "id": "769cc714.63a8e8",
        "type": "kafka",
        "z": "2372fc9c.d92ba4",
        "zkquorum": "192.168.33.33:2181",
        "topics": "devbus-alarm",
        "debug": "",
        "x": 1104,
        "y": 428,
        "wires": []
    },
    {
        "id": "cf8fe216.e02ee",
        "type": "function",
        "z": "2372fc9c.d92ba4",
        "name": "devbus-alarm",
        "func": "\nconst { valids, _ } = msg.payload\nconst payload = {\n  fields: valids,\n  measurement: \"TODO-ID\",\n  time: new Date().getTime(),\n  precision: \"ms\",\n}\nmsg.payload = JSON.stringify(payload)\n\nreturn msg\n",
        "outputs": 1,
        "noerr": 0,
        "x": 899,
        "y": 429,
        "wires": [
            [
                "769cc714.63a8e8"
            ]
        ]
    },
    {
        "id": "2219b132.2d527e",
        "type": "kafka",
        "z": "2372fc9c.d92ba4",
        "zkquorum": "192.168.33.33:2181",
        "topics": "devbus-toinfluxdb",
        "debug": "",
        "x": 1098,
        "y": 249,
        "wires": []
    }
]

Node Info

Version: 0.1.6
Updated 3 weeks, 3 days ago
License: Apache

Downloads

7 in the last day
28 in the last week
142 in the last month

Nodes

  • rules

Keywords

  • node-red
  • nodered
  • nodered devbus-rules

Maintainers

  • danielryu