node-red-contrib-influxdb3 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +386 -377
- package/__tests__/influxdb3.test.js +240 -0
- package/examples/basic-flow.json +170 -170
- package/examples/mqtt-to-influx.json +134 -134
- package/influxdb3.html +243 -228
- package/influxdb3.js +315 -303
- package/package.json +44 -42
- package/renovate.json +6 -6
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "mqtt-flow",
|
|
4
|
-
"type": "tab",
|
|
5
|
-
"label": "MQTT to InfluxDB v3",
|
|
6
|
-
"disabled": false,
|
|
7
|
-
"info": "Example flow showing how to capture MQTT data and write to InfluxDB v3"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"id": "mqtt-in",
|
|
11
|
-
"type": "mqtt in",
|
|
12
|
-
"z": "mqtt-flow",
|
|
13
|
-
"name": "MQTT Sensor Data",
|
|
14
|
-
"topic": "sensors/+/data",
|
|
15
|
-
"qos": "0",
|
|
16
|
-
"datatype": "json",
|
|
17
|
-
"broker": "mqtt-broker",
|
|
18
|
-
"nl": false,
|
|
19
|
-
"rap": false,
|
|
20
|
-
"inputs": 0,
|
|
21
|
-
"x": 140,
|
|
22
|
-
"y": 100,
|
|
23
|
-
"wires": [
|
|
24
|
-
[
|
|
25
|
-
"parse-mqtt"
|
|
26
|
-
]
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"id": "parse-mqtt",
|
|
31
|
-
"type": "function",
|
|
32
|
-
"z": "mqtt-flow",
|
|
33
|
-
"name": "Parse MQTT Data",
|
|
34
|
-
"func": "// Extract sensor ID from topic (sensors/SENSOR_ID/data)\nconst topicParts = msg.topic.split('/');\nconst sensorId = topicParts[1];\n\n// Prepare data for InfluxDB\nmsg.measurement = 'sensor_readings';\nmsg.payload = {\n fields: {\n temperature: msg.payload.temperature,\n humidity: msg.payload.humidity,\n battery: msg.payload.battery\n },\n tags: {\n sensor_id: sensorId,\n location: msg.payload.location || 'unknown'\n }\n};\n\nreturn msg;",
|
|
35
|
-
"outputs": 1,
|
|
36
|
-
"noerr": 0,
|
|
37
|
-
"initialize": "",
|
|
38
|
-
"finalize": "",
|
|
39
|
-
"libs": [],
|
|
40
|
-
"x": 360,
|
|
41
|
-
"y": 100,
|
|
42
|
-
"wires": [
|
|
43
|
-
[
|
|
44
|
-
"influx-write",
|
|
45
|
-
"debug-mqtt"
|
|
46
|
-
]
|
|
47
|
-
]
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"id": "influx-write",
|
|
51
|
-
"type": "influxdb3-write",
|
|
52
|
-
"z": "mqtt-flow",
|
|
53
|
-
"influxdb": "influxdb3-config",
|
|
54
|
-
"name": "Store in InfluxDB",
|
|
55
|
-
"measurement": "",
|
|
56
|
-
"database": "",
|
|
57
|
-
"x": 590,
|
|
58
|
-
"y": 100,
|
|
59
|
-
"wires": [
|
|
60
|
-
[
|
|
61
|
-
"debug-success"
|
|
62
|
-
]
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"id": "debug-mqtt",
|
|
67
|
-
"type": "debug",
|
|
68
|
-
"z": "mqtt-flow",
|
|
69
|
-
"name": "MQTT Data",
|
|
70
|
-
"active": true,
|
|
71
|
-
"tosidebar": true,
|
|
72
|
-
"console": false,
|
|
73
|
-
"tostatus": false,
|
|
74
|
-
"complete": "payload",
|
|
75
|
-
"targetType": "msg",
|
|
76
|
-
"statusVal": "",
|
|
77
|
-
"statusType": "auto",
|
|
78
|
-
"x": 570,
|
|
79
|
-
"y": 60,
|
|
80
|
-
"wires": []
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"id": "debug-success",
|
|
84
|
-
"type": "debug",
|
|
85
|
-
"z": "mqtt-flow",
|
|
86
|
-
"name": "Write Result",
|
|
87
|
-
"active": true,
|
|
88
|
-
"tosidebar": true,
|
|
89
|
-
"console": false,
|
|
90
|
-
"tostatus": false,
|
|
91
|
-
"complete": "true",
|
|
92
|
-
"targetType": "full",
|
|
93
|
-
"statusVal": "",
|
|
94
|
-
"statusType": "auto",
|
|
95
|
-
"x": 790,
|
|
96
|
-
"y": 100,
|
|
97
|
-
"wires": []
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"id": "mqtt-broker",
|
|
101
|
-
"type": "mqtt-broker",
|
|
102
|
-
"name": "Local MQTT Broker",
|
|
103
|
-
"broker": "localhost",
|
|
104
|
-
"port": "1883",
|
|
105
|
-
"clientid": "",
|
|
106
|
-
"autoConnect": true,
|
|
107
|
-
"usetls": false,
|
|
108
|
-
"protocolVersion": "4",
|
|
109
|
-
"keepalive": "60",
|
|
110
|
-
"cleansession": true,
|
|
111
|
-
"birthTopic": "",
|
|
112
|
-
"birthQos": "0",
|
|
113
|
-
"birthPayload": "",
|
|
114
|
-
"birthMsg": {},
|
|
115
|
-
"closeTopic": "",
|
|
116
|
-
"closeQos": "0",
|
|
117
|
-
"closePayload": "",
|
|
118
|
-
"closeMsg": {},
|
|
119
|
-
"willTopic": "",
|
|
120
|
-
"willQos": "0",
|
|
121
|
-
"willPayload": "",
|
|
122
|
-
"willMsg": {},
|
|
123
|
-
"userProps": "",
|
|
124
|
-
"sessionExpiry": ""
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"id": "influxdb3-config",
|
|
128
|
-
"type": "influxdb3-config",
|
|
129
|
-
"name": "My InfluxDB v3",
|
|
130
|
-
"host": "https://us-east-1-1.aws.cloud2.influxdata.com",
|
|
131
|
-
"database": "my-database"
|
|
132
|
-
}
|
|
133
|
-
]
|
|
134
|
-
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "mqtt-flow",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "MQTT to InfluxDB v3",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "Example flow showing how to capture MQTT data and write to InfluxDB v3"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "mqtt-in",
|
|
11
|
+
"type": "mqtt in",
|
|
12
|
+
"z": "mqtt-flow",
|
|
13
|
+
"name": "MQTT Sensor Data",
|
|
14
|
+
"topic": "sensors/+/data",
|
|
15
|
+
"qos": "0",
|
|
16
|
+
"datatype": "json",
|
|
17
|
+
"broker": "mqtt-broker",
|
|
18
|
+
"nl": false,
|
|
19
|
+
"rap": false,
|
|
20
|
+
"inputs": 0,
|
|
21
|
+
"x": 140,
|
|
22
|
+
"y": 100,
|
|
23
|
+
"wires": [
|
|
24
|
+
[
|
|
25
|
+
"parse-mqtt"
|
|
26
|
+
]
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"id": "parse-mqtt",
|
|
31
|
+
"type": "function",
|
|
32
|
+
"z": "mqtt-flow",
|
|
33
|
+
"name": "Parse MQTT Data",
|
|
34
|
+
"func": "// Extract sensor ID from topic (sensors/SENSOR_ID/data)\nconst topicParts = msg.topic.split('/');\nconst sensorId = topicParts[1];\n\n// Prepare data for InfluxDB\nmsg.measurement = 'sensor_readings';\nmsg.payload = {\n fields: {\n temperature: msg.payload.temperature,\n humidity: msg.payload.humidity,\n battery: msg.payload.battery\n },\n tags: {\n sensor_id: sensorId,\n location: msg.payload.location || 'unknown'\n }\n};\n\nreturn msg;",
|
|
35
|
+
"outputs": 1,
|
|
36
|
+
"noerr": 0,
|
|
37
|
+
"initialize": "",
|
|
38
|
+
"finalize": "",
|
|
39
|
+
"libs": [],
|
|
40
|
+
"x": 360,
|
|
41
|
+
"y": 100,
|
|
42
|
+
"wires": [
|
|
43
|
+
[
|
|
44
|
+
"influx-write",
|
|
45
|
+
"debug-mqtt"
|
|
46
|
+
]
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "influx-write",
|
|
51
|
+
"type": "influxdb3-write",
|
|
52
|
+
"z": "mqtt-flow",
|
|
53
|
+
"influxdb": "influxdb3-config",
|
|
54
|
+
"name": "Store in InfluxDB",
|
|
55
|
+
"measurement": "",
|
|
56
|
+
"database": "",
|
|
57
|
+
"x": 590,
|
|
58
|
+
"y": 100,
|
|
59
|
+
"wires": [
|
|
60
|
+
[
|
|
61
|
+
"debug-success"
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "debug-mqtt",
|
|
67
|
+
"type": "debug",
|
|
68
|
+
"z": "mqtt-flow",
|
|
69
|
+
"name": "MQTT Data",
|
|
70
|
+
"active": true,
|
|
71
|
+
"tosidebar": true,
|
|
72
|
+
"console": false,
|
|
73
|
+
"tostatus": false,
|
|
74
|
+
"complete": "payload",
|
|
75
|
+
"targetType": "msg",
|
|
76
|
+
"statusVal": "",
|
|
77
|
+
"statusType": "auto",
|
|
78
|
+
"x": 570,
|
|
79
|
+
"y": 60,
|
|
80
|
+
"wires": []
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "debug-success",
|
|
84
|
+
"type": "debug",
|
|
85
|
+
"z": "mqtt-flow",
|
|
86
|
+
"name": "Write Result",
|
|
87
|
+
"active": true,
|
|
88
|
+
"tosidebar": true,
|
|
89
|
+
"console": false,
|
|
90
|
+
"tostatus": false,
|
|
91
|
+
"complete": "true",
|
|
92
|
+
"targetType": "full",
|
|
93
|
+
"statusVal": "",
|
|
94
|
+
"statusType": "auto",
|
|
95
|
+
"x": 790,
|
|
96
|
+
"y": 100,
|
|
97
|
+
"wires": []
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"id": "mqtt-broker",
|
|
101
|
+
"type": "mqtt-broker",
|
|
102
|
+
"name": "Local MQTT Broker",
|
|
103
|
+
"broker": "localhost",
|
|
104
|
+
"port": "1883",
|
|
105
|
+
"clientid": "",
|
|
106
|
+
"autoConnect": true,
|
|
107
|
+
"usetls": false,
|
|
108
|
+
"protocolVersion": "4",
|
|
109
|
+
"keepalive": "60",
|
|
110
|
+
"cleansession": true,
|
|
111
|
+
"birthTopic": "",
|
|
112
|
+
"birthQos": "0",
|
|
113
|
+
"birthPayload": "",
|
|
114
|
+
"birthMsg": {},
|
|
115
|
+
"closeTopic": "",
|
|
116
|
+
"closeQos": "0",
|
|
117
|
+
"closePayload": "",
|
|
118
|
+
"closeMsg": {},
|
|
119
|
+
"willTopic": "",
|
|
120
|
+
"willQos": "0",
|
|
121
|
+
"willPayload": "",
|
|
122
|
+
"willMsg": {},
|
|
123
|
+
"userProps": "",
|
|
124
|
+
"sessionExpiry": ""
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "influxdb3-config",
|
|
128
|
+
"type": "influxdb3-config",
|
|
129
|
+
"name": "My InfluxDB v3",
|
|
130
|
+
"host": "https://us-east-1-1.aws.cloud2.influxdata.com",
|
|
131
|
+
"database": "my-database"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
|