Author |
|
traviskleckner Senior Member
Joined: February 26 2007 Location: United States
Online Status: Offline Posts: 118
|
Posted: November 28 2008 at 13:10 | IP Logged
|
|
|
Hello all,
I know that I am just doing something stupid here and
need a little help. I'm working on some custom pages to
control lights from an iPhone/touch.
I'm trying to figure out the best way to set Scenes from
an HTML page (I don't really want to do it all with
groups.)
I've got this:
<form method="post" action="/ph-cgi/formula">
<input type="hidden" name="type" value="5">
<input type="submit" style="height: 50px; width:
150px;font-size:16pt" name="cmd" value="MBR On">
<input type="hidden" name="formula"
value="ph_insteon('MBR-FANLIGHT',17,75)+ph_insteon('MBR-
WALLLIGHTS',17,125)">
<input type="hidden" name="nexturl"
value="/iPhoneLights.html">
</form>
Which works, but always takes me to PH formula page (it
seems to ignore the "nexturl" section.)
That said, is there a better way to do this? Could it
be done with a link url rather than a form?
Edit: While I'm at it...any thoughts on why this
doesn't work:
<a href="/ph-cgi/evalformula?formula=ph_insteon('MBR-
FANLIGHT',17,255)&nexturl=/iPhoneLights.html">Fan Light
On</a>
<a href="/ph-cgi/evalformula?formula=ph_insteon('MBR-
FANLIGHT',19,0)&nexturl=/iPhoneLights.html ">Fan Light
Off</a>
(for whatever reason, it's in the "+". This: <a
href="/ph-cgi/evalformula?formula=ph_insteon ('MBR-
WALLLIGHTS',iOn,255)&nexturl=/iPhoneLights.html ">On</a>
works fine. For some reason I can't run them both.
Grr.)
Thanks in advance!
Edited by traviskleckner - November 28 2008 at 13:19
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: November 30 2008 at 21:54 | IP Logged
|
|
|
Travis,
In the first "form" method, change the action to "/ph-cgi/evalformula". The ph-cgi/formula will always bring up the PowerHome default formula page and ignores the nexturl parameter.
Concerning your href examples, they should work. As a quick test, I copied and pasted your code into a file with slight modifications for my own system and didnt have a problem.
Code:
<html>
<body>
<a href="/ph-cgi/evalformula?formula=ph_insteon('NOOK',ion,255) &nexturl=/test.html">Nook Light On</a><br>
<a href="/ph-cgi/evalformula?formula=ph_insteon('NOOK',ioff,0)& nexturl=/test.html">Nook Light Off</a>
</body>
</html>
|
|
|
Now, if you're saying you have a problem with trying to add to ph_insteon functions like in your "form" example, then yes, you'll have a problem as the "+" sign is used as an escape character for HTTP GET commands as a space character. You can fix this by instead subtracting the two ph_insteon commands (or multiplying, dividing). You can also escape the "+" symbol so it doesnt get interpreted as a space character with %2b. So the href equivalent of your form would be:
Code:
<a href="/ph-cgi/evalformula?formula=ph_insteon('MBR-FANLIGHT', 17,75) %2b ph_insteon('MBR-WALLLIGHTS',17,125)&nexturl=/iPhoneLights.ht ml">On</a>
|
|
|
Hope this helps,
Dave.
|
Back to Top |
|
|
traviskleckner Senior Member
Joined: February 26 2007 Location: United States
Online Status: Offline Posts: 118
|
Posted: December 01 2008 at 12:17 | IP Logged
|
|
|
Thanks Dave, that was it. The plus was killing me.
|
Back to Top |
|
|
|
|