How does the IP-brain webserver work.

Pop your questions regarding Home automation software here.....

How does the IP-brain webserver work.

Postby heubie » Thu Nov 28, 2013 3:22 pm

I don't know if this is the wright forum, if not please let me know so I can correct it.

Is there somebody who can explain how the webserver works that is in my thermostat zone-controller.
When I open the webpage it lets me see an controle some values of a specific thermostat.

I looked at the source code of the page an I think I understand for 90% how it works.
The problem is how the variable values are derived from the firmware and how they are put back.

Take for example this part in the source. The 15.5 is simply text here. There is no variable or script to read its value.... where does it come from.

<div id="cur_temp" style="display: block;">
<label>Kamertemperatuur: </label>
15.5 ℃
<input id="curtemp" type="button" onclick="javascript:location.reload();" value="Refresh" name="curtemp">
</div>


Could anybody explain me how it works and if it is possible to use the values in my own webpage on the homeserver.
I put the whole source code of the page below.

Regs.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width; initial-scale=1; minimum-scale=1.0; maximum-scale=2.0"/>
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="cleartype" content="on">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<title></title>
<link rel="stylesheet" type="text/css" href="s.css" media="all" />
<script language="JavaScript" type="text/JavaScript">

function setCookie(name,value)
{
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

function getCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}

function delCookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

</script>
</head>
<script language="JavaScript">
setCookie("uLang", 2);
</script>
<body>
<div id="page">

<div style="padding:0 0 5px 5px"></div>
<div id="title"></div>
<form name="update_r" method="POST" style="display:inline">
<hr>
<div>
<input type="hidden" name="room" value="3">
<input type="button" id="room0" value="Ruimte1" onclick="update_r.room.value = 0; update_r.submit();" />
<input type="button" id="room1" value="Ruimte2" onclick="update_r.room.value = 1; update_r.submit();" />
<input type="button" id="room2" value="Ruimte3" onclick="update_r.room.value = 2; update_r.submit();" />
<input type="button" id="room3" value="Ruimte4" onclick="update_r.room.value = 3; update_r.submit();" disabled />
<br />
<input type="button" id="room4" value="Ruimte5" onclick="update_r.room.value = 4; update_r.submit();" />
<input type="button" id="room5" value="Ruimte6" onclick="update_r.room.value = 5; update_r.submit();" />
<input type="button" id="room6" value="Ruimte7" onclick="update_r.room.value = 6; update_r.submit();" />
<input type="button" id="room7" value="Ruimte8" onclick="update_r.room.value = 7; update_r.submit();" disabled />
<br />
<input type="button" id="AllRoom" value="Alle ruimtes" onclick="update_r.room.value = 'A'; update_r.submit();" />
</div>
</form>
<form name="update_v0" method="POST" style="display:inline">
<hr>
<div id="cur_room" style="display:none"> <label>Huidig: Ruimte 4 </label></div>
<div id="all_room" style="display:none"> <label>Huidig: Alle ruimtes </label></div>
<div id="cur_temp" style="display:none"> <label>Kamertemperatuur: </label> 16.5 ℃ <input type="button" id="curtemp" name="curtemp" value="Refresh" onclick="javascript:location.reload();"/>
</div>
<hr>
<div><label>Ingesteld: </label> <input type="text" id="settemp" name="settemp" value="" size="3"/> ℃
<input type="button" name="add" value="+" onclick="javascript:stemp += 0.5; update_v0.settemp.value = stemp; update_v0.submit();"/>
<input type="button" name="sub" value="-" onclick="javascript:stemp -= 0.5; update_v0.settemp.value = stemp; update_v0.submit();" />
<input type="submit" name="set" value="OK" />
</div>
</form>
<form name="update_v1" method="POST" style="display:inline">
<hr>
<div><label>Modus:</label><br />
<input type="radio" name="cmode" value="0" onclick="javascript:update_v1.submit();" /> Comfort <br />
<input type="radio" name="cmode" value="1" onclick="javascript:update_v1.submit();" /> Economisch <br />
<!-- <input type="radio" name="cmode" value="2" onclick="javascript:update_v1.submit();" /> Party <br /> -->
<input type="radio" name="cmode" value="3" onclick="javascript:update_v1.submit();" /> Bespaar stand<br />
<input type="radio" name="cmode" value="4" onclick="javascript:update_v1.submit();" checked /> Auto
</div>
<hr>
<div><label>Aan/Uit </label><br />
<input type="radio" name="onoff" value="0" onclick="javascript:update_v1.submit();" /> Uit <br />
<input type="radio" name="onoff" value="1" onclick="javascript:update_v1.submit();" checked /> Aan <br />
</div>
<hr>
<div><label>|<a href="eindex.htm" >English</a>| |<a href="dindex.htm" >Nederlands</a>| |<a href="findex.htm" >français</a>| |<a href="gindex.htm" >Deutsch </a>| |<a href="cindex.htm" >中文</a> <br>
|<a href="dv.htm">|Configuration|</a> </label></div>
</form>
<div id="footer"> <br > </div>
<noscript>Not Support JavaScript!</noscript>
</div>

<script language="javascript">
var stemp;

stemp = 14.0;
update_v0.settemp.value = stemp;
if (update_r.room.value != 255) {
document.getElementById('cur_room').style.display = "block";
document.getElementById('cur_temp').style.display = "block";
}
else {
document.getElementById('all_room').style.display = "block";
}
</script>


</body>
</html>
heubie
Starting Member
Starting Member
 
Posts: 25
Joined: December 2006
Location: Netherlands

Re: How does the IP-brain webserver work.

Postby mlommers » Thu Nov 28, 2013 4:13 pm

By scraping the webpage it should be possible to use this value in other systems, you could probably use xpatch to query for the right value.

The webserver itself is probably serving you a dynamic page. The webserver is retrieving/requesting the value to show on the page from the system internally, you cannot see how this works by looking at the source code of the website deliverd to the customer (which you are showing here). I won't expect you can get this value via the webinterface unless they are serving an api like a REST api or something.
mlommers
Starting Member
Starting Member
 
Posts: 16
Joined: July 2010

Re: How does the IP-brain webserver work.

Postby heubie » Thu Nov 28, 2013 5:32 pm

Thanks for the quick reply. Do I understand correct that the firmware is creating a html file with the wright value as a text?

But than there is the second part which I don't understand. How does the software know what value I put in if there is no script where the input value (like settemp or cmode) is written to de device.
And if there is some sort of a script it must be possible to write my own webpage on my homeserver that writes this value.
heubie
Starting Member
Starting Member
 
Posts: 25
Joined: December 2006
Location: Netherlands


Return to Questions & Discussions Forum

Who is online

Users browsing this forum: No registered users and 1 guest