node-red-node-tdengine
Version:
The official plugin developed by TDengine for Node-RED.
333 lines • 8.74 kB
JSON
[
{
"id": "8ada4cf724af8319",
"type": "tab",
"label": "流程 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "55d3175344196423",
"type": "TDengineServer",
"name": "td26",
"uri": "ws://root:taosdata@192.168.0.26:6041",
"connType": "host-port",
"host": "192.168.0.26",
"port": "6041",
"db": "test"
},
{
"id": "e2370922a8a5e70e",
"type": "TDengineServer",
"name": "td124",
"uri": "ws://root:taosdata@192.168.2.124:6041",
"connType": "connection-string",
"host": "127.0.0.1",
"port": "6041",
"db": ""
},
{
"id": "113ce50070717687",
"type": "tdengine-operator",
"z": "8ada4cf724af8319",
"db": "e2370922a8a5e70e",
"name": "td-writer",
"x": 500,
"y": 120,
"wires": [
[
"0dcdb6f664673f8a"
]
]
},
{
"id": "c4e8e8429d2ee08e",
"type": "inject",
"z": "8ada4cf724af8319",
"name": "inject1",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "30",
"crontab": "",
"once": false,
"onceDelay": "1",
"topic": "",
"payload": "!",
"payloadType": "bool",
"x": 140,
"y": 80,
"wires": [
[
"a15cdc6a0f9e23b6"
]
]
},
{
"id": "a15cdc6a0f9e23b6",
"type": "function",
"z": "8ada4cf724af8319",
"name": "write d0",
"func": "// generate rand\nconst value2 = Math.floor(Math.random() * (30 - 5 + 1)) + 5; // 5-30\nconst value3 = Math.floor(Math.random() * (240 - 198 + 1)) + 198; // 198-240\nconst value4 = Math.floor(Math.random() * (3 - 1 + 1)) + 1; // 1-3\n\n// sql\nmsg.topic = `insert into test.d0 values (now, ${value2}, ${value3}, ${value4}) ;`;\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "// 部署节点后,此处添加的代码将运行一次。 \n\"create database if not exists test;\"",
"finalize": "",
"libs": [],
"x": 320,
"y": 80,
"wires": [
[
"113ce50070717687"
]
]
},
{
"id": "0dcdb6f664673f8a",
"type": "debug",
"z": "8ada4cf724af8319",
"name": "debug 1",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "counter",
"x": 660,
"y": 120,
"wires": []
},
{
"id": "6fed2c22511e9577",
"type": "tdengine-operator",
"z": "8ada4cf724af8319",
"db": "e2370922a8a5e70e",
"name": "td-reader",
"x": 320,
"y": 220,
"wires": [
[
"e773744c20668d3e"
]
]
},
{
"id": "56483f8eed924f4f",
"type": "inject",
"z": "8ada4cf724af8319",
"name": "query",
"props": [
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "select tbname, avg(current),avg(voltage),sum(p) from ( select tbname,current,voltage,current*voltage/60 as p from test.meters where ts > now-60s partition by tbname) group by tbname;",
"x": 130,
"y": 220,
"wires": [
[
"6fed2c22511e9577"
]
]
},
{
"id": "e773744c20668d3e",
"type": "debug",
"z": "8ada4cf724af8319",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "counter",
"x": 510,
"y": 220,
"wires": []
},
{
"id": "25f29645f0644f34",
"type": "catch",
"z": "8ada4cf724af8319",
"name": "catch all except",
"scope": null,
"uncaught": false,
"x": 140,
"y": 340,
"wires": [
[
"17137e7c7ba7b1da"
]
]
},
{
"id": "17137e7c7ba7b1da",
"type": "debug",
"z": "8ada4cf724af8319",
"name": "debug 4",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "counter",
"x": 320,
"y": 340,
"wires": []
},
{
"id": "597131601b6d69ac",
"type": "inject",
"z": "8ada4cf724af8319",
"name": "inject2",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "1",
"crontab": "",
"once": false,
"onceDelay": "1",
"topic": "",
"payload": "!",
"payloadType": "bool",
"x": 140,
"y": 120,
"wires": [
[
"ab1ccfc2a8641b3e"
]
]
},
{
"id": "ab1ccfc2a8641b3e",
"type": "function",
"z": "8ada4cf724af8319",
"name": "write d1",
"func": "// generate rand\nconst value2 = Math.floor(Math.random() * (50 - 10 + 1)) + 5; // 10-50\nconst value3 = Math.floor(Math.random() * (230 - 180 + 1)) + 180; // 180-230\nconst value4 = Math.floor(Math.random() * (6 - 4 + 1)) + 1; // 4-6\n\n// sql\nmsg.topic = `insert into test.d1 values (now, ${value2}, ${value3}, ${value4}) ;`;\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 120,
"wires": [
[
"113ce50070717687"
]
]
},
{
"id": "2c3d119ad0378009",
"type": "inject",
"z": "8ada4cf724af8319",
"name": "inject3",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "1",
"crontab": "",
"once": false,
"onceDelay": "1",
"topic": "",
"payload": "!",
"payloadType": "bool",
"x": 140,
"y": 160,
"wires": [
[
"aff2362069894f41"
]
]
},
{
"id": "aff2362069894f41",
"type": "function",
"z": "8ada4cf724af8319",
"name": "write d2",
"func": "// generate rand\nconst value2 = Math.floor(Math.random() * (50 - 1 + 1)) + 1; // 1-50\nconst value3 = Math.floor(Math.random() * (260 - 210 + 1)) + 210; // 210-260\nconst value4 = Math.floor(Math.random() * (3 - 1 + 1)) + 1; // 1-3\n\n// sql\nmsg.topic = `insert into test.d2 values (now, ${value2}, ${value3}, ${value4}) ;`;\n\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 160,
"wires": [
[
"113ce50070717687"
]
]
},
{
"id": "3bbe13f798d70840",
"type": "tdengine-consumer",
"z": "8ada4cf724af8319",
"name": "td-consumer",
"uri": "ws://192.168.2.124:6041",
"pollTimeout": "20000",
"topic": "topic_overload",
"groupId": "dkjgroup2",
"clientId": "dkjclient",
"autoCommitIntervalMs": "2004",
"autoOffsetReset": "earliest",
"autoCommit": false,
"x": 130,
"y": 280,
"wires": [
[
"c4755939b74bae0f"
]
]
},
{
"id": "c4755939b74bae0f",
"type": "debug",
"z": "8ada4cf724af8319",
"name": "debug 3",
"active": true,
"tosidebar": false,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "counter",
"x": 320,
"y": 280,
"wires": []
}
]