Opentherm Monitor - Custom web pages

This Forum is about the Opentherm gateway (OTG) from Schelte

Moderator: hvxl

Opentherm Monitor - Custom web pages

Postby DieterKoblenz » Sun Dec 21, 2014 12:05 pm

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?
DieterKoblenz
Starting Member
Starting Member
 
Posts: 7
Joined: March 2014

Re: Opentherm Monitor - Custom web pages

Postby DieterKoblenz » Mon Dec 22, 2014 12:20 pm

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.
DieterKoblenz
Starting Member
Starting Member
 
Posts: 7
Joined: March 2014

Re: Opentherm Monitor - Custom web pages

Postby hvxl » Mon Dec 22, 2014 8:53 pm

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
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1223
Joined: June 2010

Re: Opentherm Monitor - Custom web pages

Postby hvxl » Mon Dec 22, 2014 9:48 pm

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:

Code: Select all
% global gui
<table>
% foreach n [lsort -dictionary [array names gui]] {
<tr><td>$n</td><td>$gui($n)</td></tr>
% }
</table>

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.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1223
Joined: June 2010

Re: Opentherm Monitor - Custom web pages

Postby DieterKoblenz » Mon Dec 22, 2014 11:01 pm

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?
DieterKoblenz
Starting Member
Starting Member
 
Posts: 7
Joined: March 2014

Re: Opentherm Monitor - Custom web pages

Postby hvxl » Mon Dec 22, 2014 11:20 pm

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
hvxl
Senior Member
Senior Member
 
Posts: 1223
Joined: June 2010

Re: Opentherm Monitor - Custom web pages

Postby DieterKoblenz » Tue Dec 23, 2014 12:28 am

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.
DieterKoblenz
Starting Member
Starting Member
 
Posts: 7
Joined: March 2014

Re: Opentherm Monitor - Custom web pages

Postby yjb » Tue Dec 23, 2014 9:17 am

And one is not even bound to the standard naming and location (~/.otmonitorrc) I'm using:

Code: Select all
/opt/opentherm//otmonitor --daemon -f /opt/opentherm/otmonitor.conf


I'm not using all the entries in the config file; this is my config file (to get you going):

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
}
yjb
Member
Member
 
Posts: 189
Joined: April 2009
Location: Venhuizen, Netherlands

Re: Opentherm Monitor - Custom web pages

Postby Ghostbird » Thu Mar 12, 2015 8:40 pm

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:
Code: Select all
otmonitor --daemon --system -f /opt/otmonitor/otmonitor.conf /dev/ttyAMA0 &

The authentication information is in /opt/otmonitor/auth

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


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)
Last edited by Ghostbird on Fri Mar 13, 2015 2:22 pm, edited 1 time in total.
Ghostbird
Starting Member
Starting Member
 
Posts: 14
Joined: March 2015

Re: Opentherm Monitor - Custom web pages

Postby Ghostbird » Thu Mar 12, 2015 10:05 pm

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.
Ghostbird
Starting Member
Starting Member
 
Posts: 14
Joined: March 2015

Re: Opentherm Monitor - Custom web pages

Postby hvxl » Fri Mar 13, 2015 8:57 pm

Ghostbird wrote:It is a shame the web interface doesn't offer all the GUI options.

I'd be happy to include any code you contribute to fill the gaps.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1223
Joined: June 2010

Re: Opentherm Monitor - Custom web pages

Postby hvxl » Fri Mar 13, 2015 9:03 pm

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.

Where is the otmonitor binary located? The program looks for the auth db relative to its own location, not relative to the configuration file.

The HTTPS connection problem may be the same discussed in another topic.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1223
Joined: June 2010

Re: Opentherm Monitor - Custom web pages

Postby Ghostbird » Sun Mar 15, 2015 4:11 pm

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.
Ghostbird
Starting Member
Starting Member
 
Posts: 14
Joined: March 2015

Re: Opentherm Monitor - Custom web pages

Postby hvxl » Sun Mar 15, 2015 6:08 pm

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.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1223
Joined: June 2010

Re: Opentherm Monitor - Custom web pages

Postby Ghostbird » Sun Mar 15, 2015 6:12 pm

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.
Ghostbird
Starting Member
Starting Member
 
Posts: 14
Joined: March 2015

Next

Return to Opentherm Gateway Forum

Who is online

Users browsing this forum: No registered users and 1 guest