物联网传感器数据清理器 + InfluxDB 记录器 (n8n | Webhook | Function | InfluxDB)
初级
这是一个Engineering, Multimodal AI领域的自动化工作流,包含 4 个节点。主要使用 Set, Webhook, Function, HttpRequest 等节点。 清理物联网传感器数据并记录到 InfluxDB (Webhook | Function | HTTP)
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •可能需要目标 API 的认证凭证
使用的节点 (4)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "Vz7fCuVAkUFMUjHC",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
"templateCredsSetupCompleted": true
},
"name": "IoT Sensor Data Cleaner + InfluxDB Logger (n8n | Webhook | Function | InfluxDB)",
"tags": [],
"nodes": [
{
"id": "0a94db25-793e-4d2d-867a-5fe8132c849c",
"name": "Sensor Input",
"type": "n8n-nodes-base.webhook",
"position": [
-620,
-60
],
"webhookId": "278534e3-2340-4504-ac50-9c0c1df4e4de",
"parameters": {
"path": "sensor-data",
"options": {
"responseData": "{\"status\":\"received\"}"
},
"httpMethod": "POST"
},
"typeVersion": 1
},
{
"id": "7b1507ea-8760-45ff-bee8-d656723ce34e",
"name": "Clean & Transform Data",
"type": "n8n-nodes-base.function",
"position": [
-220,
-60
],
"parameters": {
"functionCode": "const data = $json.body;\n\nfunction isValid(value, min, max) {\n return typeof value === 'number' && value >= min && value <= max;\n}\n\nif (!isValid(data.temperature, -50, 150) || \n !isValid(data.humidity, 0, 100) || \n !isValid(data.voltage, 0, 500)) {\n throw new Error('Invalid sensor data range');\n}\n\nconst cleaned = {\n temperature: Math.round(data.temperature * 10) / 10,\n humidity: Math.round(data.humidity * 10) / 10,\n voltage: Math.round(data.voltage * 10) / 10,\n timestamp: new Date(data.timestamp).toISOString()\n};\n\nreturn [\n {\n json: cleaned\n }\n];"
},
"typeVersion": 1
},
{
"id": "2bd6195b-4989-4e86-a622-79c5131ccf4e",
"name": "Set Config",
"type": "n8n-nodes-base.set",
"position": [
-420,
-60
],
"parameters": {
"values": {
"string": [
{
"name": "influxDbHost",
"value": "hosturl"
},
{
"name": "influxDbToken",
"value": "token"
},
{
"name": "influxDbBucket",
"value": "bucket"
},
{
"name": "influxDbOrg",
"value": "org"
},
{
"name": "measurement",
"value": "table"
}
]
},
"options": {}
},
"typeVersion": 1
},
{
"id": "6afbb252-6628-4ad3-81da-f8a5db70c171",
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"position": [
20,
-60
],
"parameters": {
"url": "={{$node[\"Set Config\"].json[\"influxDbHost\"]}}/api/v2/write",
"body": "={{$node[\"Set Config\"].json[\"measurement\"]}} temperature={{$json[\"temperature\"]}},humidity={{$json[\"humidity\"]}},voltage={{$json[\"voltage\"]}} {{Date.parse($json[\"timestamp\"])}}",
"method": "POST",
"options": {},
"sendBody": true,
"sendQuery": true,
"contentType": "raw",
"sendHeaders": true,
"rawContentType": "text/plain",
"queryParameters": {
"parameters": [
{
"name": "bucket",
"value": "={{$node[\"Set Config\"].json[\"influxDbBucket\"]}}"
},
{
"name": "org",
"value": "={{$node[\"Set Config\"].json[\"influxDbOrg\"]}}"
},
{
"name": "precision",
"value": "={{$node[\"Set Config\"].json[\"precision\"]}}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Token {{$node[\"Set Config\"].json[\"influxDbToken\"]}}"
}
]
}
},
"typeVersion": 4.2
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "bbe71c64-0ee9-4bef-af35-99f00227f20f",
"connections": {
"2bd6195b-4989-4e86-a622-79c5131ccf4e": {
"main": [
[
{
"node": "7b1507ea-8760-45ff-bee8-d656723ce34e",
"type": "main",
"index": 0
}
]
]
},
"6afbb252-6628-4ad3-81da-f8a5db70c171": {
"main": [
[]
]
},
"0a94db25-793e-4d2d-867a-5fe8132c849c": {
"main": [
[
{
"node": "2bd6195b-4989-4e86-a622-79c5131ccf4e",
"type": "main",
"index": 0
}
]
]
},
"7b1507ea-8760-45ff-bee8-d656723ce34e": {
"main": [
[
{
"node": "6afbb252-6628-4ad3-81da-f8a5db70c171",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
初级 - 工程, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 HTTP Last-Modified 检查从 Google Sheets 获取职位发布过期和刷新提醒
通过 Google Sheets、HTTP 检查和 Gmail 实现职位发布过期提醒的自动化
If
Set
Code
+
If
Set
Code
19 节点WeblineIndia
人力资源
自动化 Zalo OA 令牌管理,集成 OAuth 和 Webhook
自动化 Zalo OA 令牌管理,集成 OAuth 和 Webhook
Set
Code
Webhook
+
Set
Code
Webhook
10 节点Le Nguyen
工程
使用 Unli.dev 生成系统提示
使用 Unli.dev 为 LLM 生成 AI 系统提示
Set
Webhook
Http Request
+
Set
Webhook
Http Request
7 节点Khairul Muhtadin
工程
使用GPT-4的Facebook Messenger机器人,支持文本、图像和语音处理
使用GPT-4的Facebook Messenger机器人,支持文本、图像和语音处理
Set
Code
Switch
+
Set
Code
Switch
34 节点Stéphane Bordas
内容创作
自动化视频上传 → 自动缩略图 → Google Drive
使用 FFmpeg 和 Google Drive 自动化视频上传和缩略图生成
If
Webhook
Google Drive
+
If
Webhook
Google Drive
9 节点WeblineIndia
内容创作
使用 PostgreSQL、PDF.co 和邮件投递自动生成月度能源报告
使用 PostgreSQL、PDF.co 和邮件投递自动生成月度能源报告
Code
Gmail
Postgres
+
Code
Gmail
Postgres
7 节点WeblineIndia
文档提取
工作流信息
难度等级
初级
节点数量4
分类2
节点类型4
作者
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
外部链接
在 n8n.io 查看 →
分享此工作流