Page 1 of 1

OTG with own application

Posted: Mon Nov 09, 2015 10:54 am
by Jeroen001
I use the OTG with the OT Monitor program running on a Raspberry.

Is it possible to get the current values (e.g. room temperature) and to send commands (e.g. room temparature up 1 degree) by (http) commands from an other application?
Does the OTG support an API?

Regards, Jeroen.

Re: OTG with own application

Posted: Mon Nov 09, 2015 5:19 pm
by mike7
Check http://<your gw ip>:8080/userpages.html

Re: OTG with own application

Posted: Mon Nov 09, 2015 9:26 pm
by ThinkPad
mike7 wrote:Check http://<your gw ip>:8080/userpages.html
That's cool! The command function is really great! I can now easily override the setpoint of my thermostat with a simple HTTP-request.

But..... what about the 'PS=1' command? That doesn't show any output in the browser, just the PS=1 command is shown. Would be great if the output of the PS=1 command would also return output in the browser. Retrieving the OTGW-data is much easier then, for example with a PHP-script running on a webserver on a different machine.

Re: OTG with own application

Posted: Mon Nov 09, 2015 10:36 pm
by mike7
I don't use PS=1

Schelte provides support fot OTGW and monitor in another forum http://www.domoticaforum.eu/viewforum.php?f=75

Re: OTG with own application

Posted: Mon Nov 09, 2015 10:42 pm
by ThinkPad
I have opened an own topic about the PS=1 webpage output: http://www.domoticaforum.eu/viewtopic.php?f=75&t=10862

Re: OTG with own application

Posted: Fri Nov 20, 2015 2:13 pm
by Jeroen001
Great. Thanks for the info.

Re: OTG with own application

Posted: Fri Nov 20, 2015 11:09 pm
by Jeroen001
Ok. I get the JSON information from OTG with the following LUA code:

local IP = "xxx.xxx.xxx.xx"
local Port = "8080"

OpenTherm = Net.FHttp(IP,Port)
response = OpenTherm:GET("/json")
fibaro:debug(response)

The response is: { "otgw": { "time": "2015-11-20 22:06:18 +0100", "firmware": { "name": "Opentherm Gateway", "version": "4.2.3" }, "software": { "name": "Opentherm Monitor", "version": "4.2" } }, "flame": { "value": "0", "description": "Flame status" }, "dhwmode": { "value": "0", "description": "Domestic hot water mode" }, "chmode": { "value": "1", "description": "Central heating mode" }, "dhwenable": { "value": "1", "description": "Domestic hot water enable" }, "diag": { "value": "0", "description": "Diagnostic indication" }, "fault": { "value": "0", "description": "Fault indication" }, "temperature": { "value": "20.38", "description": "Room temperature" }, "setpoint": { "value": "20.50", "description": "Room setpoint" }, "modulation": { "value": "0.00", "description": "Relative modulation level" }, "boilertemp": { "value": "62.59", "description": "Boiler water temperature" }, "controlsp": { "value": "36.40", "description": "Control setpoint" }, "maxmod": { "value": "100.00", "description": "Max relative modulation level" } }

How do I get the current room temperature value in a variable (20.38 degrees)?

I tried the following code:

jsonTable = json.decode(response)
kamerTemp = jsonTable.temperature
fibaro:debug(kamerTemp)

Then I get an error: [ERROR] 22:08:04: line :debug (arg 2), expected 'string const &' got 'nil'