Hi folks,
I’m working with a dataset in InfluxDB 1.8 which has a significant amount of temperature data feeding in to it from IoT devices.
The aim is to create a table on a dashboard that only shows device which are reporting a temperature of below a particular value
My generic “return all the rows” query is an attempt at an equivalent of this pseudo-SQL:
SELECT last(value), device_name
FROM temperature
WHERE time > now() - 6h
GROUP BY device_name
which should return
time | value | device_name |
---|---|---|
$seconds | 17.20 | room 001 |
$seconds | 18.00 | room 002 |
$seconds | 16.10 | room 003 |
$seconds | 8.6 | room 004 |
I then want to take that data and only show the data in the table when the value is less than 10, so something like:
SELECT last(value), device_name
FROM temperature
WHERE time > now() - 6h
AND value < 10
GROUP BY device_name
So I can reformat the table as follows:
ROOM NAME | TEMPERATURE |
---|---|
Room 001 | 8.6 |
I’ve been battling the query syntax and formatting for a while, but I can’t work out how it should all hang together.