物联网传感器数据清理器 + 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": "物联网传感器数据清理器 + InfluxDB 记录器 (n8n | Webhook | Function | InfluxDB)",
"tags": [],
"nodes": [
{
"id": "0a94db25-793e-4d2d-867a-5fe8132c849c",
"name": "传感器输入",
"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": "清理和转换数据",
"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": "设置配置",
"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 请求",
"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": {
"Set Config": {
"main": [
[
{
"node": "Clean & Transform Data",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[]
]
},
"Sensor Input": {
"main": [
[
{
"node": "Set Config",
"type": "main",
"index": 0
}
]
]
},
"Clean & Transform Data": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个初级难度的工作流,适用于Engineering、Multimodal AI等场景。适合 n8n 新手,包含 1-5 个节点的简单工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
从`.strings`文件填充iOS本地化缺失项→Google Sheets并提交带占位符的PR
将iOS本地化缺失项与Google Sheets和GitHub PR占位符同步
Set
Code
Merge
+3
11 节点WeblineIndia
Engineering
太阳能发电监测预警工作流
监控太阳能发电并通过Gmail、Google表格和Slack发送警报
If
Code
Gmail
+5
9 节点WeblineIndia
Engineering
从 Figma 同步 Android drawable 资源到 GitHub
通过 PR 将 Android drawable 资源从 Figma 同步至 GitHub(多密度 PNG)
If
Code
Merge
+3
14 节点WeblineIndia
Engineering
使用 HTTP Last-Modified 检查从 Google Sheets 获取职位发布过期和刷新提醒
通过 Google Sheets、HTTP 检查和 Gmail 实现职位发布过期提醒的自动化
If
Set
Code
+6
19 节点WeblineIndia
HR
自动化 Zalo OA 令牌管理,集成 OAuth 和 Webhook
自动化 Zalo OA 令牌管理,集成 OAuth 和 Webhook
Set
Code
Webhook
+3
10 节点Le Nguyen
Engineering
合规报告收集器
基于 Google 表单 → Drive + MySQL 的合规报告收集器
Set
Merge
My Sql
+4
8 节点WeblineIndia
File Management
工作流信息
难度等级
初级
节点数量4
分类2
节点类型4
作者
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
外部链接
在 n8n.io 上查看 →
分享此工作流