# Insert data to Influxdb

**URL:** <https://discourse.nodered.org/t/insert-data-to-influxdb/20689>\
**Category:** General\
**Created:** [21 January 2020 16:05 UTC](https://discourse.nodered.org/t/insert-data-to-influxdb/20689 "2020-01-21T16:05:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mrfox](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@Mrfox](https://discourse.nodered.org/u/Mrfox)\
**Post date:** [21 January 2020 16:05 UTC](https://discourse.nodered.org/t/insert-data-to-influxdb/20689/1 "2020-01-21T16:05:32Z")

</div>

Hi,

I am receiving data from an Aidon Energy meter via the Aidion-node, I am getting it into Node Red in the right format.

 ![2020-01-21-170233_1920x1080_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0e353ee19418185a908e5e0b9d7eac73e52d61b4.png)

I have defined the message in a Function-node like this:

msg.payload = {  
obis\_list\_version: msg.msghan.obis\_list\_version,  
meter\_ID: msg.msghan.meter\_ID,  
meter\_model: msg.omsghan.meter\_model,  
act\_pow\_pos: msg.msghan.act\_pow\_pos,  
act\_pow\_neg: msg.msghan.act\_pow\_neg,  
react\_pow\_pos: msg.msghan.react\_pow\_pos,  
react\_pow\_neg: msg.msghan.react\_pow\_neg,  
curr\_L1: msg.msghan.curr\_L1,  
curr\_L2: msg.msghan.curr\_L2,  
curr\_L3: msg.msghan.curr\_L3,  
volt\_L1: msg.msghan.volt\_L1,  
volt\_L2: msg.msghan.volt\_L2,  
volt\_L3: msg.msghan.volt\_L3  
}  
return msg;

This is sent to an Influxdb out node and I get this error:

Error: A 400 Bad Request error occurred: {"error":"unable to parse 'stations act\_pow\_neg=undefined,act\_pow\_pos=undefined,curr\_L1=undefined,curr\_L2=undefined,curr\_L3=undefined,meter\_ID=undefined,obis\_list\_version=undefined,react\_pow\_neg=undefined,react\_pow\_pos=undefined,volt\_L1=undefined,volt\_L2=undefined,volt\_L3=undefined': invalid boolean"}

As you may notice I am not winning the next Nobel Price in programming... Is there anything in this attempt to get the message in to Influxdb which is correct...? What is wrong!?

Regards,  
Joakim

---

<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:** [21 January 2020 16:53 UTC](https://discourse.nodered.org/t/insert-data-to-influxdb/20689/2 "2020-01-21T16:53:56Z")

</div>

Add a debug node showing what you are feeding to the influx node.  
Then add a debug node showing what is going into your function node and try and work out what the problem is. Paste them both here if you can't work it out.

---

<div class="post-metadata">

**Author:** ![Mrfox](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@Mrfox](https://discourse.nodered.org/u/Mrfox)\
**Post date:** [21 January 2020 19:24 UTC](https://discourse.nodered.org/t/insert-data-to-influxdb/20689/3 "2020-01-21T19:24:03Z")

</div>

Yes,

This is what I get if I debug before the function node:

 ![2020-01-21-201423_1920x1080_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/b/8b68d4ac191c12d6afa8f8e6722ee7b59e55a30c.png)

This is the debug after the function node:

 ![2020-01-21-201858_1920x1080_scrot](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae1460d424903d1639117cc8066e9a4738c1234c.png)

It feels like there is something wrong with the code in the function node...  
msg.payload = {  
obis\_list\_version: msg.msghan.obis\_list\_version,  
meter\_ID: msg.msghan.meter\_ID,  
meter\_model: msg.omsghan.meter\_model,  
act\_pow\_pos: msg.msghan.act\_pow\_pos,  
act\_pow\_neg: msg.msghan.act\_pow\_neg,  
react\_pow\_pos: msg.msghan.react\_pow\_pos,  
react\_pow\_neg: msg.msghan.react\_pow\_neg,  
curr\_L1: msg.msghan.curr\_L1,  
curr\_L2: msg.msghan.curr\_L2,  
curr\_L3: msg.msghan.curr\_L3,  
volt\_L1: msg.msghan.volt\_L1,  
volt\_L2: msg.msghan.volt\_L2,  
volt\_L3: msg.msghan.volt\_L3  
}  
return msg;

Should I define the first three rows as string and the rest as value...? Or do I have to use a Influxdb node for each value?

//Joakim

---

<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:** [21 January 2020 21:24 UTC](https://discourse.nodered.org/t/insert-data-to-influxdb/20689/4 "2020-01-21T21:24:29Z")

</div>

Looking at the first debug there doesn't seem to be any data there, or an I missing something.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [22 January 2020 17:04 UTC](https://discourse.nodered.org/t/insert-data-to-influxdb/20689/5 "2020-01-22T17:04:42Z")

</div>

> [@Mrfox](#):
>
> meter\_model: msg.omsghan.meter\_model,

Looks like you have an extra "o" in that variable name...
