[RELEASE] Averaging Plus - Average just about anything. Get notifications based on set points

Introducing 'Averaging Plus'
Average just about anything. Get notifications based on Set points.

  • Select groups of devices that share a common attribute
  • Devices do not have to be the same type!
  • Adjustable time between averages
  • Selectable High and Low set points
  • Get notifications and/or turn a switch on when set point is reached
  • All speech requires 'Follow Me'
  • Automatically creates data device if needed
  • Parent/Child App structure
  • Create as many child apps as needed

Apps can be found on my GitHub or by using the Hubitat Package Manager.
(HPM is highly recommended)

When reporting problems...

  • Be sure you are on the latest version. I won't troubleshoot an older version.
  • Turn on debug and screenshot the issue happening in the log. One line or just the error doesn't cut it. I need a log.
  • Post the screenshot of the log with an explanation of the problem.

Thanks

11 Likes

@bptworld Bryan, very cool. Just set up an illuminance averager for my external Hue sensors. Should let me come up with a good average outdoor illuminance in the evening to govern my lighting automations!

Thanks for this!

S.

1 Like

Hi Bryan.
I use lux sensors in 2 different rarely used rooms to average illuminance readings.
When the average device is below certain levels then lights turn on with motion.
The problem that can occur is if the light is on in one of those rooms where the lux sensor is. It will affect the average lux level and therefore affect my motion lighting rules that relay on lux levels.
Now to the question, would it be possible to define a switch in the app that would enable/disable the app.
This way it would be possible to stop the affect of a light being on causing problems with the averaging app.
Thanks.

EDIT: I've got a work round so this request is no longer required.
Thanks again.

@bptworld Bryan, I'm seeing the following in my logs, have yet to look at the code, and so far, I'm not using this in any real rules, just calculating average illuminance off 3 Hue Outdoor sensors.

app:20822020-06-06 09:38:18.067 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

app:20822020-06-06 09:37:18.037 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

app:20822020-06-06 09:36:18.076 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

app:20822020-06-06 09:35:18.064 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

app:20822020-06-06 09:34:18.065 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

app:20822020-06-06 09:33:18.068 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

I'm going to have a look and see what precisely the current values are.

S.

Please provide a debug log, not just the error.

Thanks

Had to turn it on.

app:20822020-06-06 09:48:32.040 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (averageHandler)

app:20822020-06-06 09:48:32.038 pm debugIn averageHandler - working on Outdoor Motion Sensor 3 - illuminance - num: 0

app:20822020-06-06 09:48:32.033 pm debugIn averageHandler - working on Outdoor Motion Sensor 2 - illuminance - num: 0

app:20822020-06-06 09:48:32.029 pm debugIn averageHandler - working on Outdoor Motion Sensor 1 - illuminance - num: 0

app:20822020-06-06 09:48:32.024 pm debug - - - - - Start (Averaging) - - - - -

app:20822020-06-06 09:48:32.023 pm debugIn averageHandler (1.0.0)

app:20822020-06-06 09:48:26.278 pm errorjava.lang.ArithmeticException: Division undefined on line 285 (updated)

app:20822020-06-06 09:48:26.274 pm debugIn averageHandler - working on Outdoor Motion Sensor 3 - illuminance - num: 0

app:20822020-06-06 09:48:26.271 pm debugIn averageHandler - working on Outdoor Motion Sensor 2 - illuminance - num: 0

app:20822020-06-06 09:48:26.266 pm debugIn averageHandler - working on Outdoor Motion Sensor 1 - illuminance - num: 0

app:20822020-06-06 09:48:26.262 pm debug - - - - - Start (Averaging) - - - - -

app:20822020-06-06 09:48:26.261 pm debugIn averageHandler (1.0.0)

app:20822020-06-06 09:48:26.140 pm debugUpdated with settings: [theDevices:[Outdoor Motion Sensor 1, Outdoor Motion Sensor 2, Outdoor Motion Sensor 3], dataDevice:Outdoor Illuminance, useExistingDevice:true, logEnable:true, dataName:Outdoor Illuminance, attrib:illuminance, timeToReset:2020-06-06T00:00:00.000-0400, triggerMode:1_Min]

app:20822020-06-06 09:48:24.244 pm debugIn createDataChildDevice (1.0.0)

There you go... All 3 devices have a value of '0'. Can't divide 0 by 3.

I'll add some code so it doesn't error out but the answer will still be 0.

This has no doubt been happening every night! I just never noticed.

My use case is probably a bit odd. 0 is quite an acceptable answer. :slight_smile:

Thanks Sir.

S.

1 Like

If you're in mmaking a fix, I just noticed a misspelling on the Virtual device section of the app page:

A device will automaticaly be created for you as soon as you click outside of this field.

"automatically" I think you want.

S.

Alright, I don't have an easy way to test this so I'll let you do it. :wink:

Child:
1.0.1 - 06/06/20 - Added more options and some error trapping

Thanks

1 Like

Seems to be working perfectly. Thanks!

This message twisted my noggin for a second:

020-06-06 10:07:13.114 pm debugIn averageHandler - The average (0) is ABOVE the high setpoint (null)

Zero is > null, just not how I usually think about it! :slight_smile:

S.

1 Like

Neat! is there a rational for why the Average isn't stored in the same type as the thing its averaging? e.g. it seems cleaner if its averaging illuminance then the virtual device would have a property call illuminance that would store that average.

I only bring it up because I sometimes see rules and apps that are stickers for things being the same property type when used in conjunction.

Also, is there a reason that the data needs to be cleared every 24hrs? I see the value for the min and max, but it would be nice if the average value was stored longer (a week or so?)

Yup, as with most of my apps, when I created it for my needs there way no reason to do so. I'll look into it.

Nope, again I originally made this for me and use it for daily High and Low temps and humidity. I'll add it to the list.

2 Likes

New version on GitHub...

Child app and Driver...

Attribute average now save under same attribute name when possible, app will only display attributres that are numbers, added weekly high/low.

New version on GitHub...

Child:
1.0.3 - 06/11/20 - All speech now goes through Follow Me

New version on GitHub...

Child:
1.0.4 - 06/13/20 - Fixed letsTalk typo

1 Like

Hey Bryan, thanks for creating this! I noticed I needed a few small tweaks to use it with motion lighting / illuminance. Specifically I needed to add a new capability to the driver (so that I could choose it as a sensor in ML) and change how the rounding was done in the parent app (seems motion lighting doesn't like floating point numbers).

I can probably put together a pull request if you're open to it?

Thanks. I don't use ML so please send it over.

New version on GitHub...

Child:
1.0.5 - 06/16/20 - Changes by @rvrolyk, thanks!

Driver:
1.0.2 - 06/15/20 - Added capability IlluminanceMeasurement - @rvrolyk