⚒️ Clean and log IoT sensor data to InfluxDB (Webhook | Function | HTTP)

486 views · ⚒️ Engineering

Description

🌡 IoT Sensor Data Cleaner + InfluxDB Logger (n8n | Webhook | Function | InfluxDB)

This workflow accepts raw sensor data from IoT devices via webhook, applies basic cleaning and transformation logic, and writes the cleaned data to an InfluxDB instance for time-series tracking. Perfect for renewable energy sites, smart farms and environmental monitoring setups using dashboards like Grafana or Chronograf.

⚡ Quick Implementation Steps

  1. Import the workflow JSON into your n8n instance.
  2. Edit the Set Config node to include your InfluxDB credentials and measurement name.
  3. Use the webhook URL (/webhook/sensor-data) in your IoT device or form to send sensor data.
  4. Start monitoring your data directly in InfluxDB!

🎯 Who’s It For

🛠 Requirements

ToolPurpose
n8n InstanceFor automation
InfluxDB (v1 or v2)To store time-series sensor data
IoT Device or PlatformTo POST sensor data
Function NodeTo filter and transform data

🧠 What It Does

🧩 Workflow Components

🔧 How To Set Up – Step-by-Step

  1. Import Workflow:

    • Upload the provided .json file into your n8n workspace.
  2. Edit Configuration Node:

    • Update InfluxDB connection info in the Set Config node:
      • influxDbHost, influxDbDatabase, influxDbUsername, influxDbPassword
      • measurement: What you want to name the data set (e.g., sensor_readings)
  3. Send Data to Webhook:

    • Webhook URL: https://your-n8n/webhook/sensor-data
    • Example payload:
      {
        "temperature": 78.3,
        "humidity": 44.2,
        "voltage": 395.7,
        "timestamp": "2024-06-01T12:00:00Z"
      }
  4. View in InfluxDB:

    • Log in to your InfluxDB/Grafana dashboard and query the new measurement.

✨ How To Customize

CustomizationMethod
Add more fields (e.g., wind_speed)Update the Function & InfluxDB nodes
Add field/unit conversionUse math in the Function node
Send email alerts on anomaliesAdd IF → Email branch after Function node
Store in parallel in Google SheetsAdd Google Sheets node for hybrid logging

➕ Add‑ons (Advanced)

Add-onDescription
📊 Grafana IntegrationReal-time charts using InfluxDB
📧 Email on Faulty DataNotify if voltage < 0 or temperature too high
🧠 AI FilteringAdd OpenAI or TensorFlow for anomaly detection
🗃 Dual LoggingSave data to both InfluxDB and BigQuery/Sheets

📈 Use Case Examples

  1. Remote solar inverter sends temperature and voltage via webhook.
  2. Environmental sensor hub logs humidity and air quality data every minute.
  3. Smart greenhouse logs climate control sensor metrics.
  4. Edge IoT devices periodically report health and diagnostics remotely.

🧯 Troubleshooting Guide

IssueCauseSolution
No data logged in InfluxDBInvalid credentials or DB nameRecheck InfluxDB values in config
Webhook not triggeredWrong method or endpointConfirm it is a POST to /webhook/sensor-data
Data gets filteredReadings outside valid rangeCheck logic in Function node
Data not appearing in dashboardInflux write format errorInspect InfluxDB log and field names

📞 Need Assistance?

Need help integrating this workflow into your energy monitoring system or need InfluxDB dashboards built for you?

👉 Contact WeblineIndia | Experts in workflow automation and time-series analytics.

🔗 Nodes Used

Function, HTTP Request, Webhook

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup