Announcement

Collapse
No announcement yet.

(PHP - Apache) DeviceStatus Returns 17

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    (PHP - Apache) DeviceStatus Returns 17

    I have installed Apache and PHP on my machine and setup the DCOM and I have them all interacting with each other just fine except for when i call Status from the device class it returns all 17(unknowns)

    Also if call DeviceStatus or Device String it returns something weird: "Object ID #3" and "Object ID #2". The numbers alternate 2,3,2,3,2,3,2,3 for each device that i call. I was expectring DeviceStatus to return a number and deviceString to return a text value such as "ON" or "Off"

    Again I am using PHP and all the other function seem to work just fine its only the status that i am having trouble with. I also posted this on the cocoontech board if you want to look at my coding samples.

    http://www.cocoontech.com/index.php?showtopic=310

    #2
    PHP and HS...How sweet it is!

    Look through this and see if it helps you....
    PHP Code:
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <?php 

    $hs 
    = new COM("HomeSeer.Application");
            if (
    $hs->ison("D1")) {
            
    $hs->execx10("D1","off",0);
    }else {
                     
    $hs->execx10("D1","on",0);
                }

    // create a new empty device
    $m=$hs->NewDevice("TestDevice");
    $dev=$hs->GetDevice($m);

    // set some attributes of the device
    $dev->location="kitchen";
    $dev->name="lamp";
    $dev->hc="A";
    $dev->dc="16";

    // get the id for later
    $id=$dev->ref;

    //Keep this for later use
    $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->ref</td>";
    $hc=$What->hc;
    $device.="<td>$hc</td>";
    $dc=$What->dc;
    $device.="<td>$dc</td>";
    $hcdc.=$hc;
    $hcdb.=$dc;
    $Yes="1";
    //$What->status_support($hcdc)=$Yes;

    //$hs->SetDeviceStatus($hcdc)="2";
    $DS=$hs->DeviceStatus($hcdc);
    $device.="<td>$DS</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>";


    // create a new empty event

    $z=$hs->NewEvent("test_name");
    $ev1=$hs->GetEvent($z);

    // set some event parameters
    $ev1->speech="Did his work?";
    $ev1->ev_abs_time=7;
    $ev1->ev_hc="D1";
    $ev1->vcmd="Turn on (...) living room (light|lights|like|likes)";
    $ev1->ev_func=2

    // create a new devfunc class to describe a device
    $df=$hs->NewDevFunc;
    print 
    $df;
    $df->devid=$id;
    $df->func=2;

    // add the classs to our collection
    $addnow=$ev1->ev_devices;
    $addnow->Add($df);

    $hs->SaveEventsDevices;

    unset(
    $hs);
     
    ?>
    </body>
    </html>

    Comment

    Working...
    X