Я хочу создать приборную панель, которая показывает мне диаграмму с некоторыми датчиками температуры, но я хочу иметь возможность добавлять новые датчики, это означает, что мне нужно добавить больше узлов mqtt, которые получают информацию от датчиков, поэтому я хочувызвать функцию, которая может добавить новые узлы и заполнить эту информацию.
Вот мой поток:
[
{
"disabled": false,
"id": "8de11c1b.d1381",
"info": "En este ejemplo veremos como hacer publish y suscribed un esp8266\n",
"label": "ESP8266 mqtt example",
"type": "tab"
},
{
"active": true,
"complete": "payload",
"console": false,
"id": "743d14f5.c455ec",
"name": "",
"targetType": "msg",
"tosidebar": true,
"tostatus": false,
"type": "debug",
"wires": [],
"x": 550,
"y": 140,
"z": "8de11c1b.d1381"
},
{
"broker": "99ab1fe8.351c",
"datatype": "utf8",
"id": "331b366d.b09c8a",
"name": "espClient",
"qos": "0",
"topic": "Datalogger/Sensor1/Temperatura",
"type": "mqtt in",
"wires": [
[
"25f4bc93.5079a4"
]
],
"x": 80,
"y": 60,
"z": "8de11c1b.d1381"
},
{
"id": "2e0aed2b.1f5392",
"influxdb": "b162be8e.9a228",
"measurement": "Datalogger",
"name": "espClient",
"precision": "",
"retentionPolicy": "",
"type": "influxdb out",
"wires": [],
"x": 560,
"y": 200,
"z": "8de11c1b.d1381"
},
{
"func": "//msg.payload = Number(msg.payload);\n//return msg;\n\nmsg.payload={\n Temp1: Number(msg.payload)\n // Num2: parseFloat((Math.random()*10).toFixed(0))\n}\nreturn msg;",
"id": "25f4bc93.5079a4",
"name": "String2Number",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"6babeab6.ef08c4"
]
],
"x": 240,
"y": 60,
"z": "8de11c1b.d1381"
},
{
"broker": "2bd5e6a3.18b54a",
"datatype": "utf8",
"id": "1fb3b52c.4a48fb",
"name": "espClient2",
"qos": "0",
"topic": "Datalogger/Sensor2/Temperatura",
"type": "mqtt in",
"wires": [
[
"aeedb7d8.8b7158"
]
],
"x": 80,
"y": 120,
"z": "8de11c1b.d1381"
},
{
"func": "//msg.payload = Number(msg.payload);\n//return msg;\n\nmsg.payload={\n Temp2: Number(msg.payload)\n // Num2: parseFloat((Math.random()*10).toFixed(0))\n}\nreturn msg;",
"id": "aeedb7d8.8b7158",
"name": "String2Number",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"743d14f5.c455ec",
"2e0aed2b.1f5392"
]
],
"x": 240,
"y": 120,
"z": "8de11c1b.d1381"
},
{
"func": "//msg.payload = Number(msg.payload);\n//return msg;\n\nmsg.payload={\n Temp3: Number(msg.payload)\n // Num2: parseFloat((Math.random()*10).toFixed(0))\n}\nreturn msg;",
"id": "956da7ee.eab5e8",
"name": "String2Number",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"743d14f5.c455ec",
"2e0aed2b.1f5392"
]
],
"x": 240,
"y": 180,
"z": "8de11c1b.d1381"
},
{
"func": "//msg.payload = Number(msg.payload);\n//return msg;\n\nmsg.payload={\n Temp4: Number(msg.payload)\n // Num2: parseFloat((Math.random()*10).toFixed(0))\n}\nreturn msg;",
"id": "9bc165af.4a87e8",
"name": "String2Number",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"743d14f5.c455ec"
]
],
"x": 240,
"y": 240,
"z": "8de11c1b.d1381"
},
{
"broker": "93b50fd3.02468",
"datatype": "utf8",
"id": "61eccc22.ee5ce4",
"name": "espClient3",
"qos": "0",
"topic": "Datalogger/Sensor3/Temperatura",
"type": "mqtt in",
"wires": [
[
"956da7ee.eab5e8"
]
],
"x": 80,
"y": 180,
"z": "8de11c1b.d1381"
},
{
"broker": "f8c54557.6bbb98",
"datatype": "utf8",
"id": "33d1b802.4b9ff8",
"name": "espClient4",
"qos": "0",
"topic": "Datalogger/Sensor4/Temperatura",
"type": "mqtt in",
"wires": [
[
"9bc165af.4a87e8"
]
],
"x": 80,
"y": 240,
"z": "8de11c1b.d1381"
},
{
"broker": "b71e7edb.a0b15",
"datatype": "utf8",
"id": "11231c0b.850554",
"name": "espClient5",
"qos": "0",
"topic": "Datalogger/Sensor5/Temperatura",
"type": "mqtt in",
"wires": [
[
"4f9f9174.18b9f"
]
],
"x": 80,
"y": 300,
"z": "8de11c1b.d1381"
},
{
"func": "//msg.payload = Number(msg.payload);\n//return msg;\n\nmsg.payload={\n Temp5: Number(msg.payload)\n // Num2: parseFloat((Math.random()*10).toFixed(0))\n}\nreturn msg;",
"id": "4f9f9174.18b9f",
"name": "String2Number",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"2e0aed2b.1f5392"
]
],
"x": 240,
"y": 300,
"z": "8de11c1b.d1381"
},
{
"drop": false,
"id": "6babeab6.ef08c4",
"name": "",
"nbRateUnits": "1",
"pauseType": "delay",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"rate": "1",
"rateUnits": "second",
"timeout": "2",
"timeoutUnits": "seconds",
"type": "delay",
"wires": [
[
"743d14f5.c455ec",
"2e0aed2b.1f5392"
]
],
"x": 400,
"y": 60,
"z": "8de11c1b.d1381"
},
{
"broker": "7d36be02.d2d36",
"datatype": "utf8",
"id": "2c2860f1.c501d",
"name": "espClient6",
"qos": "0",
"topic": "Datalogger/Sensor6/Temperatura",
"type": "mqtt in",
"wires": [
[
"cf399c6.ff3da6"
]
],
"x": 80,
"y": 360,
"z": "8de11c1b.d1381"
},
{
"func": "//msg.payload = Number(msg.payload);\n//return msg;\n\nmsg.payload={\n Temp6: Number(msg.payload)\n // Num2: parseFloat((Math.random()*10).toFixed(0))\n}\nreturn msg;",
"id": "cf399c6.ff3da6",
"name": "String2Number",
"noerr": 0,
"outputs": 1,
"type": "function",
"wires": [
[
"2e0aed2b.1f5392",
"743d14f5.c455ec"
]
],
"x": 260,
"y": 360,
"z": "8de11c1b.d1381"
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "192.168.1.13",
"cleansession": true,
"clientid": "espClient",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": true,
"id": "99ab1fe8.351c",
"keepalive": "60",
"name": "espClient",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
},
{
"database": "Temperatura",
"hostname": "127.0.0.1",
"id": "b162be8e.9a228",
"name": "",
"port": "8086",
"protocol": "http",
"tls": "",
"type": "influxdb",
"usetls": false,
"z": ""
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "192.168.1.13",
"cleansession": true,
"clientid": "espClient2",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": true,
"id": "2bd5e6a3.18b54a",
"keepalive": "60",
"name": "espClient2",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "192.168.1.13",
"cleansession": false,
"clientid": "espClient3",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": true,
"id": "93b50fd3.02468",
"keepalive": "60",
"name": "espClient3",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "192.168.1.13",
"cleansession": true,
"clientid": "espClient4",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": true,
"id": "f8c54557.6bbb98",
"keepalive": "60",
"name": "espClient4",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "192.168.1.13",
"cleansession": true,
"clientid": "espClient5",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": true,
"id": "b71e7edb.a0b15",
"keepalive": "60",
"name": "espClient5",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
},
{
"birthPayload": "",
"birthQos": "0",
"birthTopic": "",
"broker": "localhost",
"cleansession": true,
"clientid": "espclient6",
"closePayload": "",
"closeQos": "0",
"closeTopic": "",
"compatmode": true,
"id": "7d36be02.d2d36",
"keepalive": "60",
"name": "espClient6",
"port": "1883",
"type": "mqtt-broker",
"usetls": false,
"willPayload": "",
"willQos": "0",
"willTopic": "",
"z": ""
}
]