Does the Query API return averages?

Hey Bob,

If i use this query on 3 of my outputs

http://172.16.101.200/query?select=[time.iso,Solar,Consumption,Grid]&begin=h-1h&end=h&group=m&format=csv&header=yes

It appears to return a minute by minute reading for the preceeding hour (very quickly too - great work on that !)

Is the minute by minute reading - an average of the values for each minute - or just the value closest to the end (or start) of the minute ?

regards

Craig

If units is Wh, it returns the total for the period. All other units returns the average for the period.

Thanks Bob - it is in Watts

regards

Craig

Just to clarify Bob please

If i do the following query every minute from Node-Red to IOTAWATT will this give me a rolling 5 minute average for each of the channels ? It appears to be doing so and thus letting me schedule loads to use excess Solar etc - but just wanted to confirm my understanding was correct ?

http://172.16.101.200/query?select=[Solar,Consumption,Grid]&begin=m-5m&end=m&group=5m&format=json&header=no

Craig

Yes, that will give you a 5 minute average, but on minute boundaries, if that’s what you want. For instance if the query is made at 11:23:02 you will get the average for 11:19;00-11:23:00. If the same query is made at 11:23:59 you will get the same result.

To simply get the average for the last 5 minutes to present, use begin=s-300s&end=s&group=all

1 Like

Good one thanks Bob - thanks for the clarification - for what i am doing in terms of averaging out available solar/excess to enable the running of arbitrary loads then either will work - but as you have shown the option using Seconds will give a more deterministic and reproducible result.

Have a great XMAS

Craig

1 Like