min/max/average plugin DOWNLOAD

Posted on
Fri Dec 11, 2015 11:02 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

min/max/average plugin DOWNLOAD

Use this plugin to calculate the min/max/averages of device/states or variables and put the result into variables for easy access in your display pages etc.
e.g. what was the min/max/ average temperature yesterday or last week?

(please use this thread http://forums.indigodomo.com/viewtopic.php?f=188&t=15240&p=107092#p107092 to discuss the plugin: )


version 7-5-2 takes advantage of some i7 features
download from here:https://www.dropbox.com/s/hrsnfn9alsu6fvt/minMax-v-7-5-2.zip?dl=1

this plugin will create variables like these:

DeviceName_StateName_thisHour_Ave
DeviceName_StateName_thisHour_Min
DeviceName_StateName_thisHour_Max
DeviceName_StateName_thisHour_Ave_Count
DeviceName_StateName_thisHour_Max_Date
DeviceName_StateName_thisHour_Min_Date

...
with a device= Outside and the state = temperature and selected measurement = Min and timeframe = lastDay it would create a variable:
Outside_Temperature_LastDay_Min

in a folder minMax


The Options for time frames: for average/min/max of the device/states are:
this hour
last hour
this day
last day
last 7 days
this week
last week
this month
last months

Besides min/max you can also get the timestamp of when the min/max value was e.g. for this months would be interesting when the max temp was.
For averages you can get the number of measurements that went into the sum/#of measurements

You can also
select a range for the values. Values outside this range will be ignored.

It will read the SQLITE DataBase every x minutes (configure in config) and will calculate the min/mac/average values of the selected device/states or selected variables.

YOU MUST HAVE SQLITE / postgres running (Enable sqllogger plugin)

the screenshots:

the variables created:
Screen Shot 2015-12-11 at 10.54.10 AM.png
Screen Shot 2015-12-11 at 10.54.10 AM.png (44.11 KiB) Viewed 6676 times

the config menu:
Screen Shot 2015-12-11 at 10.55.11 AM.png
Screen Shot 2015-12-11 at 10.55.11 AM.png (38.44 KiB) Viewed 6676 times

the selection menu:
Screen Shot 2015-12-11 at 3.13.08 PM.png
Screen Shot 2015-12-11 at 3.13.08 PM.png (135.24 KiB) Viewed 6635 times



NOW on plugin storehttps://www.indigodomo.com/pluginstore/95/


Karl

Posted on
Fri Dec 11, 2015 6:02 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

version 0.4.2 posted:

added:
you can set upper and lower limits for data values . If data is outside the range it will be ignored. (due to popular demand from Norway)
e.g. if you temperature range is -50..+50. You might want to exclude any values below or above that to be included in the min/max/ave calculations. Sometimes device readings come back with bad numbers


Karl

Posted on
Mon Dec 14, 2015 11:57 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

version 0.4.4:

fixed:
If there is no data entry in the sqlite Database in your time window (e.g. this hour, last hour) it took the date-time stamp of the last entry in the SQL database

Now will use the earliest date-time of your selected time window as the date/time stamp for the date-time value instead of the date time stamp when the entry was into to the sql database.

In other words if your e.g. temperature has not changed in the last 5 days lets say since 2015-12-09 07:08:00 and it is still 19C.

Before it used that date-time stamp of the last entry in the database: 2015-12-09 07:08:00

Now it will use the first date/time of your time window e.g. for
thisHour: if it is 2015-12-11 10:15:23 right now it would use now 2015-12-11 10:00:00 instead of 2015-12-09 07:08:00 in the date-time stamp variable.
The min/max value will still show 19 (C)

Karl

Posted on
Mon Aug 15, 2016 8:30 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

v 0.4.9:
fixed: did not deal with % numbers.

should be fixed. now.
I did compile the plugin but no testing (starts w/o syntax error)
All done remotely on my laptop


Karl

Posted on
Mon Aug 15, 2016 10:32 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

try it again:
posted v 0.4.10

Posted on
Sun Dec 04, 2016 9:47 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

posted V 7.5.2, @top of thread

added protection against indigo timeouts

Posted on
Fri Nov 16, 2018 10:24 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

posted V 7.6.3 ; NOW ON plugin store https://www.indigodomo.com/pluginstore/95/

- fixed some minor issues ( now better logging etc, typos ,.. )
- added last 7 days measurement option
- improved menu to make it clearer that some measurements (ie this hour average, count ...) have to be selected in order to create any variables
- added menu option to remove tracking of device/states,. It was part of create tracking device/state menus.
. Only the currently tracked device/states/variables are shown there - not all xx hundred indigo devices and variables

Karl

Posted on
Sun Dec 02, 2018 1:55 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

Code: Select all
changes in V 7.8.5  @ 2018-12-02 
================== 

1. major rewrite of internal data structure. 

2. added format option for ave/min/max variables  eg %.1f or %.3f ...
   For count it is integer and dates it is string 

3. added free format option for date strings in eg ...DateMax   
   %Y-%m-%d %H:%M:%S   ==>  2018-02-24 15:13:40
   %y-%b-%d %I%p %M:%S ==>  2018-Feb-24 3pm 13:40
   set in config

4. added count if value > 0 measure 

5. average is now a proper time weighted average, before it was just sum(values)/count.
   if eg temperature is 0 for 1 hour and 10 for 9 hours
     simple average would give 5, time weighted average = 9 
    ==> sqllogger used to get the data only stores the changes, hence time weighted average is more proper
    in most cases the difference is much smaller

6. now has the following measures: 
   BINS: "thisHour","lastHour","thisDay","lastDay","thisWeek","lastWeek","thisMonth","lastMonth","last7Days" 
   and for each of the above the following   
   functions: "Min","Max","DateMin = Date of Min","DateMax = Date of Max","Ave","Count","Count1= Count when value>0 - use for eg events = on/off types"

7. option to choose short name for variables - set in define tarcking of devices menu
   instead of s-2-TH-Leo-Outside_Temperature_thisWeek_Max
   eg  set short name to        L-O-Temp
   results in variable name:    L-O-Temp_thisWeek_Max

8. in menu add device/state now shows the previously selected devices first

9. added time CPU tracking option (for debugging and experts), set in config


config:
Screen Shot 2018-12-02 at 13.48.35.png
Screen Shot 2018-12-02 at 13.48.35.png (121.37 KiB) Viewed 5311 times

menus:
Screen Shot 2018-12-02 at 13.49.41.png
Screen Shot 2018-12-02 at 13.49.41.png (73.09 KiB) Viewed 5311 times
Screen Shot 2018-12-02 at 13.50.01.png
Screen Shot 2018-12-02 at 13.50.01.png (102.73 KiB) Viewed 5311 times

Screen Shot 2018-12-02 at 13.50.13.png
Screen Shot 2018-12-02 at 13.50.13.png (96.25 KiB) Viewed 5311 times

variables: shortName ="":
Screen Shot 2018-12-02 at 13.53.25.png
Screen Shot 2018-12-02 at 13.53.25.png (110.22 KiB) Viewed 5311 times

shortName="testfor_short_name":
Screen Shot 2018-12-02 at 13.53.32.png
Screen Shot 2018-12-02 at 13.53.32.png (76.88 KiB) Viewed 5311 times


Karl

Posted on
Tue Dec 04, 2018 11:12 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

released in V 7.8.6 @ 2018-12-04
==================

1. added standard deviation measure = StdDev , besides min/max/ave / count/ count if >0 & Date Of Min Date of Max

2. improved menu error checking (eg if you click on confirm and nothing is selected ..)

3. improved formatting of menus and printouts

3. added option to select / deselect all 72 possible measures in
menu define tracking ...


Karl

Posted on
Fri Dec 07, 2018 9:49 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

Code: Select all
changes in V 7.9.9  @ 2018-12-07
================== 

1. added measures:
   standard deviation "StdDev" 
   Start Value "Start" = first value in time bin and "End" = Last Value
   all functions: "Min", "Max", "DateMin", "DateMax", "Ave", "Count", "Count1", "First"", "Last"
   time bins:     this & last:  hour, day, week, month, and last7Days
   
2. improved menu error checking - in case not all fields are set

3. improved formatting of menus and printouts
 
4. automatic subscription to changes in devices and variables.  Will switch on/off if not needed
   optimized checking if data updates are needed to reduce cpu load
 
5. added option to select / de-select all 90 possible measures in menu "define tracking ..."   
 
6. force refresh all data  action & menu items 
Karl

Posted on
Tue Dec 11, 2018 8:45 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

Code: Select all
released  V 7.10.10  @ 2018-12-11
================== 

1. added measures:
   First / last Entry Value and Date. These are the data from the first/last entry in the sql db in the time bin

if you have eg a door open close it will tell you the first time / last time it was opened or closed in the selected time bin (this /last .. hour, day, week, month..)

Karl

Posted on
Wed Mar 30, 2022 1:17 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

Added features / changes in v7.13.17@ 2022-03-30
===================================================
prep for indigo 2022 and os 12.3

Can run under MAC OS 12.3.. AFTER indigo 2022 is released

!!! do not upgrade to MAC OS12.3 (Monterey) yet !!!,

But this release should work fine with indigo 2021 and 2022 and older versions

I would appreciate if someone could test this with the current indigo releases ie 2021 and older.
It was tested under indigo 2022 Mac OS 12.3 and Indigo 2021 and MAC OS 12.2, but naturally not all functions.

The older versions of this plugin (< 7.13.17) will NOT run under MAC OS 12.3 (even with indigo 2022 )

Karl

Posted on
Tue May 10, 2022 3:47 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: min/max/average plugin DOWNLOAD

NOTE: Indigo 2022.1 has solved the compatibility issue with macOS Monterey 12.3+.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jun 26, 2022 10:57 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

changes in V 2022.13.18 @ 2022-06-30
==================

1. requires indigo 2022 +, runs under py3
2. streamlined loggging
3. variable names are now
deviceName__state__TimeWindow_Measurement
eg: Hue_light_0_48_Küche_ceiling_1__redLevel__thisHour_Count1
added an extra _ after device name and stateName

Posted on
Sun Feb 04, 2024 3:32 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/average plugin DOWNLOAD

changes in V 2022.13.21 @ 2023-02-03
==================

1. added short name to printout of tracked devices

2. moved preSelectDevices() out of interactive menu part to avoid timeouts on slower MACs with larger number of devices
or older indigo versions on new mac Mx
and removed some checking to reduce the loop count by a factor of 20.

This should solve the timeouts some users experience when adding new devices to be tracked.

It looks - as I understand this- that an older indigo version (7 years old) running on a new mac Mx seems to be a factor 20 slower in certain functions than a newer indigo version
especially in this case: getting devices in a loop and looping through all states to check for certain format / contents
On my M1 mac it takes 0.7 secs for 800 devices --- on a M2 mac with 600 devices it takes 20 secs for the same steps.

After these changes the old indigo version does it under 1 sec.


Karl

Who is online

Users browsing this forum: No registered users and 2 guests