InfluxDB connection error

Hello

I have problem with node influxdb in.

I have error: HttpError: 500 Internal Server Error : {"error":"loc 1:12-1:13: invalid statement @1:12-1:13: ,"}

I have home assistant with addon Node red. Data to influxdb work.

Can you help what is problem?

From that error it sounds like you have an invalid statement.

How are you sending a query to influx?
What does the msg being sent look like? (Connect a debug node to the node sending the query to the influx-in node and set it to display the complete msg object)

msg.query = 'SELECT time, celsius FROM "ProjectData01"."Temperature"."Outdoor" WHERE time > now()';

return msg;

i tested all and nothing.

You appear to be asking for only data in the future, though I would not expect that to give the error you are seeing.

Are you using the influxdb Out node to write data successfully? Can you export the function node, InfluxDB In node and the Influxdb Out node that works please and paste them here.

See this post for more how to post flows - How to share code or flow json

1 Like

sorry f.e
now() - 6h';

influxdb out: this is working!

[{"id":"32f2f3d.1e8eb0c","type":"influxdb out","z":"1d03c38.8213fbd","g":"ea0777be.9c085","influxdb":"a5b4acaa.45e12","name":"InfluxDB","measurement":"Outdoor","precision":"","retentionPolicy":"","database":"ProjectData01","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"Temperature","org":"organisation","bucket":"bucket","x":780,"y":260,"wires":[]},{"id":"a5b4acaa.45e12","type":"influxdb","hostname":"192.168.50.250","port":"8096","protocol":"http","database":"ProjectData01","name":"MyConnect","usetls":false,"tls":"","influxdbVersion":"1.8-flux","url":"http://192.168.50.250:8096","rejectUnauthorized":true}]

influxdb in:

[{"id":"3e88cb3a.4635c4","type":"function","z":"b90ea9f2.7fe938","name":"new time scale","func":"\n//msg.query = \"SELECT time, celsius FROM ProjectData01.Temperature.Outdoor WHERE time > now() -  \" + msg.payload;\n\nmsg.query = 'SELECT time, celsius FROM \"ProjectData01\".\"Temperature\".\"Outdoor\" WHERE time > now() - 6h';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":100,"wires":[["a4bc1a59.1df978"]]},{"id":"a4bc1a59.1df978","type":"influxdb in","z":"b90ea9f2.7fe938","influxdb":"a5b4acaa.45e12","name":"Influx","query":"","rawOutput":false,"precision":"","retentionPolicy":"","org":"organisation","x":950,"y":100,"wires":[["4859b4e6.35b51c","19d71a3d.a98b5e"]]},{"id":"a5b4acaa.45e12","type":"influxdb","hostname":"192.168.50.250","port":"8096","protocol":"http","database":"ProjectData01","name":"MyConnect","usetls":false,"tls":"","influxdbVersion":"1.8-flux","url":"http://192.168.50.250:8096","rejectUnauthorized":true}]

Admin edit: modified so that flows are importable.

You did not read the link I posted carefully, I have editted your post so the flows are importable.

You have configured the config node as 1.8x-Flux which means that you are using Influx 1.8 but want to use the Flux query language. But the query you have used is not a Flux query, it is influx SQL. Either change the config to 1.x type, or use a Flux query.

great, it is work.

thanks