Displaying data in node red dashboard by using the last collected data in InfluxDB

Hello everyone,

I'm fairly new to node-red and I might need suggestions on how can I do it, much appreciated !

As the title says, I'm trying to display the last collected data from InfluxDB that indicates the active/inactive status from my pir motion sensor, but i'm lost at how can i get the data from influxdb, i tried using the influxCLI to query select * from motion order by time desc limit 1 and it returns exactly what i want as it shows the newest collected data from influxdb. The problem is how i should get the data from node red?

Any kindhearted soul can provide me some guidance?

Welcome to the forum:

i mean which node is the best? i also have the influxdb palette installed, i looked at inject node and status node but it doesn't display the last collected data, also the first() is the oldest data, what i need is the newest data

Did you look at the docs? Not surprisingly it is last that you need.
You can use an Inject node to feed the query into the influx node.

1 Like

yeah i saw that just now, currently studying it how it works

Are you using influxdb 1.x or 2.x?

i'm using influx 1.6.5

Wow, that is ancient. The query language for 1.8 and below is not flux, you will have to find the docs for the earlier query language for that version. It will look much more like conventional SQL.

yeah because im using raspberry pi 4 and the intended installation of influxdb cloud is not working for me and im not going to dig my head into that for days without progressing anything. So i just use my university prof's influxdb version for ease, plus he taught me with that version and im just going stick with that without those error logs bugging me

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