2 * intres - intelligent reside
4 * author: hackbard@hackdaworld.org
16 $('#thermo').click(function() {
17 thermo.draw_thermos();
23 get_thermos: function() {
24 xhr("POST","cgi-bin/fhemwrapper","list",
27 var thermos=ret.match(/\ \ MAX_[0-9,a-f]{6}\ /g);
28 thermo.get_thermo_details(thermos);
32 get_thermo_details: function(thermos) {
33 for(var th in thermos) {
36 xhr("POST","cgi-bin/fhemwrapper","list "+id,
38 var id=ret.match(/NAME.*/)+'';
39 id=id.replace(/NAME\s+/,"");
40 var alias=ret.match(/alias.*/)+'';
41 alias=alias.replace(/alias\s+/,"");
42 var state=ret.match(/STATE.*/)+'';
43 state=state.replace(/STATE\s+/,"");
44 var eco=ret.match(/ecoTemperature.*/)+'';
45 eco=eco.replace(/.*ecoTemperature\s+/,"");
46 var comfort=ret.match(/comfortTem.*/)+'';
47 comfort=comfort.replace(/.*comfortTem.*\s+/,"");
48 thermo.thermos[id]={};
49 thermo.thermos[id].alias=alias;
50 thermo.thermos[id].state=state;
51 thermo.thermos[id].eco=eco;
52 thermo.thermos[id].comfort=comfort;
53 thermo.draw_thermos();
57 draw_thermo: function(alias,name,state,eco,comfort,type) {
58 var html="<div class=thermo>";
61 html+="<div class=thermoalias>"+alias+"</div>";
62 html+="<div class=thermoname>"+name+"</div>";
63 html+="<div class=thermostate>"+state+"</div>";
64 html+="<div class=thermoeco>"+eco+"</div>";
65 html+="<div class=thermocomfort>"+comfort+"</div>";
68 html+="<div class=thermoalias><b>"+alias+"</b></div>";
69 html+="<div class=thermoname><b>"+name+"</b></div>";
70 html+="<div class=thermostate><b>"+state+"</b></div>";
71 html+="<div class=thermoeco><b>"+eco+"</b></div>";
72 html+="<div class=thermocomfort><b>"+comfort+
79 draw_thermos: function() {
80 var html=thermo.draw_thermo('Alias','Name','State',
82 for(var i in thermo.thermos) {
83 var th=thermo.thermos[i];
84 html+=thermo.draw_thermo(th.alias,i,th.state,
85 th.eco,th.comfort,'d');
87 $('div#thermobody').html(html);
93 $('#cmdout').css('display','none');
94 $('#cmdin').keydown(function(key) {
100 var cmdline=$('#cmdin').val();
101 xhr("POST","cgi-bin/fhemwrapper",cmdline,function(ret) {
102 $('#cmdout').css('display','block');
103 $('#cmdouttxt').val(ret);
111 document.addEventListener('deviceready',intres.startup,false);
113 startup: function() {
123 $(document).ready(function() {
124 if(Modernizr.hasEvent('deviceready')) {