I have node-red running on a Raspberry Pi that collects some data from sensors.
The Raspberri Pi is connected through an ethernet cable to an intranet where there are other PC's that can access the dashboard for example.
Can I create a flow that creates/writes a text file in a PC that is connected to the intranet to store some data?
I have used the "write file" node to store data into the Raspberri Pi, but I don't know if it's possible to do the same on another device that is connected to the intranet, using the device IP address for example.
You could use File Sharing to allow the folder to be accessed across the network. How to do that depends on the OS you are using.
I will need to look into how to do that. The PC that contains the file uses Windows.
And if I make his file accessible, then I would still need to figure out how to write into it.
You can mount a windows share in the pi filesystem and simply write files using built in file node, to the mount point.
Google is your friend: See here
The answer somewhat depends on your setup. Is this part of a corporate/company network for example? If so, you need to speak to the IT department before connecting things.
But in principal, you can set up something called SAMBA on the Pi. SAMBA emulates a Windows file and print sharing network on Linux OS's. So the Windows PC's would be able to connect and see the files.
You could, instead use NFS which Windows can also support (I think you have to add one of the Windows extended features though) but its performance is pretty poor.
There are lots of other options too but these are the most obvious.
Thanks for all the replies.
I managed to share a test file on Windows and mount it in the pi using samba
Ok. I have one last problem.
I can read the file from node red (read file node) but not write to it using the "write file" node.
I can write from the RPi but only in sudo mode
Your folder/file permissions are wrong. If you are running Node-RED under a specific user/group - which is advised for production use - then you need to make sure that user/group has access to the target folder. The simple way being to add the node-red user to the group permissions for the appropriate folder.