Data Logging In PC

Hi Everyone,

I need clarification about how to logs Data in .csv file format in Local Computer or Laptop. Is there any work flow (Function Flow) available, can you explained briefly or share any video.

Like file path name, storage location etc.

What have you tried?
What platform are you running NR on?

Export your flow and paste it to a response.

simplest is to just use a file out node and set it to point to whatever location you want to save the data, and then send it strings of data as per you own spec.

You might also find the CSV node useful for formatting the file

Both the CSV node and Write FIle have example flows too.

You can find them via Hamburger menu | Import | Exampes | node-red | parser or storage

Good Morning,
My flow is

[
    {
        "id": "c96ef39badbaf8a2",
        "type": "debug",
        "z": "0983465ad5ca464d",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1350,
        "y": 2540,
        "wires": []
    },
    {
        "id": "74633509e5de9cb3",
        "type": "file",
        "z": "0983465ad5ca464d",
        "name": "R00001_0037",
        "filename": "",
        "appendNewline": false,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 1120,
        "y": 2540,
        "wires": [
            [
                "c96ef39badbaf8a2"
            ]
        ]
    },
    {
        "id": "cf9f8fc7f4df2cdf",
        "type": "csv",
        "z": "0983465ad5ca464d",
        "name": "",
        "sep": ",",
        "hdrin": true,
        "hdrout": "once",
        "multi": "one",
        "ret": "\\n",
        "temp": "timestamp,NFID,Date,Time, Ps_Spr_En, Ps_Spr_Auto, Ps_MainPump_Sts, Ps_StandbyPump_Sts, Ps_ForwardValve_Sts, Ps_RejectValve_Sts, Ps_MainPump_Current, Ps_StandbyPump_Current, Ps_Spray_Avg_Pressure, Ps_MainPump_VFD_FltCode, Ps_StandbyPump_VFD_FltCode, Ps_MainPump_Speed, Ps_StandbyPump_Speed, Ps_Rc_En, Ps_Rc_Auto, PsRc_LowLevel_Sts, PsRc_MidLevel_Sts, PsRc_TopLevel_Sts, PsRc_Valve_Sts, Ps_Oxy_En, Ps_Oxy_Auto, Ps_OxyValve_Sts, Ps_Evac_En, Ps_Evac_Auto, Ps_EvacValve_Sts, Ps_Evac_RunDuration, Ps_MD_En, Ps_MD_Auto, Ps_MDTankA_Auto, Ps_MDTankB_Auto, Ps_MDTankC_Auto, Ps_MDTankD_Auto, Ps_MDTankE_Auto, Ps_MDPumpA_Sts, Ps_MDPumpB_Sts, Ps_MDPumpC_Sts, Ps_MDPumpD_Sts, Ps_MDPumpE_Sts, Ps_Sc_En, Ps_Sc_Auto, PsSc_Valve_Sts, Ps_Sc_LastPPM, Ps_Sc_LastpH, Thp_En, Thp_Auto, Thp_Fan1_Sts, Thp_Fan2_Sts, Thp_Fan1_Current, Thp_Fan2_Current, Thp_Fan1_Speed, Thp_Fan2_Speed, Thp_Fan1_VFD_FltCode, Thp_Fan2_VFD_FltCode, Thp_PadPump_Sts, Thp_PadPump_Current, Thp_PadPump_Speed, Thp_PadPump_VFD_FltCode, Lux, PPFD, DLI, North_DryTemp, North_WetTemp, North_VPD, North_RH, North_CpmTemp, Center_DryTemp, Center_WetTemp, Center_VPD, Center_RH, Center_CpmTemp, South_DryTemp, South_WetTemp, South_VPD, South_RH, South_CpmTemp, Pwr_uPhs1, Pwr_uPhs2, Pwr_uPhs3, Pwr_iPhs1, Pwr_iPhs2, Pwr_iPhs3, Pwr_avpTot, Pwr_appTot, Pwr_pfTot, Pwr_aveTot, Pwr_apeTot, Pwr_avePreMnt, Pwr_avePreHr",
        "skip": "0",
        "strings": true,
        "include_empty_strings": true,
        "include_null_values": true,
        "x": 890,
        "y": 2540,
        "wires": [
            [
                "74633509e5de9cb3"
            ]
        ]
    },
    {
        "id": "55f92f0685665c92",
        "type": "function",
        "z": "0983465ad5ca464d",
        "name": "File Name",
        "func": "var obj = msg.payload;\n\nvar text2 = obj.Date;\nvar time = obj.time;\nvar NFID = obj.NFID;\nvar NF = NFID.toString();\n\n\n\n//var path = '/home/coeavm06/Datalog/LiveData_V3/' + text2 + '/'  + NF + '_' + text2 +'.csv';\n//var path = '/Users/temp.admin/Desktop/Cpd_PcLogg' + text2 + '/'  + NF + '_' + text2 +'.csv';\nvar path =  '/Users/temp.admin/Desktop/Cpd_Data' + text2 + '/' + NF + '_' + text2 + '.csv';\n\nmsg.filename = path;\n \nif (context.text2 != text2)\n{\nmsg.reset = true;\nmsg.payload = obj;\ncontext.text2 = text2;\n}\nelse\n{\n//msg.reset = false;\nmsg.payload = obj;\n\n}\n\n//msg.payload = obj;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 670,
        "y": 2540,
        "wires": [
            [
                "cf9f8fc7f4df2cdf"
            ]
        ]
    },
    {
        "id": "e54024d9e492b14c",
        "type": "function",
        "z": "0983465ad5ca464d",
        "name": "conver single header",
        "func": "var obj = msg.payload;\n\nvar data = obj.data;\nvar Unixtime = obj.time;\nvar NFID = obj.NFID;\n\n\n\ndata.timestamp = Unixtime;\ndata.Time = global.get('TimeNow');\ndata.NFID = NFID;\ndata.Date = global.get('DateNow');\n\n\nmsg.payload = data;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 660,
        "y": 2460,
        "wires": [
            [
                "55f92f0685665c92"
            ]
        ]
    },
    {
        "id": "e1f246392912e397",
        "type": "json",
        "z": "0983465ad5ca464d",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 410,
        "y": 2460,
        "wires": [
            [
                "e54024d9e492b14c"
            ]
        ]
    },
    {
        "id": "224af4047c939788",
        "type": "function",
        "z": "0983465ad5ca464d",
        "name": "FIlter R00000_0037",
        "func": "var obj = msg.payload;\n\nif (obj.includes(\"R00001_0037\"))\n{\n//obj.time = new Date().getTime();\nmsg.payload = obj;\nreturn msg;\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 180,
        "y": 2460,
        "wires": [
            [
                "e1f246392912e397"
            ]
        ]
    }
]

Thank you for providing your flow BUT you didn't provide any input data for anyone to test with. With out some sample data. it would take someone needn't to spend extra time to help solve your issue.

Please provide some data that could process thru your flow. You could use an inject node and put the data in msg.payload. I'll be waiting to see what you provide.

p.s. ou should also add a return; at the bottom of the function node labeled 'FIlter R00000_0037'

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