HAI control via iPhone help

Discussions about Mainlobby running on Apple mobile devices.
User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3143
Joined: Sun May 30, 2004 10:57 pm
Location: Mays Landing, NJ
Contact:

HAI control via iPhone help

Postby DaveB » Mon Feb 14, 2011 6:34 pm

I want to get the HAI keypad working via my iPhone. Is there any guideline anyplace to follow? I am assuming that the Security-Keypad.HTML file is actually the HAI keypad page, but I need a push in the correct direction to get it working. I seem to get response to all key presses, but no matter what code is entered, the agent receives the correct command with code 1234. Is 1234 hard codded rather than utilizing the buffer? I will also look more closely into the other thread here concerning keypad buffer.
Thanks!

Dave Bruner
:shock:

User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3143
Joined: Sun May 30, 2004 10:57 pm
Location: Mays Landing, NJ
Contact:

Re: HAI control via iPhone help

Postby DaveB » Mon Feb 14, 2011 8:51 pm

Ok, after looking at the other thread, I figured it out and have posted the code that works for me below.

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="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>Security-Keypad</title>
<script>
   document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
</script>
</head>

<body>
<div id="topbar" class="black">
<div id="blueleftbutton"><a href="Security.html">Security</a></div>
<div id="title">Mode:&nbsp;<span id="ml__hai_001_area001_areamode">{{hai_001_area001_areamode}}</span>&nbsp;<b><span id="ml__hai_001_keyboardbuffermasked" class="infotext">{{hai_001_keyboardbuffermasked}}</span></b></div>
</div>

<span id="security_icons">
<img onclick="doCommand('MLHAI|001~Keypress~1');" src="images\LtBlue\b1.png" style="z-index:3;position:absolute;top:60px;left:20px;" />
<img onclick="doCommand('MLHAI|001~Keypress~2');" src="images\LtBlue\b2.png" style="z-index:3;position:absolute;top:60px;left:90px;" />
<img onclick="doCommand('MLHAI|001~Keypress~3');" src="images\LtBlue\b3.png" style="z-index:3;position:absolute;top:60px;left:160px;" />
<img onclick="doCommand('Macro|MLHAI|001~Security~Away~All~{'+'{hai_001_keyboardbuffer}'+'}!MLHAI|001~Keypress~Clear');" src="images\LtBlue\bAway.png" style="z-index:3;position:absolute;top:60px;left:240px;" />

<img onclick="doCommand('MLHAI|001~Keypress~4');" src="images\LtBlue\b4.png" style="z-index:3;position:absolute;top:130px;left:20px;" />
<img onclick="doCommand('MLHAI|001~Keypress~5');" src="images\LtBlue\b5.png" style="z-index:3;position:absolute;top:130px;left:90px;" />
<img onclick="doCommand('MLHAI|001~Keypress~6');" src="images\LtBlue\b6.png" style="z-index:3;position:absolute;top:130px;left:160px;" />
<img onclick="doCommand('Macro|MLHAI|001~Security~Night~All~{'+'{hai_001_keyboardbuffer}'+'}!MLHAI|001~Keypress~Clear');" src="images\LtBlue\bNight.png" style="z-index:3;position:absolute;top:130px;left:240px;" />

<img onclick="doCommand('MLHAI|001~Keypress~7');" src="images\LtBlue\b7.png" style="z-index:3;position:absolute;top:200px;left:20px;" />
<img onclick="doCommand('MLHAI|001~Keypress~8');" src="images\LtBlue\b8.png" style="z-index:3;position:absolute;top:200px;left:90px;" />
<img onclick="doCommand('MLHAI|001~Keypress~9');" src="images\LtBlue\b9.png" style="z-index:3;position:absolute;top:200px;left:160px;" />
<img onclick="doCommand('Macro|MLHAI|001~Security~Day~All~{'+'{hai_001_keyboardbuffer}'+'}!MLHAI|001~Keypress~Clear');" src="images\LtBlue\bDay.png" style="z-index:3;position:absolute;top:200px;left:240px;" />

<img onclick="doCommand('MLHAI|001~Keypress~*');" src="images\LtBlue\bStar.png" style="z-index:3;position:absolute;top:270px;left:20px;" />
<img onclick="doCommand('MLHAI|001~Keypress~0');" src="images\LtBlue\b0.png" style="z-index:3;position:absolute;top:270px;left:90px;" />
<img onclick="doCommand('MLHAI|001~Keypress~#');" src="images\LtBlue\bPound.png" style="z-index:3;position:absolute;top:270px;left:160px;" />
<img onclick="doCommand('Macro|MLHAI|001~Security~Disarm~All~{'+'{hai_001_keyboardbuffer}'+'}!MLHAI|001~Keypress~Clear');" src="images\LtBlue\bOff.png" style="z-index:3;position:absolute;top:270px;left:240px;" />

<img onclick="doCommand('MLHAI|001~Keypress~Clear');" src="images\LtBlue\bClear.png" style="z-index:3;position:absolute;top:340px;left:90px;" />
</span>

<span id="tabbar" style="visibility:visible;">
<img src="images/tabbar.png" style="z-index:100;position:absolute;top:412px;left:0px;" />
</span>

<script language="javascript">
    autoupdate = true;
    pagevars = getvars();
    updatefreq = 300;
    UpdateVariables();
</script>
</body>
</html>
Thanks!

Dave Bruner
:shock:

User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3143
Joined: Sun May 30, 2004 10:57 pm
Location: Mays Landing, NJ
Contact:

Re: HAI control via iPhone help

Postby DaveB » Mon Feb 14, 2011 9:15 pm

For anyone interested, I modified the index.html page to include my HAI status on the Security button line as follows;

Code: Select all

<li class="menu"><a href="Security.html"><img alt="Security" src="images/password.png" /><span class="name">Security</span><span id="ml__hai_001_area001_areamode" class="comment">{{hai_001_area001_areamode}}</span><span class="arrow"></span></a></li>
Thanks!

Dave Bruner
:shock:

Clever1
Senior Member
Senior Member
Posts: 220
Joined: Mon Jan 14, 2008 10:31 am
Location: Huntsville, AL.
Contact:

Re: HAI control via iPhone help

Postby Clever1 » Tue Feb 22, 2011 4:28 pm

DaveB,

Thankx for the posts... I made the same changes and I guess I should have posted them...

The only problem I have with the way this page works is that it is the reverse of how the actaul HAI Console works which doesn't help with the WAF.

I'd like to change the way this web works in that the command is buffered first (i.e. AWAY, NIGHT, DAY, OFF), a timer is set, and then the code has to be entered within the timer in order for the complete command to be sent... Just not sure if it can be done that way...

User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3143
Joined: Sun May 30, 2004 10:57 pm
Location: Mays Landing, NJ
Contact:

Re: HAI control via iPhone help

Postby DaveB » Wed Feb 23, 2011 10:29 pm

I agree. Actually the entire logic of how the HAI driver works in regard to arm and disarm functions is reversed as compared to the panel. This issue came up during driver development, but was never addressed. You should actually select the function first, then enter a four digit code, with the last code flushing the buffer. If, as in most homes, you have both a touchscreen and an HAI keypad and use them both, it gets confusing for the end user.
Thanks!

Dave Bruner
:shock:

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: HAI control via iPhone help

Postby CinemarDave » Thu Feb 24, 2011 10:57 am

You could do what you want by using some SetVariable commands to buffer the commands and key codes and a couple of conditionals to test when it is ready to send the command. Pressing Arm would reset the variables and prime the command for Arm. Then each button push would buffer the access code in a server variable. When you had enough digits you would assemble the server variables into the command and send it to the plugin. Would something like this work?

The Arm button would have a macro like
Macro|SetVariable|BaseCommand~Arm!SetVariable|AccessCode~!SetVariable|Feedback~

Each numeric key would have a macro like (numeric 0 example)
Macro|SetVariable|Feedback~{{Feedback}}*!!SetVariable|AccessCode~{{AccessCode}}0!!MLStrings|Len~CodeLength~{{AccessCode}}!!MLConditional|IsEqual##{{CodeLength}}##4##Macro|MLHAI|001~{{BaseCommand}}~{{AccessCode}}!SetVariable|Feedback~ARMED##

User avatar
DaveB
Simply Incredible
Simply Incredible
Posts: 3143
Joined: Sun May 30, 2004 10:57 pm
Location: Mays Landing, NJ
Contact:

Re: HAI control via iPhone help

Postby DaveB » Thu Feb 24, 2011 9:06 pm

Yes Dave - That would be perfect. If it could auto-flush after the forth numeric entry, that would be great. You would need to check for an incorrect entry of either the # or * keys.
Thanks!

Dave Bruner
:shock:

Clever1
Senior Member
Senior Member
Posts: 220
Joined: Mon Jan 14, 2008 10:31 am
Location: Huntsville, AL.
Contact:

Re: HAI control via iPhone help

Postby Clever1 » Tue Mar 15, 2011 9:49 am

DaveB,

I feel offline for a little while... Did you get this to work as if the web page was the console?? I agree with you too as I have both the required console and the touchscreen... it does get confusing....


Return to “MainLobby on iPhone, iPod Touch”

Who is online

Users browsing this forum: No registered users and 1 guest