FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
04-05-2022 11:18 PM
Hello,
I am adding on to the my previous post regarding Node Red, OPC DA and CtrlX (link to previous post: https://developer.community.boschrexroth.com/t5/ctrlX-IOT/Node-Red-node-for-OPC-DA-CtrlX/m-p/53187)
I was able to successfully install OPC DA pallette in Node Red and read PLC data from an MTX system. The output of the OPC DA node is in JSON format. Sample output message is shown in the attached pic (Sample-Node-Red-Output.jpg)
My next task is to save the JSON string to a file on CtrlX core. To do this, I will have to use the "Write File" node available in Node Red and configure the absolute path to where the file will be located (sample shown in attached pic Write-File-Node-Red.jpg)
My question: How do I create a folder on CtrlX and have it accessible to Node Red so that the file can be saved in that location? Also how to determine the absolute path?
Thanks,
Bala
Solved! Go to Solution.
04-06-2022 07:53 AM - edited 09-02-2022 07:47 AM
The path used in Node-RED has to be a complete absolute path on the ctrlX CORE. System variables like $SNAP_DATA will not be resolved:
/var/snap/ctrlx-node-red/current/solutions/activeConfiguration/node-RED
We would suggest using an self created folder:
/var/snap/ctrlx-node-red/current/solutions/activeConfiguration/node-RED/myData/myFile.json
Data in the app data storage can also be accessed from the outside of a ctrlX CORE.
See also this thread for further information where snaps can store data.
04-06-2022 08:01 AM
Same behaviour for accessing the certificate storage.