Skip to main content

Remote IOT sensor monitoring via MQTT and InfluxDB

Workflow preview

Workflow preview
100%
Remote IOT sensor monitoring via MQTT and InfluxDB preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

. Read and store IOT sensor data with the MQTT Trigger and InfluxDB [email protected] This workflow is for users wanting a practical example of how to obtain data from remote IOT systems usi...

Best for

  • Engineering automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.mqtttrigger, n8n-nodes-base.httprequest, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Tony Duffy.

Original n8n.io source

1.1 Workflow description

Title
Remote IOT sensor monitoring via MQTT and InfluxDB
Workflow name
Remote IOT sensor monitoring via MQTT and InfluxDB

.

Read and store IOT sensor data with the MQTT Trigger and InfluxDB

[email protected]

This workflow is for users wanting a practical example of how to obtain data from remote IOT systems using the MQTT protocol in an n8n environment.

The template provides typical n8n node implementation and configuration settings necessary to read and store IOT data.

The workflow reads the temperature and humidity data from a remote IOT system in this case a DHT22 sensor connected to a ESP32 micro controller. The data is parsed into the correct JSON format and then ingested in an InfluxDB data bucket. From there the stored temperature and humidity values can be displayed in real time.

The workflow can be easily modified to read any MQTT driven device data.

Remote IOT Sensor Setup

The ESP32 controller with the DHT22 sensor are running on a Wokwi simulator. The simulator uses micro python to publish a MQTT "wokwi-weather" topic with the temperature and humidity payloads to an online Mosquitto MQTT broker. The n8n MQTT trigger node subscribes to the topic on the broker and reads the payload values when any changes are published. The code node then prepares the payload for JSON format. The HTTP request node ingests the data in a InfluxDB bucket

How to customise this workflow to your needs

Wokwi IOT ESP32 simulator

  • You will need to setup a free account at Wokwi.com
  • Once created search for a project "Micro-Python MQTT Weather Logger (ESP32)"
  • Then when the MQTT weather logger project is open change lines 28 and 29 to the following
    • 28 MQTT_CLIENT_ID = ""
    • 29 MQTT_BROKER = "test.mosquitto.org"
  • You then can start the simulation by clicking on the green arrow and it will connect the mosquitto broker and the "wokwi-weather" topic will be published.
  • By clicking on the DHT22 sensor the temperature and humidity bar will appear and you can change the values to send updated payload values to the broker.

InfluxDB

You will require access to functioning InfluxDB database to utilise this workflow

Note : You will have to provide the following for the HTTP request node to connect to InfluxDB.

  • The URL and port of the desired InfluxDB (In this case the InfluxDB is running locally on port 8086 ie. http://localhost:8086.)
  • InfluxDB bucket for the data. ( In this case the created bucket name is "wokwi-data")
  • The Organization ID of the InfluxDB. This can be obtained for the InfluxDB admin page
  • A generated API token to read and write to the InfluxDB bucket. Created from the InfluxDB admin

n8n workflow.

  • The MQTT trigger node is configured to subscribe to the "wokwi-weather" topic on the test Mosquitto MQTT broker. It reads the temperature and humidity data sent by ESP32.
  • The code node uses Javascript to move the temperature and humidity payloads to JSON format. This is flexible and can easily modified.
  • The HTTP request node posts the JSON payloads to the InfluxDB bucket.

When the above is configured the workflow should function correctly.

Thanks to the many who have downloaded this template. Let me know on what you would like to build. Contact me at [email protected]

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Remote Sensor MQTT Trigger

Type / Role
n8n-nodes-base.mqttTrigger - mqttTrigger
Config choices
Version 1

Block 5 - Data ingest to InfluxDB bucket

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 6 - Payload data preparation node

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

3. Summary Table

Workflow Remote IOT sensor monitoring via MQTT and InfluxDB
Complexity intermediate
Nodes 6
Categories Engineering
Author Tony Duffy
Published 12 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4004/4004.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Remote IOT sensor monitoring via MQTT and InfluxDB do?

. Read and store IOT sensor data with the MQTT Trigger and InfluxDB [email protected] This workflow is for users wanting a practical example of how to obtain data from remote IOT systems usi...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering use case.