Totalized/Sum Binary Point per Day
I'm trying to sum a binary point which represents run status (variable = runs) of a pump. 1 = pump is running. 0 = pump is stopped.
I'd like to calculate the total number of starts during the day. This new variable is a numeric data type.
Based on my search on the forums and previous help I've received, the best I could come up with is either this:
return point.past(MINUTE, 1440).sum;
With a cron pattern of: 57 59 23 * * ?
When I generate the data, I get a notification that 5 updates were created.
However, all the values are 0.
I suspect my problem has something to do with the fact that I'm attempting to count a binary point.
phildunlap last edited by
Binary points return StartsAndRuntimeList objects, not AnalogStatistics objects. i would encourage you to check out
print( point.past(DAY) );and use the cron you have. previous() is quantized, so you're asking for the day before the day it's running on in that setup.
Of interest is probably the
.countproperty, which if you're logging your binary on change, is probably 2x the value you are looking for or 2x+1. You can also get the data specifically for the true or false states in the
.datalist property of the StartsAndRuntimeList
I got this to work:
return point.past(MINUTE, 1440).get(true).starts;