Help with node-red

Hello everyone, I'm having problems creating a part of my flow

For messages received from subscriptions:
• Filter only messages having payload with temperature in Celsius
• Produce a chart plotting the temperature value (taking the maximum value in the "range" attribute as a number) of these filtered messages
• Save the payload string of such filtered messages in a CSV containing one msg Payload for each row.

Version 0.19.4

Thanks in advance for the help

Welcome to the forum @Kdenis

I hope you won't be offended if I first refer to you to this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
Pay particular attention to the section (and associated documents) Working with Messages, which should help a lot with your question.

Version 0.19.4 of what? Node red is currently at 3.0.2.

1 Like

Thanks for the playlist (I started using Node-red 3 days ago).

The version installed in my university´s virtual machine is 0.19.4.
I will install the latest version on my pc.

Good grief! v0.19.4 is almost 5 years out of date.
Just out of interest, what country is your university in?

The three items in your task list can be tackled more or less individually.

  1. Get data from a "subscription" into Node-red
  2. Use some of the temperature data to draw a chart
  3. Save data to a CSV file.

For No 2 you probably need to install the Node-red dashboard nodes, which includes a simple chart node. If you want to plot "live" data, as it arrives in Node-red, all you have to do is send each data valus to th chart node. But if you are charting stored data all at once, pay close attention to the format required by the chart node.

Lots of Node-red beginners try to do everything in Javascript function nodes. For example you could convert data from JSON format into CSV by using javascript, or alternatively you could use one of the parser nodes. I think it's usually better to try and avoid too much procedural coding.

1 Like

Hi, my uni is in Italy.

Thanks for the help, I just finished the flow.
I just have a question about the csv output file. Is there a way to eliminate the first column? I tried a couple things but then the flow doesn't create the file.

Looking at your snapshot, it doesn't seem like the data is very consistently split into columns.
Row 1 has "Lat:8.3" in column E, row 4 has "Lat:5.1" in column G.
Well, perhaps it's "Lat:51", in which case I'm surprised by "Lat:92"!

It looks like the data was in JSON format at some point. What did it look like then? Was "col1" in the imported data?

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