The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Smart Manufacturing \u2014 MQTT to InfluxDB",
"nodes": [
{
"parameters": {
"topics": [
{
"topic": "cima/machines/+/energy"
},
{
"topic": "cima/machines/+/cycle"
},
{
"topic": "cima/rfid/scan"
},
{
"topic": "cima/system/heartbeat"
}
],
"options": {}
},
"id": "a1b2c3d4-0001-0001-0001-000000000001",
"name": "MQTT Trigger",
"type": "n8n-nodes-base.mqttTrigger",
"typeVersion": 1,
"position": [
240,
300
],
"credentials": {
"mqtt": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const topic = $input.item.json.topic || '';\nlet data;\ntry {\n data = JSON.parse($input.item.json.message || '{}');\n} catch(e) {\n data = { raw: $input.item.json.message };\n}\n\ndata._topic = topic;\ndata._plant = topic.startsWith('cima') ? 'cima' : 'celda3105';\ndata._type = topic.split('/').pop();\ndata._receivedAt = new Date().toISOString();\n\nreturn { json: data };"
},
"id": "a1b2c3d4-0002-0002-0002-000000000002",
"name": "Parsear mensaje",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "condition-01",
"leftValue": "={{ $json._type }}",
"rightValue": "energy",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "a1b2c3d4-0003-0003-0003-000000000003",
"name": "Es dato de energ\u00eda?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
680,
300
]
},
{
"parameters": {
"method": "POST",
"url": "http://localhost:8086/api/v2/write",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "text/plain; charset=utf-8"
}
]
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "org",
"value": "smart-manufacturing"
},
{
"name": "bucket",
"value": "sensor-data"
},
{
"name": "precision",
"value": "ms"
}
]
},
"sendBody": true,
"contentType": "raw",
"rawContentType": "text/plain",
"body": "=cima_energy,machine={{ $json.machine_id || 'unknown' }} power_w={{ $json.power_w || 0 }},irms_a={{ $json.irms_a || 0 }},energy_kwh={{ $json.energy_kwh || 0 }},simulated={{ $json.simulated ? 1 : 0 }} {{ Date.now() }}",
"options": {}
},
"id": "a1b2c3d4-0004-0004-0004-000000000004",
"name": "Guardar en InfluxDB",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
900,
200
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "condition-02",
"leftValue": "={{ $json.power_w }}",
"rightValue": 3000,
"operator": {
"type": "number",
"operation": "gte"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "a1b2c3d4-0005-0005-0005-000000000005",
"name": "Anomal\u00eda de consumo?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1120,
200
]
},
{
"parameters": {
"jsCode": "const d = $input.item.json;\nreturn {\n json: {\n alert: 'HIGH_POWER',\n severity: d.power_w > 5000 ? 'critical' : 'warning',\n machine: d.machine_id,\n power_w: d.power_w,\n message: `Consumo an\u00f3malo en ${d.machine_id}: ${d.power_w}W`,\n ts: new Date().toISOString()\n }\n};"
},
"id": "a1b2c3d4-0006-0006-0006-000000000006",
"name": "Generar alerta",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1340,
160
]
}
],
"connections": {
"MQTT Trigger": {
"main": [
[
{
"node": "Parsear mensaje",
"type": "main",
"index": 0
}
]
]
},
"Parsear mensaje": {
"main": [
[
{
"node": "Es dato de energ\u00eda?",
"type": "main",
"index": 0
}
]
]
},
"Es dato de energ\u00eda?": {
"main": [
[
{
"node": "Guardar en InfluxDB",
"type": "main",
"index": 0
}
],
[]
]
},
"Guardar en InfluxDB": {
"main": [
[
{
"node": "Anomal\u00eda de consumo?",
"type": "main",
"index": 0
}
]
]
},
"Anomal\u00eda de consumo?": {
"main": [
[
{
"node": "Generar alerta",
"type": "main",
"index": 0
}
],
[]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 1,
"updatedAt": "2026-03-28T00:00:00.000Z",
"versionId": "v1"
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
httpHeaderAuthmqtt
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Smart Manufacturing — MQTT to InfluxDB. Uses mqttTrigger, httpRequest. Event-driven trigger; 6 nodes.
Source: https://github.com/Caspian258/Smart-Manufacturing-Project/blob/4acd2e3336ef30ea57f238fcd949c810e466c66c/flows/n8n/mqtt_to_influxdb_v2.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This template integrates an IOT multi-button switch (meant for controlling a dimmable light) with Spotify playback functions, via MQTT messages. This isn't likely to work without some tinkering, but s
This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t
[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.
[](https://youtu.be/c7yCZhmMjtI)
This automation organizes your n8n workflows files into categorizes (Active, Template, Done, Archived) and uploads them directly to a categorized Google Drive folders. It is designed to help users man