Receive csv from FTP and send it to MQTT


We have a machine that sends a csv every 30 seconds with this data:

My goal is to create a Node-Red flow that reads the content of the file and then send it to MQTT. The only thing "that matters" is the speed. If I have a few seconds between the time in the csv and the time in the MQTT is not a problem.

The problem is that my knowledge in Node-Red is very basic. I tried to get the data from the FTP but with no luck. I think the goal will be using functions (I guess) but as I said I'm very limited at this point.

So, any help will be appreciated.
Thank you

Are you trying to send just the latest speed or the complete contents of the file with many speed values?

send only the latest speed. After reading the value it needs to delete the file

Is reading the file via ftp the only way of accessing the data? Does the machine support modbus for example?

If you need to fetch it by ftp then first make sure you can do that using an FTP client on a PC. Then you should be able to do the same in node-red. I have not had much success with the FTP nodes though, so when I needed to do this I used Exec nodes to execute the required command line ftp commands.

If you do end up using an exec node then I also suggest looking at the lftp command (on linux) which lets you get files in a single command

I haven't come across that, I have used ftp_get, but lftp looks much cleverer so I will try that next time I need it. Thanks.

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