# TTN Payload to InluxDB

**URL:** <https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094>\
**Category:** General\
**Created:** [12 June 2019 07:43 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094 "2019-06-12T07:43:52Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [12 June 2019 19:37 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/21 "2019-06-12T19:37:07Z")

</div>

Replace the influxdb node with a debug node, and compare the format of what is output, to the examples given in the influxdb node readme.  
If it's different, it just won't work!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 June 2019 20:18 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/22 "2019-06-12T20:18:12Z")

</div>

How do you know it is not writing to the database?

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [12 June 2019 20:51 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/23 "2019-06-12T20:51:14Z")

</div>

Via SSH:

influx

use waterstanden

select \* from waterstanden

Nothing showed ☹

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 June 2019 20:56 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/24 "2019-06-12T20:56:53Z")

</div>

Try

```bash
use waterstanden
show measurements

```

that should show echteld

```auto
select * from echteld

```

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [13 June 2019 08:54 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/25 "2019-06-13T08:54:21Z")

</div>

It does not seem that complex to me, since the TTN node sends sensor name "echteld" and measurement value "3908" correctly. Nevertheless, I am unable to write this in the Influx database. Unfortunately, I give up after too many frustrating hours of testing.

Thanks anyway for your tips!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 June 2019 12:54 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/26 "2019-06-13T12:54:44Z")

</div>

It should not be difficult. What do you see when you `show measurements`.  
Your influx query did not work because you were not specifying a valid measurement in the select statement.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [13 June 2019 13:28 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/27 "2019-06-13T13:28:02Z")

</div>

I admire your perseverance, mine is less and I am not experienced with NodeRED and Influx. And I know I can't expect a step-by-step guide to solve this.

When I create a new database "waterstanden" I see nothing after "show measurements". After one or more times a payload uplink from the LoRa node this is the output:

_show measurements_  
_name: measurements_  
_name_  
_----_  
_echteld_

This while I use the same flow as posted above:

```auto
[{"id":"3588197a.a23a96","type":"tab","label":"Testen","disabled":false,"info":""},{"id":"879ea9fe.24c108","type":"ttn uplink","z":"3588197a.a23a96","name":"LSN-50","app":"b1ba9763.8396f8","dev_id":"dragino-nap","field":"","x":190,"y":160,"wires":[["7aa54d21.346504","ce83de4.9a66c2"]]},{"id":"ce83de4.9a66c2","type":"debug","z":"3588197a.a23a96","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":370,"y":260,"wires":[]},{"id":"7aa54d21.346504","type":"influxdb out","z":"3588197a.a23a96","influxdb":"23461b4.ab202e4","name":"Waterstanden","measurement":"echteld","precision":"","retentionPolicy":"","x":400,"y":140,"wires":[]},{"id":"b1ba9763.8396f8","type":"ttn app","z":"","appId":"dragino-nap","accessKey":"ttn-account-v2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","discovery":"discovery.thethingsnetwork.org:1900"},{"id":"23461b4.ab202e4","type":"influxdb","z":"","hostname":"192.168.2.185","port":"8086","protocol":"http","database":"waterstanden","name":"Waterstanden","usetls":false,"tls":""}]

```

If needed I can send you a PM with the flow including the complete TTN access key.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 June 2019 13:44 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/28 "2019-06-13T13:44:56Z")

</div>

OK, so it has written to the database, I suspect your flow is working correctly, assuming it is the same one as yesterday. Now try  
`select * from echteld`  
to see what it has written.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [13 June 2019 14:00 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/29 "2019-06-13T14:00:54Z")

</div>

This is the output:

select \* from echteld  
name: echteld  
time echteld  
=== =====  
1560432050564511773 3908  
1560432177588323535 3908  
1560433060009686583 3948

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [13 June 2019 14:58 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/30 "2019-06-13T14:58:08Z")

</div>

Excellent, all working.  
So the final problem was just that you were using the wrong select statement to fetch the data. In Influx a measurement is roughly equivalent to a table in a conventional sql database.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [13 June 2019 15:16 UTC](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094/31 "2019-06-13T15:16:15Z")

</div>

So the problem was not only my lack of knowledge of NodeRED but also the lack of knowledge of Influx. I'm going to be embarrassed now for the moment 😏

Thank you so much for your help!

[Previous page](https://discourse.nodered.org/t/ttn-payload-to-inluxdb/12094.md?page=1)
