Announcement

Collapse
No announcement yet.

Homeseer and PHP

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

    Homeseer and PHP

    Hello
    I am a new user of homeseer.
    And i am also a PHP developper.

    So 1st, i want to access the COM object.

    My code :
    $hs = new COM("homeseer.application");

    $version=$hs->version(); //this works very well
    $statusA1=$hs->DeviceStatus("A1"); //this doesn't work


    So only some HS functions can work.
    I have read every post on the board concerning HS and DCOM but with the new version 1.6.30 it seems to be a little different.

    So, if someone can give me examples and How-To.

    Thanks in advance
    Ikarius.

    #2
    What are you seeing as a result? The code below works as expected (returns 17 when the device doesn't exist, 2 when on, etc).

    I tested this code on 1.6.30 and it works fine (Perl, but close enough. [img]/infopop/emoticons/icon_smile.gif[/img] ):

    <pre class="ip-ubbcode-code-pre">
    use Win32::OLE;
    $hs = Win32::OLE-&gt;CreateObject('HomeSeer.Application');
    print $hs-&gt;version() . "\n";
    print $hs-&gt;DeviceStatus("A1");
    </pre>

    -Nitrox

    Comment


      #3
      in fact, DeviceStatus always return 0

      And i don't understant why.

      and a lot of functions doesn't work
      (like speak, getdevice, devicecount, etc...)


      Please help...

      Comment


        #4
        That's very strange and unfortunately I don't use PHP so I can't test here. But I can attest to the fact that the latest version of HS is working perfectly via COM/OLE communications. I program solely in Perl and utilize the COM API immensely.

        -Nitrox

        Comment


          #5
          ikarius -
          I'm using HS with PHP in a couple of functions. Take a look on the left column at CarlosHouse.com, under the System Status section. I'm not using $hs-&gt;DeviceStatus, but $hs-&gt;DeviceString without a problem (as well as others like $hs-&gt;SystemUpTime(), $hs-&gt;Sunrise(), $hs-&gt;Sunset(), etc).

          To initialize hs, I use:
          $hs = new COM("HomeSeer.Application");
          and don't forget to release it at the end:
          unset($hs);

          The only problem that I ever had was not really PHP related but due to DCOM. I was getting an error message saying that the object didn't support that method (or something similar). When you install a new version of HS, for some reason it registers itself as HomeSeer.Condition instead of HomeSeer.Application. If the same is happening to you, look for "HomeSeer.Condition" in the forum to find out how to solve it.
          - Carlos

          CarlosHouse.com

          Comment


            #6
            Hi Carlos.

            For me, i just have a dcom object called
            Homeseer.clsString

            No homeseer.application or homeseer.condition.

            And the devicestring function doesn't work anymore.

            Please... need help.

            Comment

            Working...
            X