[RELEASE] Averaging Plus - Average just about anything. Trigger on High/Low/Delta/Average/Percent

I am currently using a custom averaging app that takes 2 or more Temp readings and forwards them to a Virtual Thermostat. This works well, but there is no truncation on the average decimals, so sometimes I end up with a very long temperature "reading". I have no Groovy knowledge so don't know how to change it. In addition to this the current app has multiple non-nested instances, which doesn´t look super nice.

image

I was hoping that I could use your Averaging Plus app for this, but it seems I need to create a new virtual device or use an existing one but with a specific driver. I suppose I could create a new device and copy the temp to the thermostat, but that just adds more devices, which is something I was trying to avoid.

Any idea if I could do this differently with Averaging Plus ?

First, I would recommend contacting the author of the custom app that you are using. Most are very accommodating.

Yes, that's so the app knows how to 'talk' to the device. That device is specifically designed to work with AP.

Once you get the average temp into the device, you can do anything you like with the data. Read it into other apps or use it with RM for examples.

2 Likes

I only just started using this app. I've created 2 virtual temperature sensors using it. Tonight at midnight, I got the following errors in the log, 1 for each.

[dev:422](http://192.168.1.134/logs#dev422)2020-08-14 12:00:00.402 am [error](http://192.168.1.134/device/edit/422)java.lang.ArrayIndexOutOfBoundsException: 1 on line 86 (virtualAverage)
[dev:225](http://192.168.1.134/logs#dev225)2020-08-14 12:00:00.321 am [error](http://192.168.1.134/device/edit/225)java.lang.ArrayIndexOutOfBoundsException: 1 on line 86 (virtualAverage)

Please download the updated driver and capture a debug log. Post a screenshot of the log, not just the error.

thanks

Updated and turned on debugging logging. Will post if I notice any errors.

I don't know if this would make the virtual devices to bulky, but it would be sweet if the log, or a variable state included all the incoming variables being tabulated. Also, is there any math/logic/option to toss out obvious bad data? Like when one sensor fails, or batteries die, etc. Perhaps a mode that throws out sensors that haven't updated in the last hour, and the option to also achieved a "trimmed mean," which in the statistics world means you toss out the top and bottom 10%. When I'm doing 10-15 temperature sensors and one of them is reporting something bogus, it would be nice to have that feature. Then the virtual device could report the instantaneous high/low as well. That could be useful if you not only want to work with the average, but also extremes.

Just tossing out some ideas. Thanks!

Hi @bptworld - I just started using this - I'm not sure if it's just coincidence but it looks like when averaging temperatures it seems to round up or down to the nearest whole temp. However it would be really useful to have at least one decimal place so that the hysteresis of my thermostats can work properly with this. thanks!

New version on GitHub...

1.1.2 - 12/04/20 - Added one decimal point to average

1 Like

Thank you!

1 Like

As I was adding a new child today, I thought of a potentially useful feature for this app. Right now the app has a time setting to decide when to re-average the devices. It could be nice to have an option to re-average whenever one of the devices updates the attribute that's being averaged.

For example, I'm mainly using it for temperatures, if I set it to average every 5 minutes and then a temperature change comes in 2 seconds after that completes, I now have to wait 4 minutes and 58 seconds for the average to reflect these changes. If I set it at the quickest possible refresh (1 minute), it'll more quickly reflect changes, but during the majority of the day, when the house isn't rapidly changing temperature, I just end up recalculating average needlessly.

This is exactly why the timer is in there. Recalculating every time a value changes by .01 would be very hub intensive. So to compromise, I have the different times.

2 Likes

That’s fair, my temperature sensing devices really only report at a change of around .5 of a degree, so I generally only see reports at most every couple of minutes. So hadn’t considered devices out there that report that level of change granularity. Didn’t think there were devices out there report that little of a change! Seems like a great way to overwhelm a mesh.

1 Like

Hi @bptworld,

Thanks for this great app! I noticed something about the rounding - it looks like the average for temperature is given with one decimal place, but the input gets cut off. For example, I'd expect this:

70.8, 70.9, 71.7, ave - 71.1

but what it appears to be doing is just lopping off the decimal for the input like this:

70, 70, 71, ave - 70.3

In my opinion, the inputs should never be rounded/changed before any averaging takes place. Is this something that can be looked at/considered? Thanks!

1 Like

New version...

1.1.3 - 07/21/21 - No longer rounding the original number

1 Like

Wow - thanks for taking a look at this so quickly! I just updated and looks good!

:slight_smile:

1 Like

@bptworld , I tried to average 2 x lux censors. I noticed if one of the sensors shows zero then the average will be the same as the value of the other higher sensor. i.e sensor 1 = 0, sensor 2 = 10 , average = 10 ?
Do I need any extra setting to get this right?
Thanks

New version...

1.1.4 - 08/03/21 - Fixed averaging issue

@bptworld, thanks! that fix it. And thanks Bryan for the super-fast response.

1 Like

Hi @bptworld

Please can I ask if it is possible to have an option to select to not have any decimal places on an averaged result. I am using your app to average 2 lux readings and I had an issue in one of the rules, @bobbyD said that lux should not have a decimal point. If this is possible already then I apologies, if you could let me know what I need to do. If not then maybe a change :slight_smile:

Thanks for the time.

Try the new version...

1.1.5 - 08/20/21 - Added decimal option

1 Like