How to convert and store modbus data into csv file

While connecting modbus , I got 1 part of the output.

Working on other part , modbus data to convert and store harmonics data into csv file.

Running separately Im getting output in debug , while connecting along with function node its showing NaN error , or sometimes no output.

I guess , need to do some modifications in function node

Can you please help me out ?

Can u please guide me , to get my data stored into csv file ?


The first thing to do is to use debug nodes to work out where the problem is occurring. Once you have done that, if you need further help, then post what a debug node showing what is going into the node that is not working shows and also tell us what is coming out and what should come out. If it is a function node then post the contents of the node (use the </> button when pasting it here).
If it is a function node that is failing then first look at the node red docs page Writing Functions which has help on debugging functions.

Thanks for your response Colin.

After Join node i checked with Debug node , it is working fine.

While connecting that join with function node , receiving error on my side.

Appreciate , your effort in notifying the issue
thank you !


Do you mean the output of the function node is not correct? If so please read my post again. First go and read the document I linked to and attempt to debug the function node yourself. If you still cannot get it working then show us what is going into the function node, what is coming out of the function node and the code of the function node.

Thanks for you response colin.

Current update is function mode is working fine , i added csv and file node along with it.
My current flow

outputs below
2.function node
3.file node
4.debug node

But in csv file only headers are present, no data is filled in .csv file

Can u guide me with Any reference documents and help me out with solution

Appreciate , your effort in notifying the issue
thank you !


What do you see if you look in the file?

Thanks for your response Colin

Only headers and Timestamp are getting stored in .csv file , but no data found


Can you please guide me to get data stored in .csv file


Show us how you have configured the file node and also open the file with a straight text editor and see what is there.

Thanks for your kind response

File node

Text editor

Energy charges

Can you show us again what is going into the file node please. Make it a bit bigger on the screen if possible, it was not clear on the previous one. Just what is going into the file node.

Thanks for your timely help
I have done everything as per your instruction. I am able to read many parameters in single go. But I am stuck with CSV file . I changed the flow and did some modifications too, but same error exists again.

Other part of flow for energy is running successfully.


Output of debug window

output of CSV file

Text editor ouput

Appreciate , your effort in notifying the issue
thank you !


That makes a bit more sense now, with the csv node before the file. You had the csv file after the file node before which is why I could not understand how csv data was getting into the file. I rather suspect that the debug output you showed the first time was with this flow.
So now we have to see why the csv node is not doing what you want. You need to show us how you have configured the csv node. Remember we are not telepathic so it is not possible to know these things unless you show us.

Colin, also there is a comma after the date, in the Timestamp. Could that misaligned the csv ?

Actually, I don't think that is the problem. Having said that we are not telepathic I am now going to predict that you have provided a list of headings in the csv node (Timestamp, HV1_0, ...). The node uses those to determine which properties of the object you pass in to put into the csv data. Unfortunately none of the properties in the header list are present in the data you are passing in (except the timestamp), so the columns are all empty.

Thanks for your reply Colin

Sorry. Next time i will provide you all the necessary nodes and output. While raising my questions.

CSV node

File node

Join node

Appreciate , your effort in notifying the issue
thank you !


You have gone over the top now in providing data :slight_smile:
Now we know that it is the csv node that is not behaving as you expect then that is what we need.
Did you see my reply a few minutes ago, explaining what the problem is?

Thank you Colin

Even i tried Posted my program, Notified as program exceeded the character limit.Unable to post it

You have given solution for it. sorry i didnt view it, i will check and update you

Yes Colin. i have done a same set of data with different parameters , the difference is i need that data to be sent to Cloud bd via CSV using q-gate. with your guidance i have achieved my output.

Working on this second part. got struck up with CSV file. Tried many times before raising the issue. But i couldnt solve it.

Im Seeking Help with you all. so that any1 can guide me in getting output in flow

Appreciate , your effort in notifying the issue
thank you !


As Colin predicted... In the debug you can see HAV1_0 etc. And yet in the CSV node you ask for HV1_0 etc. Which doesn't exist, so you get blanks. It is important they are the same..

Thank you @Colin :smiley:and @dceejay for your timely help :smiley:

Thank you @dceejay
Finally, I got output from DEBUG window. Few changes with parameters in function node and CSV node , reached the output


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