Opentherm Monitor - Custom web pages
Moderator: hvxl
-
- Starting Member
- Posts: 7
- Joined: Sun Mar 16, 2014 9:13 pm
Opentherm Monitor - Custom web pages
Hi there,
Has anyone here made some custom pages for the opentherm monitor system? When I make a new html page in the html subdir, it will only display the text. Is there someone who could help me design or change the "iphone" webpage to support cancelling temperature override and enable/disable hot water function when I am not at home?
Has anyone here made some custom pages for the opentherm monitor system? When I make a new html page in the html subdir, it will only display the text. Is there someone who could help me design or change the "iphone" webpage to support cancelling temperature override and enable/disable hot water function when I am not at home?
-
- Starting Member
- Posts: 7
- Joined: Sun Mar 16, 2014 9:13 pm
Re: Opentherm Monitor - Custom web pages
And I have another question, I am running the monitor now on a Raspberry Pi. I can not start in gui mode, is it possible to make a config file and use that to run the daemon? I need at least a way to configure passworded access so that I can forward the port from my router.
Re: Opentherm Monitor - Custom web pages
In daemon mode, OTmonitor will use the config file that was created in GUI mode. However, that's not where user names and passwords for web access are stored. Those are in a sqlite3 database called auth/auth.db. You can create it with otmonitor running on another computer and copy it to the Raspberry Pi.
It's also possible to add user accounts via dbus:
dbus-send --print-reply --dest=com.tclcode.otmonitor /Security com.tclcode.otmonitor.AddUser :user :password
It's also possible to add user accounts via dbus:
dbus-send --print-reply --dest=com.tclcode.otmonitor /Security com.tclcode.otmonitor.AddUser :user :password
Schelte
Re: Opentherm Monitor - Custom web pages
Dynamic web pages must have a .tmpl extension in addition to the normal extension that indicates the content type. So, for a dynamic html page you would create a file called something like html/page.html.tmpl
Any lines in the file prefixed with % are executed as Tcl code. Other lines are sent to the browser after substituting Tcl variables and commands. The most interesting values are all stored in the global gui array. So the following code in a file called html/dump.html.tmpl would show all of those values when you access http://*.*.*.*:*/dump.html:
Via the websocket (defined in iphone.js) you can send the commands 'Up', 'Down', and 'Prog'. The red arrow currently sends 'Up', the blue arrow sends 'Down', and 'Prog' would need to be sent by whatever button you are going to add to your copy of the iphone.html.tmpl file to cancel the temperature override. You will have to name the file differently because built-in pages take precedence over pages with the same name in the html directory.
To enable/disable hot water function you would need to submit the appropriate serial command via a POST action. See print.html.tmpl for an example of how to do that.
Any lines in the file prefixed with % are executed as Tcl code. Other lines are sent to the browser after substituting Tcl variables and commands. The most interesting values are all stored in the global gui array. So the following code in a file called html/dump.html.tmpl would show all of those values when you access http://*.*.*.*:*/dump.html:
Code: Select all
% global gui
<table>
% foreach n [lsort -dictionary [array names gui]] {
<tr><td>$n</td><td>$gui($n)</td></tr>
% }
</table>
To enable/disable hot water function you would need to submit the appropriate serial command via a POST action. See print.html.tmpl for an example of how to do that.
Schelte
-
- Starting Member
- Posts: 7
- Joined: Sun Mar 16, 2014 9:13 pm
Re: Opentherm Monitor - Custom web pages
Thank you very much for your help!
Where is the config file from the gui located? So if I copy that config file and the auth database to the raspberry I can set it up on my windows machine and start it in daemon mode on my Pi?
Where is the config file from the gui located? So if I copy that config file and the auth database to the raspberry I can set it up on my windows machine and start it in daemon mode on my Pi?
Re: Opentherm Monitor - Custom web pages
On a Raspberry Pi the default config file is ~/.otmonitorrc. On windows the settings are normally stored in the registry, but you can use a config file by specifying it with the -f option. In theory that should work, although I have never actually tried it.
Schelte
-
- Starting Member
- Posts: 7
- Joined: Sun Mar 16, 2014 9:13 pm
Re: Opentherm Monitor - Custom web pages
Currently I am running it like this: ./otmonitor-ahf --webserver=7000 --daemon 192.168.178.20:101
However it doesn't seem to generate any config file, also not when I try to close it.
However it doesn't seem to generate any config file, also not when I try to close it.
Re: Opentherm Monitor - Custom web pages
And one is not even bound to the standard naming and location (~/.otmonitorrc) I'm using:
I'm not using all the entries in the config file; this is my config file (to get you going):
Code: Select all
/opt/opentherm//otmonitor --daemon -f /opt/opentherm/otmonitor.conf
Code: Select all
cat /opt/opentherm/otmonitor.conf
datalog {
append true
file /tmp/otmonitor-data.txt
enable true
interval 30000
itemlist {
flame
dhwmode
chmode
dhwenable
diag
fault
outside
temperature
setpoint
modulation
boilertemp
returntemp
controlsp
dhwsetpoint
chwsetpoint
timestamp
}
}
clock {
year false
date false
auto false
}
sms {
enable false
ventilationfault false
phonenumber {}
route {}
sender {}
provider VoipPlanet
password c2VjcmV0
account {}
solarfault false
roomcold true
watchdogtimer false
boilerfault true
commproblem false
}
email {
password c2VjcmV0
server {}
roomcold true
boilerfault true
watchdogtimer true
solarfault true
commproblem true
port 25
enable false
secure TLS
recipient {}
user {}
sender {}
ventilationfault true
}
logfile {
pattern otlog-%Y%m%d.txt
directory /tmp/
enable true
}
web {
theme purple
enable true
port 8089
sslport 8090
nopass false
certonly false
}
connection {
device {}
type tcp
port 1001
host 192.168.0.62
enable true
}
server {
enable true
port 7686
relay true
}
view {
tab graph
order increasing
sort name
bitflags false
}
mqtt {
devicetype central_heating
deviceid otmonitor
retransmit 10
format json2
port 1883
qos 1
keepalive 120
username {}
password {}
enable false
messages false
client sandbox-otmon
broker localhost
}
Re: Opentherm Monitor - Custom web pages
I'm running the otmonitor as a daemon on a raspberry pi (ARMHF), but for some reason it does not seem to use the auth db.
I've pointed it to the correct config file.
However whenever I try to login to the web interface the username and password are rejected.
I even read the password hash from the auth.db file, and compared it to a manual hash of the password, which matched.
Any idea what may be wrong?
The otmonitor is started from rc.local with the line:
The authentication information is in /opt/otmonitor/auth
When I try to connect trough HTTPS I cannot connect and my SSH session displays:
Note: For security both HTTP and HTTPS are local connections forwarded trough SSH
Ports used are 80 and 443 (standard HTTP and HTTPS ports) this is of course possible because the otmonitor is started by the system (which has access to port numbers below 1024)
I've pointed it to the correct config file.
However whenever I try to login to the web interface the username and password are rejected.
I even read the password hash from the auth.db file, and compared it to a manual hash of the password, which matched.
Any idea what may be wrong?
The otmonitor is started from rc.local with the line:
Code: Select all
otmonitor --daemon --system -f /opt/otmonitor/otmonitor.conf /dev/ttyAMA0 &
When I try to connect trough HTTPS I cannot connect and my SSH session displays:
Code: Select all
channel 7: open failed: connect failed: Connection refused
Ports used are 80 and 443 (standard HTTP and HTTPS ports) this is of course possible because the otmonitor is started by the system (which has access to port numbers below 1024)
Last edited by Ghostbird on Fri Mar 13, 2015 3:22 pm, edited 1 time in total.
Re: Opentherm Monitor - Custom web pages
EDIT: Sorry for the double post, but I had a new account, and the previous post had not been approved yet. Then I reread this thread and forgot that I had already posted and said this:
I had the same issue, I solved it by installing and running xorg server on the pi, then using X11 forwarding in the SSH session. Though I don't know how that will work if you're using Windows to connect. I run Debian on my local machine. Then you can just start the otmonitor program with GUI and the GUI will open on your local display as if it were running on your machine instead of the raspberry pi. Though it will probably be very slow if you're not on a LAN connection (I had a rather unstable connection and it was ridiculously slow).
It is a shame the web interface doesn't offer all the GUI options.
I had the same issue, I solved it by installing and running xorg server on the pi, then using X11 forwarding in the SSH session. Though I don't know how that will work if you're using Windows to connect. I run Debian on my local machine. Then you can just start the otmonitor program with GUI and the GUI will open on your local display as if it were running on your machine instead of the raspberry pi. Though it will probably be very slow if you're not on a LAN connection (I had a rather unstable connection and it was ridiculously slow).
It is a shame the web interface doesn't offer all the GUI options.
Re: Opentherm Monitor - Custom web pages
I'd be happy to include any code you contribute to fill the gaps.Ghostbird wrote:It is a shame the web interface doesn't offer all the GUI options.
Schelte
Re: Opentherm Monitor - Custom web pages
Where is the otmonitor binary located? The program looks for the auth db relative to its own location, not relative to the configuration file.Ghostbird wrote:I'm running the otmonitor as a daemon on a raspberry pi (ARMHF), but for some reason it does not seem to use the auth db.
The HTTPS connection problem may be the same discussed in another topic.
Schelte
Re: Opentherm Monitor - Custom web pages
Ah, that's unfortunate. I'll have to install the otmonitor in /opt then. I hadn't given much thought to it and installed it in /usr/bin as a normal *nix application, but I should've known that it was slightly different because it was designed multi-platform.
Thanks for the answer I think I'll be able to solve my issues with this.
Thanks for the answer I think I'll be able to solve my issues with this.
Re: Opentherm Monitor - Custom web pages
The reason it works this way is not because the application was designed multi-platform, it's just a choice I made. Under normal conditions the configuration file is ~/.otmonitorrc. Storing data relative to that would put it in the home directory, which I think is undesirable.
However, you can make a symbolic link from /usr/bin to the binary under /opt and things should still work. The program is found via your normal PATH, but the data is located under /opt.
However, you can make a symbolic link from /usr/bin to the binary under /opt and things should still work. The program is found via your normal PATH, but the data is located under /opt.
Schelte
Re: Opentherm Monitor - Custom web pages
I understand, and I would have made the symbolic link if this was an application that I called from multiple locations. At the moment I'm trying to get it properly configured and secure, which is proving to be elusive, but I will get there. So far I have it either secure, but not connected to the Gateway or connected to the gateway but not sufficiently secure.