min/max/ average plugin discussion

User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

you have not picked any measure to track:

Code: Select all

   minMax                          Configuration: Dev-Name    DevID            State       ignoreLess  ignoreGreater; tracking states: -------
   minMax                          Thermostat          ; 857805275 ; temperatureInput1      -9876543210      9876543210   <<<< missing measures   >>>>
should do:
0. select device/ state
1. select some measures.. like max hour max day ..
2. click on confirm at the bottom ... long list

then the variables should appear

Karl
Attachments
Screen Shot 2018-11-30 at 18.20.10.png
Screen Shot 2018-11-30 at 18.20.10.png (66.24 KiB) Viewed 4491 times
Screen Shot 2018-11-30 at 18.20.18.png
Screen Shot 2018-11-30 at 18.20.18.png (26.5 KiB) Viewed 4491 times
Screen Shot 2018-11-30 at 18.20.39.png
Screen Shot 2018-11-30 at 18.20.39.png (8.33 KiB) Viewed 4492 times
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

posted: V 7.7.5

to clarify how to select .. manage measures (min/max/ave/count / lastday/lasthour ..):

1. added warning to selection menu, if no measure (ave min/max) was selected that no variable will be created.
also same info is printed to logfile "--- no measure selected, no variable will be created---"
2. previously defined / tracked devices are marked in the selection box for new devices to be tracked
3. bugfix in logfile for error messages


Karl
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

coming up:

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  
Karl
teejay6
Posts: 44
Joined: Mon Jan 31, 2011 10:50 pm
Location: Menlo Park, CA

Re: min/max/ average plugin discussion

Post by teejay6 »

Hi Karl:

Been using your minmax plugin for tracking temperatures from my Aeotec MultiSensor 6, and I am finding it very useful.
I have been seeing the following error in the event log:

Code: Select all

Feb 2, 2019 at 11:18:21 AM
   minMax                          subscribing to device changes
   Z-Wave                          received "Sensor - Out Porch Front Door - Temperature - ZWave Z5" sensor update to 57.0 °F
   Z-Wave                          received "Sensor - Out Porch Front Door - Humidity - ZWave Z5" sensor update to 88%
   minMax Error                    ==================================================================================
   minMax Error                    fillVariables: error in  Line '835' ;  error='need more than 0 values to unpack'
   minMax Error                    ==================================================================================

In the current event log I received the message at the following times:
  • Jan 31, 2019 at 8:26:32 PM
    Feb 1, 2019 at 12:02:41 AM
    Feb 1, 2019 at 12:51:33 PM
    Feb 1, 2019 at 8:41:08 PM
    Feb 2, 2019 at 12:02:41 AM
    Feb 2, 2019 at 11:18:21 AM
Any idea what might be going on?
Thanks
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

fixed in v 7.11.11


1. added:
changed to std logging

2. fixed bug
fillVariables: error in Line '835' ; error='need more than 0 values to unpack'


Karl
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

Oops. I changed the logging. Forgot to remove the import.


Sent from my iPhone using Tapatalk
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

fixed in .14 .. skipped .13 for good luck
teejay6
Posts: 44
Joined: Mon Jan 31, 2011 10:50 pm
Location: Menlo Park, CA

Re: min/max/ average plugin discussion

Post by teejay6 »

Wow! Thanks so much for the quick response.
juntta
Posts: 147
Joined: Mon Oct 13, 2014 12:46 am
Location: Finland

Re: min/max/ average plugin discussion

Post by juntta »

Hi!

I tried to get minmax plugin running but my data variables stay empty. I have the sql logger plugin configured and running.

It seems that minmax plugin cannot read the database since getting this password error:

Code: Select all

/Library/PostgreSQL/11/bin/psql indigo_history postgres  -t -A -F ';' -c "SELECT to_char(ts,'YYYY-mm-dd-HH24:MI:ss'), sensorValue from device_history_666929919  where to_char(ts,'YYYY-mm-dd-HH24:MI:ss') > '2020-02-29-00:23:18'  ORDER by id  ;"
data-out: 
err-out:  Password for user postgres: 
psql: fe_sendauth: no password supplied
Any ideas what to check? I have the password setup in Sql logger config alright.
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

Postgres w password is different.

To use a password w Postgres the psql command is different
I will check.

i need to change the command to:
export PGPASSWORD='password'; psql -h 'server name' -U 'user name' -d 'base name' -c 'command'


Sent from my iPhone using Tapatalk
juntta
Posts: 147
Joined: Mon Oct 13, 2014 12:46 am
Location: Finland

Re: min/max/ average plugin discussion

Post by juntta »

kw123 wrote:Postgres w password is different.

To use a password w Postgres the psql command is different
I will check.

i need to change the command to:
export PGPASSWORD='password'; psql -h 'server name' -U 'user name' -d 'base name' -c 'command'


Sent from my iPhone using Tapatalk
So is plugin update from you needed or can I add that command to either plugins config?
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

try this:
https://blog.sleeplessbeastie.eu/2014/0 ... -terminal/
but that defeats the concept of a password..
here is how that should look for indigo & postgres
open terminal

Code: Select all

echo 127.0.0.1:5432:indigo_history:username:password >  ~/.pgpass
chmod 0600 ~/.pgpass
replace username (postgres) and password with your settings
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

added option to use userid and password.

Set it in config.

not tested, as I don't use a password for the DB

Karl
juntta
Posts: 147
Joined: Mon Oct 13, 2014 12:46 am
Location: Finland

Re: min/max/ average plugin discussion

Post by juntta »

thanks, I tested and ran in following error.

Code: Select all

   minMax Error                    Error in plugin execution UiValidate:

Traceback (most recent call last):
  File "plugin.py", line 256, in validatePrefsConfigUi
NameError: global name 'liteOrPsqlString' is not defined
And the password field was showing password as plain text, not as password field with hidden characters.
User avatar
kw123
Posts: 8408
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: min/max/ average plugin discussion

Post by kw123 »

try v .15

fixed "global name 'liteOrPsqlString' is not defined"
changed password display to ****

BUT just as a precaution: the password is stored as plain text in the plugin.prefs file!! (*)
This only impacts the display == if someone is looking over your shoulder

Karl
(*) indigo docu:
"If you specify true for this value then when the user types into the field the actual characters won't show but rather will be replaced with the bullet (•) character. The values typed into these fields are not stored securely - this will solely mask the value in the field from viewing in the UI."
Post Reply

Return to “Min / Max / Average Plugin”