Averaging

Perfect! Works like a charm. Thank you so much!

1 Like

I don't know if that's what you want or not. Whenever there is an energy report, it adds all of the selected energyMeter devices and stuff that value into the created 'omni sensor' device as its energy value.

If you want instead for it to just add the most recent report to the existing sum, then replace the third to last line with this:

def sum = energysum.currentEnergy + evt.value.toInteger()

In other words, do you want a current sum, or an accumulating sum?

1 Like

Will that sum change whenever a single device adds to it's total automatically, or will a new report need to be ran?

I don't know how these devices work. This app's handler() method will run on each energy report. Is that reported value itself an accumulated value, or is it a new value? If each device is doing its own accumulation then you want the original version. If each device is making a new report and you want to accumulate, then use the replacement line.

I have to run out.... Play with it. It's easy to change how it works -- hopefully obvious with the two examples above.

1 Like

Each device does their own accumulation, and when more power is added. Say for example my fridge has used 5.30 kwh so far, the next time it cycles the device will report 5.40 now.

Right on, thanks again

1 Like

Could we get one for min/max of a group of (temperature) sensors too please :smiley:?

You can't get both in one sensor, since each temperature sensor has only a single temperature attribute to set. So the app would have to create two devices, one for min and one for max.

1 Like

awesome - thanks!

Awesome, thank you!

Hi @bravenel, could it be possible to add a mechanism like a switch to pause/resume the averaging function on command. I have various iterations of temperature averaging for the purpose of swapping avg values to Thermostat Controller depending of time of day or desired rooms to be monitored. I have over 7 simultaneous iterations running at the same time and I have been noticing that since then, is taking a toll on the hub's response time. Thank you.