Grafana And Influx - Lights On By Time


#1

Hello, I have a influx DB with stats from my lights! This entries are recorded when changed, and every 1 minute! I would like to have a graph, histogram or heat map, that would give me the number of lights on per time, so I know that at what times I have more lights on!

Who can I do this? Can any one help me with the query?

Thank You


#2

Ok I was able to make this work, tis is my select, maybe it’s useful to someone else.

SELECT count("last") FROM (SELECT last("power") FROM "devices" WHERE "type" = 'lights' AND power = 1 AND $timeFilter GROUP BY "deviceId") WHERE $timeFilter GROUP BY time($interval)

Thank you