Timerange while value > 0

Hi,

I try to visualize the time while my Heating System is active. But how can I select this time Range?

The Data looks like:

I try to build a Graph that displays how long my Heating System is active in minutes.
This is a private project with my Raspberry PI 3

my data looks like this.

Timestamp               | current_stat
2017-05-01 00:00        | 0
2017-05-01 00:05        | 0
2017-05-01 00:10        | 1
2017-05-01 00:15        | 1
2017-05-01 00:20        | 1
2017-05-01 00:25        | 0
2017-05-01 00:23        | 0
...
2017-05-02 00:00        | 0
2017-05-02 00:05        | 0
2017-05-02 00:10        | 1
2017-05-02 00:15        | 0
2017-05-02 00:20        | 1
2017-05-02 00:25        | 0
2017-05-02 00:23        | 0

PS: Values could be missing the result should stay the same if the data
2017-05-01 00:15 | 1
would be missing.
The Graph should show the time diff summed per day

So like to have a graph with:

(15min)
  |    (10 min)
  |       |
  |       |
05/01    05/02   ...

How can I select this in Influx?

I also have a Grafana Ticket for the same Topic.

Can you do something like:

select sum(current_stat) from heat where time > now() - 24h

Alternatively, if you want an hourly breakdown:

select sum(current_stat) from heat where time > now() - 24h group by time(1h)

1 Like