Page 1 of 2

otmonitor feature request

Posted: Thu Apr 23, 2020 3:49 pm
by WimN
Hello, in the otmonitor.conf file there are settings for the pressure warning:

Code: Select all

alert {
  pressurelow 1.5
  roomcold 14
  pressurehigh 2.0
}
But when I change these settings and restart otmonitor nothing changes. When I check the source there seems only to be a default setting but I cannot find how this can be changed by setting the .conf file.
So is it possible to change the pressurelow and pressurehigh values from within otmonitor or by editing the .conf file?

BTW I'm running version 4.3 on Raspberry Pi 3B+ with 'buster'.

Thanks.

Re: otmonitor feature request

Posted: Fri Apr 24, 2020 6:22 pm
by hvxl
What evidence makes you conclude that "nothing changes"? When I change my configuration file and then start otmonitor, the changed values are used to determine when to send out alerts. For example: When I set pressurelow to 1.8, I get an email saying "The CH water pressure has dropped below 1.8 bar. The current CH water pressure is 1.60 bar."

Re: otmonitor feature request

Posted: Sat Apr 25, 2020 1:04 am
by WimN
These are the settings:

Code: Select all

alert {
  pressurelow 1.2
  roomcold 14
  pressurehigh 2.4
}
and this is the mail I get:

Code: Select all

The CH water pressure has risen above 2.1 bar. The current CH water pressure is 2.11 bar.
It is not the 2.0 as in the defaults, but also not the 2.4 as in the current settings.

Re: otmonitor feature request

Posted: Sat Apr 25, 2020 10:01 pm
by hvxl
Changes to the config file while OTmonitor is running are not automatically picked up. OTmonitor only reads the config file on startup. It may write the file at different times. So, to change the settings, shut down OTmonitor, modify the config file, then start OTmonitor again.

Re: otmonitor feature request

Posted: Sun Apr 26, 2020 1:00 am
by WimN
That's what I have done, even a reboot of the Raspberry Pi.

Re: otmonitor feature request

Posted: Sun Apr 26, 2020 3:48 pm
by hvxl
Then either you have been editing a different file than otmonitor is using, or there are multiple alert sections in the config file. To figure this out, you can create a html directory next to your otmonitor binary amd place a file called cfgdebug.txt.tmpl in that directory with the following contents:

Code: Select all

Configfile: [file normalize $::settings::configfile]
======================================================================
% set fd [open $::settings::configfile]
[read -nonewline $fd]
% close $fd
======================================================================
[join [lmap key [lsort [array names ::cfg]] {
    format "%s: %s" $key $::cfg($key)
}] \n]
Then start the web server of otmonitor, if necessary, and point your browser to http://192.168.3.14:8080/cfgdebug.txt (adjust the IP address and port as necessary). The page will show the filename of the config file used by otmonitor, the contents of the file, and the current configuration.

Re: otmonitor feature request

Posted: Mon Apr 27, 2020 2:16 am
by WimN
Ok, thanks.
It reports the config file at location: /home/pi/.config/otmonitor/otmonitor.conf, so that's another location then I was using.
When I change the email report setting for the pressure and check the report it changes value, so that confirms I'm looking at the correct file now.
When I edit the conf file and change the pressure value and check the report, than values are changed in the report.

Code: Select all

alert {
  pressurelow 1.2
  roomcold 14
  pressurehigh 2.4
}
So that is ok!
Then I restart otmonitor and the report show this:

Code: Select all

alert {
  pressurelow 1.5
  roomcold 14
  pressurehigh 2.0
}
So it looks like it that the values have been reset to the default values.

Re: otmonitor feature request

Posted: Mon Apr 27, 2020 6:47 pm
by Bororo
Hi WimN, if you post whole output it can help.
When I run cfgdebug.txt command I can see 2 parts - the first half is otmonitor.conf file's content and second half is actual otmonitor settings. These two parts are divided like this example:

Code: Select all

alert {
  pressurelow 1.2
  roomcold 12
  pressurehigh 1.8
}
view {
  tab graph
  order increasing
  sort name
  bitflags false
}
======================================================================
alert,pressurehigh: 1.8
alert,pressurelow: 1.2
alert,roomcold: 12
clock,auto: true
clock,date: false
clock,year: false
connection,device: /dev/ttyUSB-OTGW
connection,enable: true

Re: otmonitor feature request

Posted: Mon Apr 27, 2020 7:41 pm
by WimN

Code: Select all

alert {
  pressurelow 1.5
  roomcold 14
  pressurehigh 2.0
}
connection {
  device /dev/ttyAMA0
  type tcp
  port 6638
  host 192.168.201.60
  enable true
}
server {
  relay false
  enable true
  port 7686
}
view {
  tab graph
  order increasing
  sort name
  bitflags false
}
======================================================================
alert,pressurehigh: 2.0
alert,pressurelow: 1.5
alert,roomcold: 14
clock,auto: true
clock,date: false
clock,year: false
connection,device: /dev/ttyAMA0
connection,enable: true
connection,host: 192.168.201.60
connection,port: 6638
connection,type: tcp
datalog,append: false
datalog,enable: false
datalog,file: /home/pi/otdata.txt
datalog,interval: 30000

Re: otmonitor feature request

Posted: Mon Apr 27, 2020 11:57 pm
by Bororo
Thanks for info. Just to summarize:
1. Output from http://yourdeviceip:8080/cfgdebug.txt showing in the first line that your config is located here: /home/pi/.config/otmonitor/otmonitor.conf
2. When you change values pressurelow to 1.2 and pressurehigh to 2.4 in the /home/pi/.config/otmonitor/otmonitor.conf , then save file, check if values are really changed in the otmonitor.ahf, then restart or power cycle raspberry, your values for pressurelow are reverted back to 1.5 and pressurehight to 2.0 ???

Re: otmonitor feature request

Posted: Tue Apr 28, 2020 10:08 am
by WimN
Yes that's what's happening.
Just tried this:
- change the value in the .conf file
- this is the output from cfgdebug.txt (after a refresh)

Code: Select all

alert {
  pressurelow 1.2
  roomcold 14
  pressurehigh 2.4
}
connection {
  device /dev/ttyAMA0
  type tcp
  port 6638
  host 192.168.201.60
  enable true
}
server {
  relay false
  enable true
  port 7686
}
view {
  tab graph
  order increasing
  sort name
  bitflags false
}
======================================================================
alert,pressurehigh: 2.0
alert,pressurelow: 1.5
alert,roomcold: 14
clock,auto: true
clock,date: false
clock,year: false
The values are changed in the alert section but not in the values used by otmonitor (this is to be expected)
- restart otmonitor
- this is the output from cfgdebig.txt after a refresh

Code: Select all

alert {
  pressurelow 1.5
  roomcold 14
  pressurehigh 2.0
}
connection {
  device /dev/ttyAMA0
  type tcp
  port 6638
  host 192.168.201.60
  enable true
}
server {
  relay false
  enable true
  port 7686
}
view {
  tab graph
  order increasing
  sort name
  bitflags false
}
======================================================================
alert,pressurehigh: 2.0
alert,pressurelow: 1.5
alert,roomcold: 14
clock,auto: true
clock,date: false
clock,year: false
The default values seems to be restored
Otmonitor reports version 4.3

Re: otmonitor feature request

Posted: Tue Apr 28, 2020 5:51 pm
by Bororo
i have no idea what's wrong...
i'm using otgw on raspbian, but there should be no difference.
how did you install otmonitor to raspberry?
are you using any startup script for starting otmonitor daemonised?

Re: otmonitor feature request

Posted: Tue Apr 28, 2020 11:05 pm
by hvxl
I was expecting you guys would figure it out. It's really not that complicated.
The problem is you're not following the instructions I gave (emphasis added later):
hvxl wrote:Changes to the config file while OTmonitor is running are not automatically picked up. OTmonitor only reads the config file on startup. It may write the file at different times. So, to change the settings, shut down OTmonitor, modify the config file, then start OTmonitor again.
One of the times OTmonitor writes the config file is when it shuts down. So modifying the config file while OTmonitor is running won't work.

Re: otmonitor feature request

Posted: Wed Apr 29, 2020 12:32 am
by WimN
Thanks, reading was difficult :oops: after following the correct procedure it works!!

Re: otmonitor feature request

Posted: Wed Apr 29, 2020 10:09 am
by Bororo
hvxl wrote:I was expecting you guys would figure it out. It's really not that complicated.
The problem is you're not following the instructions I gave (emphasis added later):
hvxl wrote:Changes to the config file while OTmonitor is running are not automatically picked up. OTmonitor only reads the config file on startup. It may write the file at different times. So, to change the settings, shut down OTmonitor, modify the config file, then start OTmonitor again.
One of the times OTmonitor writes the config file is when it shuts down. So modifying the config file while OTmonitor is running won't work.
I can't confirm it's working this way as in my case when I restart orangepizero nothing is written to config file (e.g. roomcold value is set to 12 in the config, but I believe there is hardcoded value 14 in the otmonitor and it's not written to the config during restart).
or it's because I'm using web app and not application itself?