How to parse data from a String in a Buffer

Hi,

I try to support someone with an Optical reader from Weidmann Elektronic (German Device).
He is able to receive data as shown in a picture below.

Screenshot_Weidmann_Output

One would expect, that you can read the output with the Smartmeter node.
Obviously this was not the case.

The lines he (and so do I) is interested in are the lines with the OBIS references 1-0:1.8.0 until 1-0:2.8.2.

The question is: How to isolate these 6 lines and put them in an object?

I do not own such a device myself, so it is difficult to test and to build a simulation with a Inject node.

I hope someone can give me a hint, about which way to go

Thanks in advance

Regards

This usually is a job for a Regular Expression.
Some Links that might be helpful: MDN, RegExr - a playground, a recent post to a similar topic.

Hi @ralphwetzel,

Thanks for the response. Although I'm do not consider myself as a specialist on Regular Expressions, I will look into it and see what will come out of it.

Regards

If you want someone to really help, i would advise that you paste the actual buffer values (instead of a picture) so whoever helps has some real data to play with. Use the "copy value" button that appears when you hover over the debug payload.

CANNED TEXT

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

Have you ever seen an "expert on regular expressions"? :wink:
For me it's always try & error ... & error & ...

1 Like

Sorry @Steve-Mcl,

Sorry for that, I know how to do that and I also saw the docs, although this is some time ago.

As said, I try to support someone else and this is what I got so far.
I do not own that Weidmann device, so I can't test and do not have the original output.

The user sent me already a file with was redirected from the original output and this file gave me the exact same result as my simulation. But this file (and my simulation) is a string, while it looks that the original output from the Exec node is a buffer, containing a string.

I tried to create a simulation with an Inject node. However the simulation in the Inject node does not seem to be identical as the output of the device. With the simulation I can achieve what I wanted so far. But testing on the real device failed.

However I appreciate your response and your nice videos.

1 Like

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