EmonCMS and CSV files

Node-red can read a csv file. And there is an emoncms node to send data to emoncms. I’ve tried it with <1000 lines of data and it seems to work OK. I only spot checked the imported data.

EDIT: below is a simple node-red diagram to move data from a csv file into emoncms. One part I haven’t figured out is how fast data can be pushed into emoncms. I’ve set the limit to 2 messages per second.
 

 

[
    {
        "id": "8f912d5d.8340e8",
        "type": "function",
        "z": "4a22cedb.45235",
        "name": "",
        "func": "var kWh = msg.payload.kWh;\nif ( kWh <= 0 ) { return null; }\nmsg.nodegroup = \"16\";\nmsg.time = '' + msg.payload.epoch;  //  must be 'string input' not 'number input'\nmsg.payload = \"energy_kWh:\" + kWh;\n\nreturn msg;\n",
        "outputs": "1",
        "noerr": 0,
        "x": 170,
        "y": 200,
        "wires": [
            [
                "248c3d88.1a1692"
            ]
        ]
    },
    {
        "id": "56a2cdb0.50361c",
        "type": "csv",
        "z": "4a22cedb.45235",
        "name": "csv",
        "sep": ",",
        "hdrin": "",
        "hdrout": "",
        "multi": "one",
        "ret": "\\n",
        "temp": "epoch,kWh",
        "x": 410,
        "y": 100,
        "wires": [
            [
                "8f912d5d.8340e8"
            ]
        ]
    },
    {
        "id": "b7d2c1ea.b29f3",
        "type": "file in",
        "z": "4a22cedb.45235",
        "name": "get data",
        "filename": "yourCSVfile.csv",
        "format": "utf8",
        "x": 260,
        "y": 100,
        "wires": [
            [
                "56a2cdb0.50361c"
            ]
        ]
    },
    {
        "id": "f924d020.a27e38",
        "type": "inject",
        "z": "4a22cedb.45235",
        "name": "go",
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 110,
        "y": 100,
        "wires": [
            [
                "b7d2c1ea.b29f3"
            ]
        ]
    },
    {
        "id": "91a876aa.c583e8",
        "type": "emoncms",
        "z": "4a22cedb.45235",
        "name": "emoncms",
        "emonServer": "6f9482ce.906b7c",
        "nodegroup": "",
        "x": 500,
        "y": 200,
        "wires": []
    },
    {
        "id": "2e461ac8.9f5ea6",
        "type": "comment",
        "z": "4a22cedb.45235",
        "name": "CSV file to emonCMS",
        "info": "My CVS input file is:\n- one column of epoch (in seconds)\n- and one column of kWh.",
        "x": 120,
        "y": 40,
        "wires": []
    },
    {
        "id": "248c3d88.1a1692",
        "type": "delay",
        "z": "4a22cedb.45235",
        "name": "",
        "pauseType": "rate",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "2",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 330,
        "y": 200,
        "wires": [
            [
                "91a876aa.c583e8"
            ]
        ]
    },
    {
        "id": "6f9482ce.906b7c",
        "type": "emoncms-server",
        "z": "",
        "server": "http://127.0.0.1/emoncms",
        "name": "emonPi"
    }
]
1 Like