Daily/monthly runtime of heating

I’m using InfluxDB 2,2 with Grafana. In InfluxDb I’m capturing when my heating start and stops.

This is done via a booelan value.

True = Heating running
False = Heating not running

I want to calculate the runtime over a period of time. I.e. heating runtime in hours per day, month etc.

What function do I need to use for this?
Can I use directly the boolean value or do I need to convert them first to something else?

This is my query I’m currently using to display if the heating is on/off

from(bucket: “iobroker”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “modbus.0.coils.80_Verdichter_on/off_diskret”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> yield(name: “last”)

Which gives me this output

@alen79

Maybe try putting this before the yield() function?

  |> stateDuration(fn: (r) => r._value == "true")
  |> group(columns: ["_value"])
  |> count(column: "stateDuration")

It should give you something like this:

Hi

I’m looking at similar problem, but with IoT time series source. I need to analyse a valve open/close true/false duration over time period. then ideal calculate min time, max time, avg time it takes valve to open/close. Any suggestions would be appreciated.

Welcome @richardriby to the Grafana forum.

I presume you are storing your data in InfluxDB and using Flux to write your queries? Have you written or tried anything and if so, what are the results you are seeing?

Hi Grant

I’m storing Data IoT time Series. apologies for late replay. From what I can see a very limited ability to query.

DateSource: Siemens InsightHub IoT time Series data.

Looking a the interface, I can query the data, option to pull back raw data or aggregated data then I need to apply transforms to manipulate the data.

Objective
Measure Value of the Aggregate Hopper Load cell, Just as the discharge gate open. This will give me the batch size.

Measure the time between each discharge gate opening - Batch cycle time

Measure the time the Discharge gate was open - Batch Drop Time

Measures the Time discharge gate Closed - Hopper Filling time

Can you share the queries that produce the above graphs?


Image of Query for digital

Image of Integer Query

Transformers to scale value

@richardriby

Your question has nothing to do with InfluxDB, so I’d recommend you start a new thread and maybe reference this original thread to explain your question. If Siemens has a forum, you might have better luck posting there.

Clearly indicate in the subject link that you are using “Siemens InsightHub IoT time Series data” as that is important for others to help you. I have no experience with that datasource.

1 Like