Page 4 of 5
Re: min/max/ average plugin discussion

Posted:
Fri Nov 30, 2018 6:21 pm
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
Re: min/max/ average plugin discussion

Posted:
Sat Dec 01, 2018 7:49 am
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
Re: min/max/ average plugin discussion

Posted:
Sun Dec 02, 2018 1:31 pm
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
Re: min/max/ average plugin discussion

Posted:
Sat Feb 02, 2019 1:24 pm
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
Re: min/max/ average plugin discussion

Posted:
Sat Feb 02, 2019 10:02 pm
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
Re: min/max/ average plugin discussion

Posted:
Sun Feb 03, 2019 7:28 am
by kw123
Oops. I changed the logging. Forgot to remove the import.
Sent from my iPhone using Tapatalk
Re: min/max/ average plugin discussion

Posted:
Sun Feb 03, 2019 8:16 am
by kw123
fixed in .14 .. skipped .13 for good luck
Re: min/max/ average plugin discussion

Posted:
Sun Feb 03, 2019 11:23 am
by teejay6
Wow! Thanks so much for the quick response.
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 7:27 am
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.
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 8:33 am
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
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 9:19 am
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?
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 10:28 am
by kw123
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
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 11:51 am
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
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 12:38 pm
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.
Re: min/max/ average plugin discussion

Posted:
Sat Apr 04, 2020 2:08 pm
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."