Unable to parse: invalid boolean

Moin,

everything has worked so far, but now I have no idea.

Given: A thermometer sending data via wifi and mqtt. I want to display that in Grafana. Works fine with "mqtt in", my InfluxDB and Grafana. The data format (displayed with mosquitto):
****/*****/Garden/status/humidity:0 {"id":0,"rh":65.6}

The devices also send the voltage of the batteries, format (with mosquitto) is this:
****/*****/Garten/status/devicepower:0 {"id": 0,"battery":{"V":6.18, "percent":100},"external":{"present ":false}}

Unfortunately there is this error:

Error: A 400 Bad Request error occurred: {"error":"unable to parse 'SpannungGarten battery=[object Object],external=[object Object],id=0': invalid boolean"}

What to do?

Welcome to the forum @MichaelRenner

Is the error coming from an influxdb Out node? If you click on the node id above the error message it should take you to the relevant node. Even better, if you have named all your nodes then the name will appear in the debug pane.

If it is coming from an Influxdb Out node then the problem is that the payload you have shown is not valid for writing to influxdb. If you look at the help text for the node it tells you the valid payload formats. Influx cannot cope with structured data (objects within objects) it must only have fields and tags.

Moin Colin,

thanks for the friendly welcome.

you recognized the problem right away:

Influx cannot cope with structured data (objects within objects) it must only have fields and tags.

The problem is the battery object
{
"id": 0,
"battery": {
"V": 6.17,
"percent": 100
},
"external": {
"present": false
}
}

Is there a way to preprocess the data, e.g. by filtering just for the V (for voltage) object like I would do it using jq (jq .battery.V)? Or an other solution?

Thanks

Welcome @MichaelRenner

Can you post the actual message actually sent the InfuxDB Input Node?

Add a Debug Node and then, from the right hand sidebar in the Debug Window enclose a copy of the complete message between </> so that we get an exact copy. We can then work on that.

Moin,

this is the message like the debug node showed it.

{"id":0,"battery":{"V":5.95,"percent":97},"external":{"present":false}}

Path is: payload

This is the error message:

Error: A 400 Bad Request error occurred: {"error":"unable to parse 'SpannungKeller battery=[object Object],external=[object Object],id=0': invalid boolean"}

Not sure if this is the content you asked for, so I made a screenshot. The node named "Maudach" is the influxdb out node.

Screenshot_20230413_190559
Screenshot_20230413_190959

I am just confused as you ask for influxdb in but it is the influxdb out node. This setup works for the temperatures and the humidity.

Does that give clues?

Micha

My bad!! Indeed InfluxDB out - I was looking at one of my own flows and confused myself!!

Good to hear, I thought I had set something up completely wrong :slight_smile:

Have a look at the node red docs Working with Messages. That should get you started.

If you are a beginner then I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Then read the help text for the influx node and work out what structure you want in msg.payload.

Moin,

I did so. At least understood enough to solve the problem. For the archive:
Usung the function node

msg.payload = { "volatage": msg.payload.battery.V }
return msg;

Thans for this hint.
Micha

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