Variable Update in Climate.html

Discussions about Mainlobby running on Apple mobile devices.
ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Variable Update in Climate.html

Postby ricks » Sat Sep 25, 2010 5:13 pm

Dave,

Moved my issue to a new post since Riley has moved on to the media page. Don't want to confuse the two.

I've included my script below. Changes I've made are to the variables for hai and the buttons. I've also added the outdoor temp to the right side of the top bar.

Thanks,
Rick


Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="images/MainLobby.png" rel="apple-touch-icon" />
<link href="css/styles.css" rel="stylesheet" media="screen" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
<script src="javascript/iPhone.js" type="text/javascript"></script>
<title>Climate</title>
<script>
   function StartupMacro() {
      var zNum = "{{CurrentTempZone}}";
      if (zNum == "") {
         zNum = "1";
      }
      Zone(zNum);
   }

   function Zone(zNum) {
      doCommand("SetVariableFast|CurrentTempZone~" + zNum);
      switch(zNum)
      {
         case '':
            document.getElementById('__Zone1').style.visibility='visible';
            document.getElementById('__Zone2').style.visibility='hidden';
            document.getElementById('__Zone3').style.visibility='hidden';
            break;
         case '1':
            document.getElementById('__Zone1').style.visibility='visible';
            document.getElementById('__Zone2').style.visibility='hidden';
            document.getElementById('__Zone3').style.visibility='hidden';
            break;
         case '2':
            document.getElementById('__Zone1').style.visibility='hidden';
            document.getElementById('__Zone2').style.visibility='visible';
            document.getElementById('__Zone3').style.visibility='hidden';
            break;
         case '3':
            document.getElementById('__Zone1').style.visibility='hidden';
            document.getElementById('__Zone2').style.visibility='hidden';
            document.getElementById('__Zone3').style.visibility='visible';
            break;
      }
   document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
   }
</script>
</head>

<body>
<div id="topbar" class="black">
   <div id="blueleftbutton"><a href="Index.html">Home</a></div>
   <div id="title">CLIMATE</span></div>
   <div id="title"><div align="right" class="style3"><span id="hai_outdoortempfround">{{hai_outdoortempfround}}° F</span></div>
</div>
   
    <div align="center"><span id="__Zone1" style="visibility:hidden;">
      <span style="z-index:2; position:absolute; left:120px; top:50px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat001_name">{{hai_thermostat001_name}}</span>
      <span style="z-index:2; position:absolute; left:75px; top:50px;font:normal 75px/110px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat001_tstat}}_tempfround°F">{{hai_thermostat001_tempfround}}°F</span>
      <span style="z-index:2; position:absolute; left:53px; top:235px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat001_coolsetpointfround">{{hai_thermostat001_coolsetpointfround}}</span>
      <span style="z-index:2; position:absolute; left:250px; top:235px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat001_heatsetpointfround">{{hai_thermostat001_heatsetpointfround}}</span>
      <span style="z-index:2; position:absolute; left:135px; top:220px;font:normal 32px/40px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat001_systemmode">{{hai_thermostat001_systemmode}}</span>
      </span>
     
        <span id="__Zone2" style="visibility:hidden;">
            <span style="z-index:2; position:absolute; left:110px; top:50px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat002_name">{{hai_thermostat002_name}}</span>
            <span style="z-index:2; position:absolute; left:75px; top:50px;font:normal 75px/110px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat002_tempfround°F">{{hai_thermostat002_tempfround}}°F</span>
            <span style="z-index:2; position:absolute; left:53px; top:235px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat002_coolsetpointfround">{{hai_thermostat002_coolsetpointfround}}</span>
            <span style="z-index:2; position:absolute; left:250px; top:235px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat002_heatsetpointfround">{{hai_thermostat002_heatsetpointfround}}</span>
            <span style="z-index:2; position:absolute; left:135px; top:220px;font:normal 32px/40px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat002_systemmode">{{hai_thermostat002_systemmode}}</span>
        </span>
        <span id="__Zone3" style="visibility:hidden;">
            <span style="z-index:2; position:absolute; left:100px; top:50px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat003_name">{{hai_thermostat003_name}}</span>
            <span style="z-index:2; position:absolute; left:75px; top:50px;font:normal 75px/110px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat003_tempfround°F">{{hai_thermostat003_tempfround}}°F</span>
            <span style="z-index:2; position:absolute; left:53px; top:235px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat003_coolsetpointfround">{{hai_thermostat003_coolsetpointfround}}</span>
            <span style="z-index:2; position:absolute; left:250px; top:235px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat003_heatsetpointfround">{{hai_thermostat003_heatsetpointfround}}</span>
            <span style="z-index:2; position:absolute; left:135px; top:220px;font:normal 32px/40px Helvetica;color:rgba(255, 255, 255, 1.0);" id="hai_thermostat003_systemmode">{{hai_thermostat003_systemmode}}</span>
        </span>
     
        <span style="z-index:2; position:absolute; left:45px; top:220px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);">Cool</span>
        <span style="z-index:2; position:absolute; left:243px; top:220px;font:normal 16px/20px Helvetica;color:rgba(255, 255, 255, 1.0);">Heat</span>
      
        <span onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~CoolF~Inc');" style="z-index:3; position:absolute; left:10px; top:150px;"><img src="images/c_up.png" border="0"></span>
        <span onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~CoolF~Dec');" style="z-index:3; position:absolute; left:10px; top:260px;"><img src="images/c_down.png" border="0"></span>
        <span onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~HeatF~Inc');" style="z-index:3; position:absolute; left:210px; top:150px;"><img src="images/c_Up.png" border="0"></span>
        <span onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~HeatF~Dec');" style="z-index:3; position:absolute; left:210px; top:260px;"><img src="images/c_down.png" border="0"></span>
     
    </div>
    <div onclick="Zone('1');" style="font:normal 14px/20px Helvetica;color:rgba(255, 255, 255, 1.0);text-align:center;position:absolute;top:360px;left:15px;width:80px;line-height:30px;height:30px;-webkit-border-image:url('images/navbuttonblue.png') 0 5 0 5;border-width:0 5px;-webkit-border-radius:6px;">BASEMENT</div>
<div onclick="Zone('2');" style="font:normal 14px/20px Helvetica;color:rgba(255, 255, 255, 1.0);text-align:center;position:absolute;top:360px;left:115px;width:80px;line-height:30px;height:30px;-webkit-border-image:url('images/navbuttonblue.png') 0 5 0 5;border-width:0 5px;-webkit-border-radius:6px;">FIRST</div>
<div onclick="Zone('3');" style="font:normal 14px/20px Helvetica;color:rgba(255, 255, 255, 1.0);text-align:center;position:absolute;top:360px;left:215px;width:80px;line-height:30px;height:30px;-webkit-border-image:url('images/navbuttonblue.png') 0 5 0 5;border-width:0 5px;-webkit-border-radius:6px;">SECOND</div>

<span id="tabbar" style="visibility:visible;">
   <img src="images/tabbar.png" style="z-index:100;position:absolute;top:412px;left:0px;" />
   <img onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~Mode~Off');" src="images/tEmpty.png" style="z-index:101;position:absolute;top:410px;left:0px;" />
   <span style="z-index:102;position:absolute;top:424px;left:0px;width:80px;height:20px;padding:0px;border:0px;margin:0px;overflow:hidden;text-overflow:clip;text-align:center;font:normal 20px/24px Helvetica;color:rgba(255, 255, 255, 1.0);">OFF</span>
   <img onclick="doCommand('MLHAI|001~TStat~{'+'{CurrentTempZone}'+'}~Mode~Heat');" src="images/tEmpty.png" style="z-index:101;position:absolute;top:410px;left:80px;" />
   <span style="z-index:102;position:absolute;top:424px;left:80px;width:80px;height:20px;padding:0px;border:0px;margin:0px;overflow:hidden;text-overflow:clip;text-align:center;font:normal 20px/24px Helvetica;color:rgba(255, 255, 255, 1.0);">HEAT</span>
   <img onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~Mode~Cool');" src="images/tEmpty.png" style="z-index:101;position:absolute;top:410px;left:160px;" />
   <span style="z-index:102;position:absolute;top:424px;left:160px;width:80px;height:20px;padding:0px;border:0px;margin:0px;overflow:hidden;text-overflow:clip;text-align:center;font:normal 20px/24px Helvetica;color:rgba(255, 255, 255, 1.0);">COOL</span>
   <img onclick="doCommand('MLHAI|001~Tstat~{'+'{CurrentTempZone}'+'}~Mode~Auto');" src="images/tEmpty.png" style="z-index:101;position:absolute;top:410px;left:240px;" />
   <span style="z-index:102;position:absolute;top:424px;left:240px;width:80px;height:20px;padding:0px;border:0px;margin:0px;overflow:hidden;text-overflow:clip;text-align:center;font:normal 20px/24px Helvetica;color:rgba(255, 255, 255, 1.0);">AUTO</span>
</span>

<script language="javascript">
   autoupdate = true;
   pagevars = getvars();
   StartupMacro();
   UpdateVariables();
</script>
</body>
</html>

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Re: Variable Update in Climate.html

Postby bigDvette » Sat Sep 25, 2010 5:28 pm

Don't your server variable ids have to start with ml__ not __

dave strips out the ml__ when he creates the list of vars.

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Re: Variable Update in Climate.html

Postby ricks » Sat Sep 25, 2010 6:53 pm

So my

id="hai_thermostat001_name"

variable should be

"ml__hai_thermostat001_name"?

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Re: Variable Update in Climate.html

Postby bigDvette » Sat Sep 25, 2010 9:06 pm

that is correct.


Return to “MainLobby on iPhone, iPod Touch”

Who is online

Users browsing this forum: No registered users and 1 guest