# Write PMS5003 values to Influx

**URL:** <https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433>\
**Category:** General\
**Created:** [24 April 2020 16:45 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433 "2020-04-24T16:45:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 16:45 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/1 "2020-04-24T16:45:34Z")

</div>

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:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/be82a6435eab99ee3759a333ba93ae00cbfd68bf.png)

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

Any help is appreciated !

Br Peter

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 19:13 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/2 "2020-04-24T19:13:40Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 20:05 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/3 "2020-04-24T20:05:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 April 2020 20:08 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/4 "2020-04-24T20:08:47Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 April 2020 20:25 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/5 "2020-04-24T20:25:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 20:34 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/6 "2020-04-24T20:34:18Z")

</div>

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

The node red influxdb example shows

```auto
msg.payload = [{
    numValue: 12,
    randomValue: Math.random()*10,
    strValue: "message2"
},
{
    tag1:"sensor1",
    tag2:"device2"
}];
return msg;

```

---

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 20:37 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/7 "2020-04-24T20:37:03Z")

</div>

I will check about the format.

Thanks for your hint !

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 April 2020 20:48 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/9 "2020-04-24T20:48:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 20:51 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/10 "2020-04-24T20:51:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 April 2020 20:53 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/11 "2020-04-24T20:53:18Z")

</div>

> [@PeterKatana](#):
>
> there is no boolean value

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

---

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 20:55 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/12 "2020-04-24T20:55:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 April 2020 21:12 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/13 "2020-04-24T21:12:51Z")

</div>

> [@PeterKatana](#):
>
> It was my intention to say that I didnt use the boolean type so I was wondering where the error message came from.

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

---

<div class="post-metadata">

**Author:** ![PeterKatana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/peterkatana/32/20602_2.png) [@PeterKatana](https://discourse.nodered.org/u/PeterKatana)\
**Post date:** [24 April 2020 21:13 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/14 "2020-04-24T21:13:55Z")

</div>

Sorry Colin, that was not my goal to confuse you 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 June 2020 21:14 UTC](https://discourse.nodered.org/t/write-pms5003-values-to-influx/25433/15 "2020-06-23T21:14:04Z")

</div>

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