Write PMS5003 values to Influx

Dear community,

I want to write measurements from a PMS5003 particle sensor to a InfluxDB.

I used the following flow:

[{"id":"66abefa.684ae1","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"e450ba8e.ed8aa","type":"mqtt in","z":"66abefa.684ae1","name":"PMS5003","topic":"tele/2f71a7/+","qos":"2","datatype":"json","broker":"af1f4435.2620c","x":120,"y":160,"wires":[["e10c3b32.c79a4"]]},{"id":"5728b396.91ba64","type":"debug","z":"66abefa.684ae1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":590,"y":220,"wires":[]},{"id":"f94f0331.7ae53","type":"influxdb out","z":"66abefa.684ae1","influxdb":"d066c67e.d889","name":"Write to InfluxDB","measurement":"Feinstaub","precision":"","retentionPolicy":"","x":630,"y":140,"wires":[]},{"id":"e10c3b32.c79a4","type":"function","z":"66abefa.684ae1","name":"Select All Values","func":"m = msg.payload.PMS5003\n\nmsg.payload = [\n {\n measurement: \"Feinstaub\",\n fields: m,\n tags: {\n deviceID: \"2f71a7\"\n }\n }\n ]\n\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":160,"wires":[["f94f0331.7ae53","5728b396.91ba64"]]},{"id":"af1f4435.2620c","type":"mqtt-broker","z":"","name":"mosquitto","broker":"mosquitto","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d066c67e.d889","type":"influxdb","z":"","hostname":"influxdb","port":"8086","protocol":"http","database":"home_db","name":"","usetls":false,"tls":""}]

Unfortunately I get the follwoing error:

Dont know why he is unable to parse the field values.

Any help is appreciated !

Br Peter

2 things...

  1. your havent posted a flow (only 1 node)
  2. your export is un-importable as you didnt wrap the flow in 3 backticks

like this

My guess (I dont use influx) : I would check the following...

  • is fields supposed to be an object with key:values?
  • does fields support keys with . in the name?

You are right .... shame on me. I corrected the flow. Hope the flow is now importable.

Regarding your second comment (does fields support keys with a "." in the name) I need to check - I simply dont know. But I will do.

Thanks for your help !
Br Peter

1 Like

mind you, the comment "invalid boolean" (in the error screen shot) smells of "you sent wrong data" or perhaps you're missing a required field (that incidentally should be a boolean?)

I think you are getting mixed up about the format for the influx batch node and the influx Out node. You are using the Out node, but your data appears to be a mixture of the two formats. I suggest reading the info panel for the node again.

Regarding the node-red-contrib-influxdb docu there is no boolean value (at least I didnt found).

The node red influxdb example shows

msg.payload = [{
    numValue: 12,
    randomValue: Math.random()*10,
    strValue: "message2"
return msg;

I will check about the format.

Thanks for your hint !

That example shows what your data should look like, which is not like the data you posted at the start.

Yes, true. It is a example from the influxdb docu. I need to change my flow. You were right, I mixed the structure for the different write nodes (batch and normal).

Thanks a lot !
Br Peter

Boolean is a valid data type. https://docs.influxdata.com/flux/v0.65/language/types/

Yes, true.

It was my intention to say that I didnt use the boolean type so I was wondering where the error message came from.

Br Peter

I wouldn't worry about it, it may just have been horribly confused by your data :slight_smile:

Sorry Colin, that was not my goal to confuse you :slight_smile:

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