# Node-red influxdb insert-update

**URL:** <https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699>\
**Category:** General\
**Created:** [11 January 2019 14:31 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699 "2019-01-11T14:31:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![turkdoktoru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/turkdoktoru/32/5111_2.png) [@turkdoktoru](https://discourse.nodered.org/u/turkdoktoru)\
**Post date:** [11 January 2019 14:31 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/1 "2019-01-11T14:31:39Z")

</div>

I am sending data to the Node-Red server with the mqtt.fx program as attached. The Mqtt server is taking it.

How to register and update the received data in influxdb. can you help me ?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [11 January 2019 14:47 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/2 "2019-01-11T14:47:20Z")

</div>

Hi, you have to tell us a bit more about your hardware and what you have tried.

---

<div class="post-metadata">

**Author:** ![turkdoktoru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/turkdoktoru/32/5111_2.png) [@turkdoktoru](https://discourse.nodered.org/u/turkdoktoru)\
**Post date:** [11 January 2019 15:18 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/3 "2019-01-11T15:18:05Z")

</div>

I am sending mqtt data with Arduino.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [11 January 2019 15:32 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/4 "2019-01-11T15:32:03Z")

</div>

so what is your flow? What does the message you are sending look like?

---

<div class="post-metadata">

**Author:** ![turkdoktoru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/turkdoktoru/32/5111_2.png) [@turkdoktoru](https://discourse.nodered.org/u/turkdoktoru)\
**Post date:** [11 January 2019 15:33 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/5 "2019-01-11T15:33:41Z")

</div>

![mqttfx](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/028dc154bc6da9f29f7978429111e8c90f2e6a49.png)

---

<div class="post-metadata">

**Author:** ![turkdoktoru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/turkdoktoru/32/5111_2.png) [@turkdoktoru](https://discourse.nodered.org/u/turkdoktoru)\
**Post date:** [11 January 2019 15:34 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/6 "2019-01-11T15:34:44Z")

</div>

I'm sending data like mqtt.fx. I want to update the data I've sent into influxdb

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [11 January 2019 15:37 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/7 "2019-01-11T15:37:27Z")

</div>

Take a look at [flows.nodered.org](http://flows.nodered.org) if you search the flows for MQTT influxdb should show you how to link MQTT and influxdb.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [11 January 2019 20:34 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/8 "2019-01-11T20:34:18Z")

</div>

and look for the contrib-influxdb node

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/7e5d2178a6967e89e31323b5a430d102e18a3bfd.png)

Though you can also write to InfluxDB directly simply using an http request node

---

<div class="post-metadata">

**Author:** ![turkdoktoru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/turkdoktoru/32/5111_2.png) [@turkdoktoru](https://discourse.nodered.org/u/turkdoktoru)\
**Post date:** [11 January 2019 20:46 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/9 "2019-01-11T20:46:14Z")

</div>

I'm testing now. I hope it works.  
You are all very helpful. thank you so much

---

<div class="post-metadata">

**Author:** ![turkdoktoru](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/turkdoktoru/32/5111_2.png) [@turkdoktoru](https://discourse.nodered.org/u/turkdoktoru)\
**Post date:** [12 January 2019 09:19 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/10 "2019-01-12T09:19:02Z")

</div>

yes I managed to save a single line in influxdb.  
but when I send a line from the mqtt.fx program as below, I can add the lines I want and shred.

 ![mqttfx](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f381b575d0e482daca650b131e5771617c8f4719.png)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 January 2019 09:41 UTC](https://discourse.nodered.org/t/node-red-influxdb-insert-update/6699/11 "2019-01-12T09:41:32Z")

</div>

Right, so you are handling a STRING from MQTT and you need to break that into an object to pass to the InfluxDB Node.

You can either use the http node to send the data via the REST API.

> **[InfluxData Documentation](https://docs.influxdata.com/influxdb/v1.7/guides/writing_data/)**
>
> Documentation for InfluxDB, Telegraf, Chronograf, Kapacitor, and Flux

Or you need to turn the incoming payload to an object. If you can change what's in MQTT and make it valid JSON then you can simply use the JSON node to start with. Otherwise, you will need to split the string by ", " then split each result by ": " and build the object. Then you need to rearrange the data according to the instructions of the node so that it ends up in the right place in InfluxDB.
