# How to split a long message and filter for information

**URL:** https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089
**Category:** General
**Created:** [20 May 2026 09:04 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089 "2026-05-20T09:04:57Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 09:04 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/1 "2026-05-20T09:04:57Z")

</div>

Hi,  
I'm quite new in working with node red. I got this following message from a Victron Batterie Monitor (BMV 712) and I would like to get some of the data in an InfluxDB.  
I use the node VE.direct USB triggered by a timestamp and parse it with the json node.  
How can I convert this data in something the InfluxDB can work with?

{  
"PID": {  
"value": "0xA383",  
"description": "ProductID",  
"units": "",  
"product": "BMV-712 Smart Rev2"  
},  
"V": {  
"value": 26479,  
"description": "Main or channel 1 (battery) voltage",  
"units": "mV"  
},  
"T": {  
"value": 20,  
"description": "Battery temperature",  
"units": "°C"  
},  
"I": {  
"value": 0,  
"description": "Main or channel 1 battery current",  
"units": "mA"  
},  
"P": {  
"value": 0,  
"description": "Instantaneous power",  
"units": "W"  
},  
"CE": {  
"value": -1305,  
"description": "Consumed Amp Hours",  
"units": "mAh"  
},  
"SOC": {  
"value": 998,  
"description": "State-of-charge",  
"units": "‰"  
},  
"TTG": {  
"value": -1,  
"description": "Time-to-go",  
"units": "Minutes"  
},  
"Alarm": {  
"value": "OFF",  
"description": "Alarm condit…

Thanks a lot in advance.

---

<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: [20 May 2026 09:24 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/2 "2026-05-20T09:24:38Z")

</div>

Welcome to the forum @Emmi

> [@Emmi](#):
>
> How can I convert this data in something the InfluxDB can work with

Do you know exactly what form you want the data in?

If not then which version of influxdb are you using and do you know what measurements, fields and tags you want?

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 09:39 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/3 "2026-05-20T09:39:17Z")

</div>

Hi,  
thanks for the fast response. I use InfluxDB v2.8.0. Looks like I copied the wrong output (I tried a lot before asking you)  
This is what the json node gives me:

{"PID":{"value":"0xA383","description":"ProductID","units":"","product":"BMV-712 Smart Rev2"},"V":{"value":27517,"description":"Main or channel 1 (battery) voltage","units":"mV"},"T":{"value":23,"description":"Battery temperature","units":"°C"},"I":{"value":-181,"description":"Main or channel 1 battery current","units":"mA"},"P":{"value":-5,"description":"Instantaneous power","units":"W"},"CE":{"value":-6171,"description":"Consumed Amp Hours","units":"mAh"},"SOC":{"value":994,"description":"State-of-charge","units":"‰"},"TTG":{"value":14400,"description":"Time-to-go","units":"Minutes"},"Alarm":{"value":"OFF","description":"Alarm condition active","units":""},"Relay":{"value":"OFF","description":"Relay state","units":""},"AR":{"value":0,"description":"Alarm reason","units":""},"BMV":{"value":712,"description":"Model description (deprecated)","units":""},"FW":{"value":419,"description":"Firmware version (16 bit)","units":""},"MON":{"value":0,"description":"DC monitor mode","units":""},"H...

First I would like to have the basic values: Voltage, Temperature, Current  
and the status of the Alarm also would be nice.

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [20 May 2026 09:49 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/4 "2026-05-20T09:49:04Z")

</div>

This is a suggestion I got from ChatGPT for some JavaScript in function node to process your JSON before sending it to an InfluxDB node. I'm assuming your message is in msg.payload

```auto
let d = msg.payload;

msg.payload = {
    measurement: "bmv712",

    tags: {
        PID: d.PID.value,
        product: d.PID.product
    },

    fields: {
        V_mV: d.V.value,
        T_C: d.T.value,
        I_mA: d.I.value,
        P_W: d.P.value,
        CE_mAh: d.CE.value,
        SOC_permille: d.SOC.value,
        TTG_min: d.TTG.value,

        Alarm: d.Alarm.value,
        Relay: d.Relay.value,

        AR: d.AR.value,
        BMV: d.BMV.value,
        FW: d.FW.value,
        MON: d.MON.value
    }
};

return msg;

```

You can edit/delete the 'fields' as necessary.

---

<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: [20 May 2026 09:56 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/5 "2026-05-20T09:56:55Z")

</div>

> [@Emmi](#):
>
> This is what the json node gives me:

What do you see before the JSON node?

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 09:59 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/6 "2026-05-20T09:59:45Z")

</div>

msg.payload : Object

object

PID: object

value: "0xA383"

description: "ProductID"

units: ""

product: "BMV-712 Smart Rev2"

V: object

value: 26500

description: "Main or channel 1 (battery) voltage"

units: "mV"

T: object

value: 21

description: "Battery temperature"

units: "°C"

I: object

value: 207

description: "Main or channel 1 battery current"

units: "mA"

P: object

value: 5

description: "Instantaneous power"

units: "W"

CE: object

value: -1424

description: "Consumed Amp Hours"

units: "mAh"

SOC: object

value: 997

description: "State-of-charge"

units: "‰"

TTG: object

value: -1

description: "Time-to-go"

units: "Minutes"

Alarm: object

value: "OFF"

description: "Alarm condition active"

units: ""

Relay: object

value: "OFF"

description: "Relay state"

units: ""

AR: object

value: 0

description: "Alarm reason"

units: ""

BMV: object

value: 712

description: "Model description (deprecated)"

units: ""

FW: object

MON: object

H1: object

H2: object

H3: object

H4: object

H5: object

H6: object

H7: object

H8: object

H9: object

H10: object

H11: object

H12: object

H15: object

H16: object

H17: object

H18: object

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 10:02 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/7 "2026-05-20T10:02:23Z")

</div>

this script gives me an error:  
{" **enc**":true,"type":"error","data":{"name":"TypeError","message":"Cannot read properties of undefined (reading 'value')","stack":"TypeError: Cannot read properties of undefined (reading 'value')\n at Function node:16998054156cc482 [function 3]:8:20\n at Function node:16998054156cc482 [function 3]:32:3\n at Script.runInContext (node:vm:149:12)\n at processMessage (/usr/lib/node\_modules/node-red/node\_modules/@node-red/nodes/core/function/10-function.js:430:37)\n at FunctionNode.\_inputCallback (/usr/lib/node\_modules/node-red/node\_modules/@node-red/nodes/core/function/10-function.js:348:17)\n at /usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:214:26\n at Object.trigger (/usr/lib/node\_modules/node-red/node\_modules/@node-red/util/lib/hooks.js:166:13)\n at Node.\_emitInput (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:206:11)\n at Node.emit (/usr/lib/node\_modules/node-red/node\_modules/@node-red/runtime/lib/nodes/Node.js:190:25)"}}

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [20 May 2026 10:05 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/8 "2026-05-20T10:05:15Z")

</div>

It means somewhere in your Function node you are doing something like:

```auto
something.value

```

…but `something` is **undefined** at runtime.

Probably best to delete the fields or double-check the names match what is in function node.

---

<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: [20 May 2026 10:27 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/9 "2026-05-20T10:27:12Z")

</div>

Your data is already a JavaScript object, the json node is converting it to a string, which you don't want. Take out the json node.

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 10:37 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/10 "2026-05-20T10:37:12Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d217174eaf04bac0ca8211ccee400985d3f1e175.png)

You are right the output (in Influx) looks the same without the json node. But Influx still does not split the values.

---

<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: [20 May 2026 12:21 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/11 "2026-05-20T12:21:05Z")

</div>

Whenever you change the format of data stored in a measurement in influx you have to delete the measurement (or bucket or whatever they now call it) and start again.

You need to decide what measurements, fields and tags you want in the database, then format the data as described in the help page for the influxdb node.

I advice against using the Flux language, it was a mistake and is being dropped in influx v3.

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 12:33 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/12 "2026-05-20T12:33:15Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/b/9b13e622db5106c9acb404f5d9b33e8ff1baa95d.png)

I found a way that works for me. I used the change node to get the single values out of it.

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [20 May 2026 12:35 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/13 "2026-05-20T12:35:03Z")

</div>

Thanks for supporting me.

---

<div class="post-metadata">

### Author: ![eiche](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@eiche](https://discourse.nodered.org/u/eiche)
#### Post date: [22 May 2026 00:20 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/14 "2026-05-22T00:20:47Z")

</div>

@Emmi  
If you want to store multiple values ​​in the InfluxDB database (a bucket), you may use a function node instead of a change node.

See the following section of the "InfluxDB Out" node description:  
" ... If msg.payload is an object containing multiple properties, the fields will be written to the measurement. ..."  
Therefore you may use a function node with Javascript code like posted in #4 from @dynamicdave - without using any AI 😉  
For example, you can use the following reduced code:

```auto
let d = msg.payload;
msg.payload = {
    V_mV: d.V.value,
    T_C: d.T.value,
     I_mA: d.I.value,
     Alarm: d.Alarm.value,
};
return msg;

```

In InfluxDB v2.x, you can configure the measurement and bucket in the influxdb out node.

If you still prefer a change node, you must add an entry for each value to be stored in the database, e.g.  
set msg.payload.V\_mV to the value msg.payload.V.value  
set msg.payload.T\_C to the value msg.payload.T.value  
...

My following suggestion is unsuitable, as @Colin noted - thanks so lot.  
_If you feed the entire payload object (for testing purposes) to the influxdb out node, you will be able to see via a query how the components of this object are stored in the database. This is at least worth testing._

Correction:  
The elements located deeper within the data structure must be transferred to the first payload level, just as the short JavaScript snippet above demonstrates.

---

<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: [22 May 2026 07:47 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/15 "2026-05-22T07:47:29Z")

</div>

> [@eiche](#):
>
> If you still prefer a change node, you must add an entry for each value to be stored in the database, e.g.  
> set msg.payload.V\_mV to the value msg.payload.V.value  
> set msg.payload.T\_C to the value msg.payload.T.value

That will not work as the payload will still contain all the original properties. As in your function code it is necessary to first Move msg.payload To msg.d, then Set msg.payload to an empty object, and then Set the properties as you describe (from msg.d).

---

<div class="post-metadata">

### Author: ![Emmi](https://avatars.discourse-cdn.com/v4/letter/e/e480ec/32.png) [@Emmi](https://discourse.nodered.org/u/Emmi)
#### Post date: [22 May 2026 08:20 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/16 "2026-05-22T08:20:13Z")

</div>

Thanks a lot for the proposal, but I won't touch it anymore, as it works like I did it above. I have the data I need already shown in grafana (and I'm running a bit out of time, as the ship wants to leave 🫣 ). When there is more time I'll get a bit more into it.

But now I have a similar problem with an nmea data stream. I guess it's better to open a new thread. (First time for me asking a question in a forum.)

thanks a lot 😍

---

<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: [22 May 2026 10:16 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/17 "2026-05-22T10:16:54Z")

</div>

> [@Emmi](#):
>
> Thanks a lot for the proposal, but I won't touch it anymore, as it works like I did it above

I wasn't suggesting that you did change it, just pointing out the error in the post I referenced.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [20 August 2026 10:17 UTC](https://discourse.nodered.org/t/how-to-split-a-long-message-and-filter-for-information/101089/18 "2026-08-20T10:17:26Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
