data downloaded to the table:
DATETIME,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12
2024/10/18 04:00:00,20,10,30,40,60,60,70,80,90,30,21,23
2024/10/18 04:01:00,25,15,32,41,20,90,50,80,95,35,11,20
2024/10/18 04:02:00,22,12,37,43,60,45,75,22,10,40,28,25
let measurement = "Panel" // set this to your measurement
// convert to array by splitting on newline
let values = msg.payload.split("\n")
// discard the first one which is not required
values.shift()
// and the last which is empty
values.pop()
// map the array elements to the format required by influx batch node
values = values.map(function(value) {
let splits = value.split(",")
//node.send({payload: value})
return {
measurement: measurement,
fields: { Panel_01: Number(splits[1]), Panel_02: Number(splits[2]), Panel_03: Number(splits[3]), Panel_04: Number(splits[4]), Panel_05: Number(splits[5]), Panel_06: Number(splits[6]), Panel_07: Number(splits[7]), Panel_08: Number(splits[8]), Panel_09: Number(splits[9]), Panel_10: Number(splits[10]), Panel_11: Number(splits[11]), Panel_12: Number(splits[12])},
tags: { W: 'panel' },
timestamp: Date.parse(splits[0])
}
})
msg.payload = values
return msg;
At night the colors are null, there is only the date with this formatting without any value
data downloaded to the table in the night
DATETIME,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12
2024/10/18 04:00:00
2024/10/18 04:01:00
2024/10/18 04:02:00
how to format the string, if there is no detected data present, but only the date