--- title: "InfluxDB Payload" slug: "mqtt-client-influxdb-example-1" description: "MQTT Client is a N3uron module designed to connect to any MQTT broker in order to send and receive tag events. Mqtt Client implements a bidirectional…" updated: 2025-09-30T15:55:31Z published: 2025-12-23T10:03:05Z canonical: "docs.n3uron.com/mqtt-client-influxdb-example-1" excludeFromSearch: true excludeFromExternalSearch: true --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.n3uron.com/llms.txt > Use this file to discover all available pages before exploring further. # InfluxDB Payload ## Overview [Embedded content](https://www.youtube.com/embed/b3zfQWoyiis?&wmode=opaque&rel=0) This example will explain in detail how to seamlessly push the data model created within a **N3uron** node into InfluxDB Cloud using its [MQTT Native Collector](https://www.influxdata.com/integration/mqtt-native-collector/) that effectively turns InfluxDB into an MQTT client. As depicted in the image below, we will also need to deploy an MQTT broker, in this case, we will use a [HiveMQ Cloud cluster](https://www.hivemq.com/mqtt-cloud-broker/).![mqtt-hivemq-and-influxdb-diagram-2](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/mqtt-hivemq-and-influxdb-diagram-2.jpg) Note:This feature is new in N3uron version **1.21.4** ## **N3uron and InfluxDB Requirements** It is assumed that you already have an InfluxDB Cloud account. If not, you can create one at [https://cloud2.influxdata.com/signup](https://cloud2.influxdata.com/signup). If you haven’t downloaded **N3uron** yet, you can do so at [https://n3uron.com/downloads/](https://n3uron.com/downloads/). ## **HiveMQ Cloud MQTT Broker configuration** It is assumed that you already have signed up for the HiveMQ Cloud. Once done, access your HiveMQ Cloud cluster to start configuration and proceed as follows: - **Step 1:** Select **Manage Cluster**. ![Figure 4 - HiveMQ Manage Cluster](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%204%20-%20HiveMQ%20Manage%20Cluster.png) - **Step 2:** Some important information will appear on the overview page, such as the Cluster URL and the Port for the connection. Before beginning to establish a connection, click on the “**Access Management**” tab in the header. ![1.png](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/1.png.jpg) - **Step 3:** A username and password must be defined in order to allow clients to access the cluster. Go to “**Set up credentials for your IoT devices**” and complete these fields. When set, you will see the new user in “Active MQTT credentials”. **![Figure - Add](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20Add.png)** ## Configuring the MQTT Client Module in N3uron - **Step 1:**Create the module: *(*Config => Modules =>Model=> New module*)* ![Figure - New module(1)](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20New%20module(1).png) - **Step 2:** Provide a name for the module (in this case MQTTClient), assign the module type to MqttClient and save the new configuration. ![Figure MQTT - Creating a Module Instance](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20MQTT%20-%20Creating%20a%20Module%20Instance.png) - **Step 3:** Configure the **Logger** and **API** sections (usually the default values are sufficient). Save the configuration. ![Figure MQTT - Logger](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20MQTT%20-%20Logger.png) - **Step 4:** Create the connection to the MQTT Server. To do this, click the button on the left-hand side of the Model header, select New connection, and give it a name. In this case, we have called it HiveMQ. Each connection is an independent **MQTT** **client**. ![Figure - New Connection](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Figure%20-%20New%20Connection.png) - **Step 5:** Configure the **MQTT Client** as follows: ![N3uron1.1](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/N3uron1.1.png) - **Enable MQTT connection:** Yes**.** - **Version:** MQTT 3.X**.** - **Destination broker:** Custom**.** - **Authentication:** - **Authentication mode:** Password. - **Username:** n3uron. - **Password: Enter the password you used for the n3uron user when you configured it in the HiveMQ Cloud MQTT Broker.** - **Connection options:** - **Protocol:** MQTTS. - **Broker URL:** Enter your HiveMQ Cluster URL. - **Port:** 8883. - **Clean session:** Yes. - **Client ID:** Select an id for your MQTT Client. For example, N3uron_Gateway. - **Reconnect period:** 30000. - **Keep-alive interval:** 60. - **Interval between messages:** 0. - **Last will and testament:** - **Enable:** No. - **Step 6:** Once configured, let's create a new **Publisher**. To do this, click on the ellipsis button to the right of **Agents** and select New Publisher. ![N3uron2.1](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/N3uron2.1.png) - **Step 7:** Now, give a name to the publisher (for example, InfluxDB) and configure the rest of its parameters: - Push interval: 5000. - Mode: events. - Topic: Define the topic for the subscribers to identify it. We called it Influxn3. - QoS: 0. - Retain flag: false. - Message options: - Max events per message: 1000. - Store & Forward: - Enable: true. - **Path:** If left blank, the path will be /data/MqttClientInstance/ConnectionName/AgentName/. - **Max. days in disk:** 15. - Message format: Specify the **Topic** of the message. In this case, Influxn3. Then, select InfluxDB in **Serialization** to use InfluxDB Payload. ![EXhndBU](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/EXhndBU.png) - **Step 8:** As we can see, when InfluxDB is selected, the following fields are shown. Configure them properly and click on **Save**. ![ml18KyC](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/ml18KyC.png) - **Serialization:** InfluxDB. - **Measurement name:** The measurement name to send to InfluxDB. In this case, N3uron_Gateway. - **Tag path label:** The key of the InfluxDB tag set where the tag path is sent (by default, Tag). - **Value label:** The key of the InfluxDB field set where the tag value is sent (by default, value). - **Quality label:** The key of the InfluxDB field set where the tag quality is sent. If **empty**, the quality will not be sent (by default, quality). - **Timestamp precision:** The units of the timestamp. The default value of InfluxDB is nanoseconds, but N3uron works with milliseconds. Change it to milliseconds. - **Step 9:** Create a **Tag Filter** and give it a name (for example: Voltage). You can leave the rest of the parameter default values or select only the **path** of the tags you want to send. In this case, we have only included the Voltage tags. Do not forget to **save changes** when you finish. ![tkLbcOc](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/tkLbcOc.png) ![QMAzTkj](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/QMAzTkj.png) ## InfluxDB Cloud Configuration for Receiving MQTT Data The last step to completing your connection starts with gaining access to [InfluxDB Cloud](https://cloud2.influxdata.com/signup). If you do not have an account yet you can create one at [https://cloud2.influxdata.com/signup](https://cloud2.influxdata.com/signup). - **Step 1:** Once you are signed in, navigate to “**Native subscriptions**” by clicking on the upward-facing arrow on the left of the screen. ![Influx1](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx1.png) - **Step 2:** When the new page loads, enter the following information to complete your subscription to the HiveMQ broker: - **Broker details:** - **Subscription name:** Choose a name for the subscription. We recommend choosing the same as the **N3uron** measurement name. In this case, it’s N3uron_Gateway). - **Description:** This field gives you the possibility to add extra information about the connection and subscription topic. - **Hostname or IP Address:** Enter your HiveMQ Cluster URL. - **Port:** 8883. - **Enable SSL:** Enabled. - **Client ID:** A new Client ID will be automatically generated. ![Influx2](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx2.png) - **Security details:** - **Plan:** Basic. - **User and password:** Enter your HiveMQ broker Active MQTT credentials. ![influx3](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/influx3.png) - **Step 3:** In the next section, you need to complete the following fields related to the topic subscription: - **Topic subscription:** - **Topic:** Enter the name of the **topic** you want to receive MQTT messages from, followed by “**/#**”. ( In this case: Influxn3*/#* ) - **Write destination:** - **Bucket:** Select the **bucket** to where you want to write your messages to (a bucket is a named location where time series data is stored). If there are not buckets yet, create a new one and give it a name (for example: N3uron Tags). **![Influx4-2](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx4-2.png)** - **Step 4:** Finally, define the data parsing rules and save the subscription: - **Data format:** Select Line protocol. - **Timestamp precision:** milliseconds. **![Influx5](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx5.png)** ## Visualizing MQTT Data in InfluxDB InfluxDB allows users to display data received in many different formats. In order to visualize data pushed from **N3uron**, proceed as follows: - **Step 1:** Make sure your subscription is running. Once created, select the “**Native subscriptions**” tab and check its **status**. ![Influx6](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx6.png) - **Step 2:** If it has stopped, access your subscription and click on the “**Start**” button. ![Influx7](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx7.png) - **Step 3:** Once the subscription is running, navigate to “**Data explorer**” by clicking on the second button starting from the top on the left hand side of the screen. ![Influx8](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx8.png) - **Step 4:** Select the bucket you want to retrieve information from, as well as the Measurement, tag values and fields and start visualizing your data. ![Influx9](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/Influx9.png) [MQTT Client Full Product Details](https://n3uron.com/iiot-platform-modules/mqtt-client/)