Hello,
I have a csv file which look like this:
Time | [2:0] | [2:1] | [2:2] | [2:3] | [2:4] | [2:5] | [2:6] | [2:7] | [coil_id] |
---|---|---|---|---|---|---|---|---|---|
time | Ziehkraft_IST | Ziehkraft_IST_INT | Ziehkraft_IST_LIN | Drehzahl-Istwert vom Regler | Strom-Istwert vom Regler | ISTWERT ZIEHGESCHW.GEGLAETET | ISTWERT ZIEHGESCHW.GEGLAETET | Ziehkraft_IST_V | coil_id |
sec | |||||||||
14.07.2017 19:03:15.000000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | nan |
14.07.2017 19:03:15.010000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
14.07.2017 19:03:15.020000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
14.07.2017 19:03:15.030000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
14.07.2017 19:03:15.040000 | 303.818 | 0 | 0.760291 | 0.72338 | 144.676 | 0.723379 | 144.676 | 0.0303818 | 0 |
I have created nodes in node-red to send the data in node-red which look like this:
here I am able to see the result in debug node but I am not able to write the correct json script in function node before sending to influxdb.
I use this script:
msg.payload = [
msg.payload.csv
def convertTime(s):
try:
dt = set.datetime.strptime(s, ‘%d.%m.%Y %H:%M:%S.%f’)
return dt
except:
return None
;
,
{
tag:“COIL_ID”
}];
return msg;
I am new to nodered and influxdb .Please let me know(json script) that how can I send my csv file with correct timestamp and a tag key.
your efforts will be appreciated.