Get room temperature using Monitor web-server command

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

Moderator: hvxl

Get room temperature using Monitor web-server command

Postby texnic » Tue May 01, 2018 12:30 am

I've started playing with the OTGW+OPiZ, and it works fine. I am using the command-method to send commands to OTGW, e.g.

Code: Select all
192.168.1.25:8080/command?TC=21


sends the room temperature set point of 21 degree. In the "status" web-page, I can see that the "Remote override room setpoint" changes quickly after submitting this command, "Room setpoint" follows shortly after that, and "Room temperature" and other parameters follow as the thermostat and the house begin responding.

Is there a similar method to determine the room set point and the room temperature?

I can send PS=1, then browse to Messages and see the data as a one-liner described at http://otgw.tclcode.com/firmware.html. But how can I retrieve this one liner in a programmatic way? Or is there a better way to obtain these two values? Sorry about a dummy question perhaps.
texnic
Starting Member
Starting Member
 
Posts: 15
Joined: April 2016

Re: Get room temperature using Monitor web-server command

Postby hvxl » Tue May 01, 2018 9:06 pm

As you may know, you can add your own web pages by putting them in a directory called html next to the otminitor binary. Then the simplest method that comes to mind is to configure the datafile to be written there. For example, if the path to your otmonitor program is /home/texnic/otgw/otmonitor, configure the datafile as /home/texnic/otgw/html/otdata.txt. That file is then periodically updated and you can retrieve it via http://192.168.1.25:8080/otdata.txt

If you need more control over the layout, or you always want the most up-to-date information, you can also create a .tmpl file in the same directory.

Example: make a file called otdata.json.tmpl with the following contents:
Code: Select all
% global gui
{
    "setpoint": [get gui(setpoint) 0],
    "boilertemp": [get gui(boilertemp) 0],
    "returntemp": [get gui(returntemp) 0],
    "controlsp": [get gui(controlsp) 0]
}
Then access that as http://192.168.1.25:8080/otdata.json

Producing json is just an example. With some small modifications, you can also represent the data as xml, csv, txt, or other formats.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1081
Joined: June 2010

Re: Get room temperature using Monitor web-server command

Postby texnic » Sun May 13, 2018 11:21 am

Schelte, thanks a lot! The TMPL-based solution is nice. Two questions:

  • This TMPL-based method—can I read about it somewhere?
  • Can I find the complete list of available commands anywhere?
texnic
Starting Member
Starting Member
 
Posts: 15
Joined: April 2016

Re: Get room temperature using Monitor web-server command

Postby hvxl » Mon May 14, 2018 8:44 pm

Templates are a feature of wibble, the web server I'm using in OTmonitor. The feature is based on Templates and subst. You can use any Tcl command in a template, including ones that were defined in the application, like get in the code above. The get command is just a simple helper that returns the value of a variable if it exists, and a default value otherwise.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1081
Joined: June 2010

Re: Get room temperature using Monitor web-server command

Postby texnic » Wed May 16, 2018 4:53 pm

hvxl wrote:You can use any Tcl command in a template, including ones that were defined in the application...


OK, then apparently I should have asked: where can I find the list of defined variables? I mean, you used setpoint, boilertemp, returntemp, controlsp. How would I know the name for a variable for room temperature, for example?
texnic
Starting Member
Starting Member
 
Posts: 15
Joined: April 2016

Re: Get room temperature using Monitor web-server command

Postby hvxl » Wed May 16, 2018 10:19 pm

Oh, that list can be found in otmonitor.vfs/otmonitor.tcl in the otmonitor sources. Here it is for your reference:
Code: Select all
    airpresfault        "Air pressure fault"
    boilertemp          "Boiler water temperature"
    ch2enable           "Central heating 2 enable"
    ch2mode             "Central heating 2 mode"
    chenable            "Central heating enable"
    chmode              "Central heating mode"
    chwsetpoint         "Central heating setpoint"
    pressure            "CH water pressure"
    controlsp           "Control setpoint"
    coolingenable       "Cooling enable"
    coolingstatus       "Cooling status"
    diag                "Diagnostic indication"
    dhwenable           "Domestic hot water enable"
    dhwmode             "Domestic hot water mode"
    dhwsetpoint         "Domestic hot water setpoint"
    dhwtemp             "Domestic hot water temp"
    fault               "Fault indication"
    flame               "Flame"
    flamefault          "Gas/flame fault"
    lockoutreset        "Lockout-reset"
    lowpressure         "Low water pressure"
    maxmod              "Max rel modulation level"
    modulation          "Modulation"
    faultcode           "OEM fault/error code"
    otcstate            "Outside temp compensation"
    outside             "Outside temperature"
    override            "Rem override room setpoint"
    returntemp          "Return water temperature"
    setpoint            "Room setpoint"
    temperature         "Room temperature"
    service             "Service request"
    timestamp           "Time stamp"
    overtemp            "Water over-temperature"

Note: This is the list from OTmonitor 4.3 as published on my web site. I have renamed "temperature" to "roomtemp" in the latest sources available on github. Considering this thread, that may not have been such a good idea.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1081
Joined: June 2010

Re: Get room temperature using Monitor web-server command

Postby texnic » Mon May 21, 2018 9:14 pm

Thanks! I think it was a good idea to rename "temperature" to "roomtemp", to make it unambiguous. For now, let's just remember that it can be both. In my code, I'll implement both versions, for compatibility with both versions of your code.
texnic
Starting Member
Starting Member
 
Posts: 15
Joined: April 2016


Return to Opentherm Gateway Forum

Who is online

Users browsing this forum: No registered users and 1 guest