After reading the documentation of InfluxDB, I've come a bit further.
I;ve formatted the input for the Influx as following:
var tokens = msg.topic.split("/");
var Signal = {payload: msg.payload.event.data.networkStatus.signalStrength};
msg.measurement = tokens[1];
var payload = [
{
measurement: tokens[1],
fields: {
"sensor": tokens[2],
"Signalstrength": Number(Signal.payload),
},
tags: {
connector: msg.payload.event.data.networkStatus.Connectors[0].id,
transmissionMode: msg.payload.event.data.networkStatus.transmissionMode
},
//timestamp: new Date("2020-03-31T20:30:01Z").getTime() *1000 *1000
timestamp: ( Date.now() / 1000 )
}
];
//node.send({payload});
msg.payload = payload;
msg.measurement = msg.payload.measurement;
return msg;
However somehow, the measurement isn't passed on.
Influx out is missing the "msg.measurement"
So, i've added an extra function, just to add: msg.measurement.
[{"id":"fce711bc.b02a5","type":"mqtt in","z":"1b060b76.b3bb65","name":"","topic":"sensors/networkStatus/#","qos":"2","datatype":"json","broker":"5902000a.e4b36","x":350,"y":180,"wires":[["7847fa6.d1ca004","dcd10c16.83caa"]]},{"id":"dcd10c16.83caa","type":"function","z":"1b060b76.b3bb65","name":"Formatting","func":"var tokens = msg.topic.split(\"/\");\nvar Signal = {payload: msg.payload.event.data.networkStatus.signalStrength};\nmsg.measurement = tokens[1];\nvar payload = [\n {\n measurement: tokens[1],\n fields: {\n \"sensor\": tokens[2],\n \"Signalstrength\": Number(Signal.payload),\n },\n tags: {\n connector: msg.payload.event.data.networkStatus.connectors[0].id,\n transmissionMode: msg.payload.event.data.networkStatus.transmissionMode\n },\n //timestamp: new Date(\"2020-03-31T20:30:01Z\").getTime() *1000 *1000\n timestamp: ( Date.now() / 1000 ) \n }\n \n];\n//node.send({payload});\nmsg.payload = payload;\nmsg.measurement = msg.payload.measurement;\nreturn msg;\n","outputs":1,"noerr":0,"x":590,"y":160,"wires":[["853fac2.f633f5","cae5283f.db57e8"]]},{"id":"cae5283f.db57e8","type":"function","z":"1b060b76.b3bb65","name":"measurement toevoegen","func":"msg.measurement = \"networkStatus\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":160,"wires":[["9b9be73.f22c118","abd135e7.d0f098","5e3c7e07.df6a3"]]},{"id":"5e3c7e07.df6a3","type":"influxdb out","z":"1b060b76.b3bb65","influxdb":"5a8ec4d6.f465dc","name":"InfluxDB","measurement":"","precision":"","retentionPolicy":"","x":1080,"y":160,"wires":[]},{"id":"5902000a.e4b36","type":"mqtt-broker","z":"","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"node-red","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"5a8ec4d6.f465dc","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"ooksensors","name":"influxione.....","usetls":false,"tls":"6f4cf6b0.5e2ea8"},{"id":"6f4cf6b0.5e2ea8","type":"tls-config","z":"","name":"local-tls","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}]
the debug show me the following:
{"topic":"sensors/networkStatus/bivdmqv95ss000eukf5g","payload":[{"measurement":"networkStatus","fields":{"sensor":"bivdmqv95ss000eukf5g","Signalstrength":21},"tags":{"connector":"bhr8gf4c00013k4nvl20","transmissionMode":"LOW_POWER_STANDARD_MODE"},"timestamp":1587922440.567}],"qos":0,"retain":false,"_topic":"sensors/networkStatus/bivdmqv95ss000eukf5g","_msgid":"4b829402.283c2c","measurement":"networkStatus"}
If i connect to the "influxdb out" it will result into the following error.
Error: A 400 Bad Request error occurred: {"error":"unable to parse 'networkStatus fields=[object Object],measurement="networkStatus",tags=[object Object],timestamp=1587922375.42': invalid boolean"}
What am i missing or what am i doing wrong?
Any help would be highly appreciated.