PHP and HomeSeer

pete

Active Member
I followed the how to's on setting up Apache and PHP to work with HS, but need some help coding web page. . . the form is working, it recalls it'self and I'm "connected" to HS (I can write HS devicevalues), however, I'm a newbie w/PHP

I'm trying to use a (recursive) form to set a HS device, and the best effort I've come up w/ is
Code:
if (isset($_POST"modeOff")) {
  hs->SetDevice "$7", 1;
}
but it's not working, specific help w/ this issue and general links to good tutorials on forms w/PHP in general appreciated.

Pete C
 
PeteC,
Is there a reason you chose to Learn PHP (not native to HS) over asp which is native to HS?
 
I'm trying to write a form page to access some Ocelot variables via homeseer . . .

I want to click an 'input type' and have the form set a variable and then re-display itself.

Pete C



~ Rupp, going with PHP because it is open source . . . no I don't read the stuff, just like to know someone can.
 
here is what I have so far . . . included in the html comment is some asp code that did what I need to do in PHP


Code:
<?php 

include "header.inc";

$hs = new COM("HomeSeer.Application");

$hvacMode=$hs->devicevalue("$7")

$z1SetPt=$hs->devicevalue("$8");
$z1Temp=$hs->devicevalue("$46");
$z1Pump=$hs->devicestatus("_9");

$z2SetPt=$hs->devicevalue("$9");
$z2Temp=$hs->devicevalue("$48");
$z2Pump=$hs->devicestatus("_10");

$z3SetPt=$hs->devicevalue("$10");
$z3Temp=$hs->devicevalue("$50");
$z3Pump=$hs->devicestatus("_11");

$z4SetPt=$hs->devicevalue("$11");
$z4Temp=$hs->devicevalue("$49");
$z4Pump=$hs->devicestatus("_12");

$z5SetPt=$hs->devicevalue("$12");
$z5Temp=$hs->devicevalue("$47");
$z5Pump=$hs->devicestatus("_13");


THIS IS WHERE I'M LOST

if (isset($_POST"modeOff->x")) {
  hs->SetDeviceValue($7,1); 

} 

?>

<!-- 

THIS IS ASP CODE THAT WAS WORKING

if Request.Form("modeOff.x") <> nil then
  hs.SetDeviceValue "$7", 1
	elseif Request.Form("modeAuto.x") <> nil then
     hs.SetDeviceValue "$7", 2
	elseif Request.Form("modeHeat.x") <> nil then
     hs.SetDeviceValue "$7", 3	
	elseif Request.Form("modeVent.x") <> nil then
     hs.SetDeviceValue "$7", 4
	elseif Request.Form("modeCool.x") <> nil then
     hs.SetDeviceValue "$7", 5
    end if
-->






<form method="post" action="hvac.php">
<table width="600" border="0" cellspacing="3" cellpadding="0" id="modeButtons">
	<tr><td width="42" valign="center" align="center"><img border="0" src="images/led1On.gif" ></td></td><td width="100"><input type="image" src="images/btnOff.gif" alt="Off" border="0" name="modeOff">

  <td width="15"><td rowspan="6" valign="top" align="center" >
 	 <h1>Heat Mode Status</h1>
 	 <table width="400" border="0" cellspacing="0" cellpadding="3" id="zoneInfo">
 	 <tr align="center"><td width="150"><u><font size="+2">Zone</font></u></td><td><u><font size="+2">Temp</font></u></td><td><u><font size="+2">Set Pt</font></u></td><td><u><font size="+2">Pump</font></u></td></tr>


 	 <tr align="center"><td width="150"><font size="+2">1st Flr Front</font></td><td><font size="+2"><?php print $z2Temp ?></font></td><td><font size="+2"><?php print $z2SetPt ?></font></td><td><font size="+2"><?php print $z2Pump ?></font></td></tr>


 	 <tr align="center"><td width="150"><font size="+2">1st Flr Rear</font></td><td><font size="+2"><?php print $z4Temp ?></font></td><td><font size="+2"><?php print $z4SetPt ?></font></td><td><font size="+2"><?php print $z4Pump ?></font></td></tr>


 	 <tr align="center"><td width="150"><font size="+2">2nd Floor</font></td><td><font size="+2"><?php print $z3Temp ?></font></td><td><font size="+2"><?php print $z3SetPt ?></font></td><td><font size="+2"><?php print $z3Pump ?></font></td></tr>


 	 <tr align="center"><td width="150"><font size="+2">Garage</font></td><td><font size="+2"><?php print $z1Temp ?></font></td><td><font size="+2"><?php print $z1SetPt ?></font></td><td><font size="+2"><?php print $z1Pump ?></font></td></tr>


 	 <tr align="center"><td width="150"><font size="+2">Garage Attic</font></td><td><font size="+2"><?php print $z5Temp ?></font></td><td><font size="+2"><?php print $z5SetPt ?></font></td><td><font size="+2"><?php print $z5Pump ?></font></td></tr>
 	 </table>
      </td>
	</tr>
  
  
	<tr><td width="42" valign="center" align="center"><img border="0" src="images/led2Off.gif" ></td><td width="100"><input type="image" src="images/btnAuto.gif" alt="Off" border="0" name="modeAuto">
	<tr><td width="42" valign="center" align="center"><img border="0" src="images/led3Off.gif" ></td><td width="100"><input type="image" src="images/btnHeat.gif" alt="Off" border="0" name="modeHeat">
	<tr><td width="42" valign="center" align="center"><img border="0" src="images/led4Off.gif" ></td><td width="100"><input type="image" src="images/btnVent.gif" alt="Off" border="0" name="modeVent">
	<tr><td width="42" valign="center" align="center"><img border="0" src="images/led5Off.gif" ></td><td width="100"><input type="image" src="images/btnCool.gif" alt="Off" border="0" name="modeCool">
	<tr><td width="42" valign="center" align="center"><img border="0" src="images/led6Off.gif" ></td><td width="100"><input type="image" src="images/btnFan.gif" alt="Off" border="0" name="modeFan">
  </td>
	</tr>
</table>
	
<?php
$hs = new COM("HomeSeer.Application"); 

unset($hs);
?>

<php include "footer.inc"; ?>
 
Back
Top