Node-red influxdb invalid boolean


Hello guys, I'm new to node-red and influxdb and mqtt so bear with me. So I'm trying to send a Json object to an influxdb database I created but when I try to send the object to influxdb I get the following error:

Error: A 400 Bad Request error occurred: {"error":"unable to parse 'sonoff ENERGY=[object Object],Time=\"2019-02-16T19:51:25\"': invalid boolean"}

The json string I get from the sensor is this:


Finally, the flow I am using is the following flow:

[{"id":"6ce293e0.d07ab4","type":"mqtt in","z":"31324429.f7d1ac","name":"","topic":"stat/sonoff/POWER","qos":"2","broker":"b219fa03.3781f8","x":279,"y":129,"wires":[["c6f3034f.ebd078"]]},{"id":"c6f3034f.ebd078","type":"debug","z":"31324429.f7d1ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":714,"y":102,"wires":[]},{"id":"b35ffdb9.9eb05","type":"mqtt in","z":"31324429.f7d1ac","name":"","topic":"tele/sonoff/SENSOR","qos":"2","broker":"b219fa03.3781f8","x":282,"y":215,"wires":[["ea18aa60.babca"]]},{"id":"ea18aa60.babca","type":"json","z":"31324429.f7d1ac","name":"","property":"payload","action":"","pretty":true,"x":531.5,"y":213,"wires":[["c6f3034f.ebd078","de651a0c.c782f"]]},{"id":"de651a0c.c782f","type":"influxdb out","z":"31324429.f7d1ac","influxdb":"de82086b.a7424","name":"measurements","measurement":"sonoff","precision":"","retentionPolicy":"","x":792.5,"y":218,"wires":[]},{"id":"b219fa03.3781f8","type":"mqtt-broker","z":"","name":"TESIS","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"de82086b.a7424","type":"influxdb","z":"","hostname":"","port":"8086","protocol":"http","database":"Tesis","name":"TESIS","usetls":false,"tls":""}]

Everything together along with the error message looks something like this

I copied the flow from a video I saw on youtube and it works for his sensor, unfortunately it doesn't work for mine even tho we have the same sensor. I don't know if I'm doing something wrong and I can't seem to find the problem.



Firstly, your flow is not importable, please see the link below for how to format it correctly. You can edit your previous post to fix it.
However it seems from the image that the data you are sending to the influx node is not in the right format. If you look at the Info tab for that node it tells you the expected formats. What tags/fields are you wanting to write the data to? As you have it, it is trying to write the whole ENERGY object to one field.



I've edited the post as you mentioned, I'm not trying to write the whole ENERGY object to one field. I want everything in the ENERGY object to be written in the database and have each measurement (TotalStartTime, Total, Yesterday, etc) in different tags.



Look at the info tab for the influx node and it tells you how to format the data. You have to split them out of the ENERGY object.

1 Like


Thank for the advice, I've managed to edit the payload and successfully store it in influxdb.



Hi. I have the same problem, could you tell me how?



How to do what?



Can you help with how to edit the payload to make this work?



This section of the docs has information on messages and how to manipulate the contents.



Thanks, that was helpful