min/max/ average plugin discussion

Posted on
Fri Nov 30, 2018 6:21 pm
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

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 2678 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 2678 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 2679 times

Posted on
Sat Dec 01, 2018 7:49 am
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

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

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

Re: min/max/ average plugin discussion

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

Posted on
Sat Feb 02, 2019 1:24 pm
teejay6 offline
Posts: 44
Joined: Jan 31, 2011
Location: Menlo Park, CA

Re: min/max/ average plugin discussion

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

Posted on
Sat Feb 02, 2019 10:02 pm
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

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

Posted on
Sun Feb 03, 2019 7:28 am
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

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


Sent from my iPhone using Tapatalk

Posted on
Sun Feb 03, 2019 8:16 am
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

fixed in .14 .. skipped .13 for good luck

Posted on
Sun Feb 03, 2019 11:23 am
teejay6 offline
Posts: 44
Joined: Jan 31, 2011
Location: Menlo Park, CA

Re: min/max/ average plugin discussion

Wow! Thanks so much for the quick response.

Posted on
Sat Apr 04, 2020 7:27 am
juntta offline
Posts: 125
Joined: Oct 13, 2014
Location: Finland

Re: min/max/ average plugin discussion

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.

Posted on
Sat Apr 04, 2020 8:33 am
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

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

Posted on
Sat Apr 04, 2020 9:19 am
juntta offline
Posts: 125
Joined: Oct 13, 2014
Location: Finland

Re: min/max/ average plugin discussion

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?

Posted on
Sat Apr 04, 2020 10:28 am
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

try this:
https://blog.sleeplessbeastie.eu/2014/03/23/how-to-non-interactively-provide-password-for-the-postgresql-interactive-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

Posted on
Sat Apr 04, 2020 11:51 am
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

added option to use userid and password.

Set it in config.

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

Karl

Posted on
Sat Apr 04, 2020 12:38 pm
juntta offline
Posts: 125
Joined: Oct 13, 2014
Location: Finland

Re: min/max/ average plugin discussion

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.

Posted on
Sat Apr 04, 2020 2:08 pm
kw123 offline
User avatar
Posts: 8090
Joined: May 12, 2013
Location: Dallas, TX

Re: min/max/ average plugin discussion

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."

Who is online

Users browsing this forum: No registered users and 1 guest

cron