Get room temperature using Monitor web-server command

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

Moderator: hvxl

Post Reply
texnic
Starting Member
Starting Member
Posts: 19
Joined: Thu Apr 07, 2016 12:03 am

Get room temperature using Monitor web-server command

Post by texnic »

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.
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Get room temperature using Monitor web-server command

Post by hvxl »

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
texnic
Starting Member
Starting Member
Posts: 19
Joined: Thu Apr 07, 2016 12:03 am

Re: Get room temperature using Monitor web-server command

Post by texnic »

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?
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Get room temperature using Monitor web-server command

Post by hvxl »

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
texnic
Starting Member
Starting Member
Posts: 19
Joined: Thu Apr 07, 2016 12:03 am

Re: Get room temperature using Monitor web-server command

Post by texnic »

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?
hvxl
Senior Member
Senior Member
Posts: 1965
Joined: Sat Jun 05, 2010 11:59 am
Contact:

Re: Get room temperature using Monitor web-server command

Post by hvxl »

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
texnic
Starting Member
Starting Member
Posts: 19
Joined: Thu Apr 07, 2016 12:03 am

Re: Get room temperature using Monitor web-server command

Post by texnic »

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.
Post Reply

Return to “Opentherm Gateway Forum”