I'm trying to retrieve the most recent 2 items from InfluxDB via Nodered for further processing. I can't seem to combine the items and get the last values.
This works:
SELECT last(Temperature) FROM environment where Location = '5th_wheel'
but it only returns one value.
This works but gets the oldest readings:
select "Temperature", "Humidity" FROM environment WHERE Location = '5th_wheel' LIMIT 1
This draws an error:
select last("Temperature", "Humidity") FROM environment WHERE Location = '5th_wheel'
"Error: Error from InfluxDB: invalid number of arguments for last, expected 1, got 2"
Not sure if this worked because the timecode is wrong:
select last("Temperature"), last("Humidity") FROM environment WHERE Location = '5th_wheel'
Now that I have the query working in Nodered for my influxDB data, I need to build the http request part of it. I can't find the right example online. I want to use http://192.168.0.25:1880/basement to retrieve the most recent basement temperature and humidity reading from the influxDB and return those readings in a JSON string. Once I have this working I can change up the basement for another location that will be used as part of the query. (FYI, the data in the influxDB is updated once a minute via MQTT nodes in various locations.)