<span style='font-size:14pt;line-height:100%'>How to interface Homeseer using PHP</span>
by electron
1) Configure DCOM: http://www.cocoontech.com/index.php?showtopic=294
2) Install Apache & PHP: http://www.cocoontech.com/index.php?showtopic=305
3) Create a new file in your webroot directory using notepad, name it index.php.
4) paste the following code into the index.php file (make sure you change Homeseer.Application to whatever the object is named in your DCOM configuration screen, usually the other name is Homeseer.ClsString.
5) go to http://localhost (or the ip address of your machine), and you should see a listing of all the Homeseer devices you have, including all details.
6) Here are some other examples on how to control HS using PHP:
Turn on a device named A4:
Write to the HS log file:
To check the status of a device named A4:
by electron
1) Configure DCOM: http://www.cocoontech.com/index.php?showtopic=294
2) Install Apache & PHP: http://www.cocoontech.com/index.php?showtopic=305
3) Create a new file in your webroot directory using notepad, name it index.php.
4) paste the following code into the index.php file (make sure you change Homeseer.Application to whatever the object is named in your DCOM configuration screen, usually the other name is Homeseer.ClsString.
Code:
<?php
$hs = new COM("HomeSeer.Application");
$List=$hs->GetDeviceList();
print "<table>";
for($i=1; $i < $List->Count() + 1; $i++) {
$What=$List->item($i);
$device="<tr>";
$device.="<td width=50>$i</td>";
$device.="<td>$What->Name</td>";
$device.="<td>$What->Location</td>";
$device.="<td>$What->Status</td>";
$device.="<td>$What->hc</td>";
$device.="<td>$What->dc</td>";
$device.="<td>$What->misc</td>";
$device.="<td>$What->interface</td>";
$device.="<td>$What->dev_type_string</td>";
$device.="<td>$What->buttons</td>";
$device.="</tr>\n";
print $device;
}
print "</table>";
unset($hs);
?>
5) go to http://localhost (or the ip address of your machine), and you should see a listing of all the Homeseer devices you have, including all details.
6) Here are some other examples on how to control HS using PHP:
Turn on a device named A4:
Code:
$hs->ExecX10("a4","off","0","0");
Write to the HS log file:
Code:
$hs->WriteLog("PHP","This is a test");
To check the status of a device named A4:
Code:
$hs->devicestatus("A4");