Heating system counter

Dear All,

I useing Grafan + InfluxDB on a Raspi to check my geo heating.
The temp sensors graph is working fine, now I would like to count how many times the heating is ON and how long it is working, but ignore the higher tempereatures witch is the making the hause hot water.
So the counter would be just a number in the current month, the operating time is in hours also in the current month.

What I wanted to count is the datas signed with the red arrows.

Could you help me?
thx
Peter


Maybe you need this?
Function sgn(x)=abs(x)/x

Dear Misho,

Yes, I would need the uptime like on your screen bottom.

Could you help me? I am not so familiar with this.

My temperature query looks like this:

SELECT “value” FROM “device_3” WHERE $timeFilter

I would count the running times and full running time in a month.

Thanks a lot for your help

Best regards

Peter

Misho Petkovic via Grafana Community grafana@discoursemail.com ezt írta (időpont: 2019. dec. 17., K, 0:08):

SELECT ((abs(mean("value) - 28 ) / (mean(“value”) - 28) + 1 ) /2) as uptime FROM “device_3”
28 will remove points <28
I don’t completed total time count (don’t need now) but, when complete, I will post.
Please post graph after applay this function. Need find way to remove gaps :slight_smile:

Dear Misho,

Thank you.

Now I get an erro message:

  {
"error": "error parsing query: found “, expected identifier, string, number, bool at line 1, char 40",
"message": "error parsing query: found “, expected identifier, string, number, bool at line 1, char 40"
}

for the query :SELECT ((abs(mean(“value”) - 28)/(mean(“value") - 28) + 1) /2) as uptime FROM “device_3”

Any idea?

Thanks for your

Peter

Misho Petkovic via Grafana Community grafana@discoursemail.com ezt írta (időpont: 2019. dec. 17., K, 21:29):

Thats a copy&paste error, try to replace the quotation marks after paste into your shell.
You can see the difference if you type a " near your pasted text and compare.

Yes you are right.
I change those, now I got this:

  {
"error": "error parsing query: found -28, expected ) at line 1, char 26",
"message": "error parsing query: found -28, expected ) at line 1, char 26"
}

Mattes via Grafana Community grafana@discoursemail.com ezt írta (időpont: 2019. dec. 18., Sze, 13:37):

Looks like you deleted an closing bracket, check the original query from misha with yours.

Dear Mattes and Misho,

Thank you for your answers.

I checked and corrected it I think.

Now I am get the error:“error parsing query: expected field argument in abs()”

Waiting for your help!

Thank you

Peter

Mattes via Grafana Community grafana@discoursemail.com ezt írta (időpont: 2019. dec. 18., Sze, 17:52):

Sorry for late. I hope you fixed the problem.
This is mathematical function (sgn(x)+1)/2 and give you 0 for x<0, 1 for x>0. or step function.
I found another one solution

SELECT mean(“temp_input”)/mean(“temp_input”) FROM “sensors” WHERE (“feature” = ‘temp1’) AND “temp_input”> 30 AND timeFilter GROUP BY time(1m) fill(null)

This give you 1 for all points >30