Serial filter separates the outputs into different outputs

I read the following Strings from an RS232 but I would like to have each String in a separate output does anyone have an idea how to do it?

image

image

Thanks so much

Hi @maxino101578

This will work,
But someone may have a cleaner way.

Connect your serial output to the join node
I have used 5 as the number of outputs on the function node and set 5 as the number of message parts on the join node based on your screenshot

We then split the batch into 5 outputs

[{"id":"31bdde550a6cf2b6","type":"function","z":"e7094296.ee2ea","name":"function 1","func":"const L0 = {payload:msg.payload[0]}\nconst L1 = {payload:msg.payload[1]}\nconst L2 = {payload:msg.payload[2]}\nconst L3 = {payload:msg.payload[3]}\nconst L4 = {payload:msg.payload[4]}\n\nreturn [L0,L2,L2,L3,L4]","outputs":5,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":680,"wires":[["71e1b5e52fd2e8d4"],[],[],[],[]]},{"id":"71e1b5e52fd2e8d4","type":"debug","z":"e7094296.ee2ea","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":860,"y":660,"wires":[]},{"id":"704ba4b9cab152cc","type":"join","z":"e7094296.ee2ea","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"5","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":430,"y":680,"wires":[["31bdde550a6cf2b6"]]}]

image

Hi Marco, thank you very much for your reply, this is the result
I try to always have the same result for the first issue
image

I would like to have a separate output for each single value, any ideas?

try the OUT -> split node, to slice it up into separate values, instead of \n try \t as it appears to be a tab separated string.

Thanks a lot bakman2, I tried but the result is the same

image

can you copy the output of one of those strings (using the copy icon in the debug window) and paste it here between 3 backticks ? (or use the </> icon in the editor here).

``` output ```

Copying with debug icon, the result is this:

payload

This is what's in the window:

I think @bakman2 meant Copy Valuet as described in this, which is one of our canned replies:

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

That should give you basically the same info as in the screenshot, but in a less ambiguous form.

Thanks a lot Colin I used the steps you say, but my data that I want to split is on the same line but I want to separate it.


image

One value, one output

Thanks a lot Colin I used the steps you say, but my data that I want to split is on the same line but I want to separate it.

Yes we are aware, but if you paste the output here in text, we can possibly help you, screenshots don't work.

You could use a function node after the the buffer array with something like:

const data = msg.payload  // assuming this is the input array

data.forEach(e=>{
    let tmp = e.replace(/\s\s+/g, ' ').split(' ').pop()
    node.send({payload:parseFloat(tmp)})
})

return null

Sorry bakman2 below the result:
[" 35.0 37.0 27 28 33\r\n","\r\n","SOC: 80.608A/h LEM: - 17.412A Vmed: 3.550V Vtot: 53.239V\r\n","Vmin: 3.492V ==> 9 Vmax: 3.589V ==> 7\r\n","TMax: 25.3 TMin: 19.5 Tint: 33.0 TdMax: 28.0 TcMax: 37.0\r\n","Ricarica 61% + Equi\r\n"]

The solution from this info

image

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