Please login or register.

Login with username, password and session length

Author Topic: Detect presence of cm15  (Read 9412 times)

RichardUK

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
    • Whzan
Detect presence of cm15
« on: June 29, 2010, 10:41:05 AM »

Using the SDK I can detect when the SDK is not installed as the instanciation of the class throws an exception. But with an installed driver but no device connected the class is allocated ok. So I have no idea if a device is connected. Anyone have any ideas to testing this?

Many thanks.
Richard e Collins. :)
Logged
Richard e Colins.
www.whzan.com

ITguy

  • Sr. Member
  • ****
  • Helpful Post Rating: 8
  • Posts: 105
Re: Detect presence of cm15
« Reply #1 on: June 29, 2010, 04:39:27 PM »

Hi Richard,

Here's an idea I stumbled across on the iHouse forums www.ihousehomeautomation.com:
Quote
Changed the method used to detect if the CM15A is connected or not. iHouse now polls for the CM15A using the X10 queryplc command “a1 requeststatus” every 15 seconds. The user does not need to have an X10 device addressed at A1 for this to work.

You might also find some ideas in the CM15A portion of the Open Source Automation project at:
http://code.google.com/p/osae/source/browse/#svn/trunk/Plugins/OSAE.CM15A/CM15A

I don't know enough about the programming of either of these to be of any more help, but maybe this will point you toward something.

ITguy
Logged

RichardUK

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
    • Whzan
Re: Detect presence of cm15
« Reply #2 on: June 30, 2010, 04:22:54 AM »

I was hoping that there was a more acceptible way.

 So if the device is not there but the cm15 is connected you're still get a reply?

It's a shame the SendAction command does not return a failure value or throw an exception when the cm15 is not connected.


I do see a DeviceStop and DeviceStart on a6 ( I have no a6 device ) when I disconnect and reconnect the cm15, not sure what the a6 address is but is this command reliable for the connection status of the cm15?
Logged
Richard e Colins.
www.whzan.com

ITguy

  • Sr. Member
  • ****
  • Helpful Post Rating: 8
  • Posts: 105
Re: Detect presence of cm15
« Reply #3 on: June 30, 2010, 02:41:11 PM »

Correct - you'll get a reply from the CM15a even if the device you're requesting status for doesn't exist.  The reply value is meaningless, but any reply means the CM15a is there.

Not sure about the A6 question.

You might try checking in on Home Automation Chat  www.bdshost.com/ac/   and see if some of the guys there can help.  Best time would probably be between 7PM and 11PM Eastern time.

Good Luck!

ITguy
Logged

pconroy

  • Hero Member
  • *****
  • Helpful Post Rating: 9
  • Posts: 294
Re: Detect presence of cm15
« Reply #4 on: June 30, 2010, 04:56:54 PM »

I'm not using the SDK and I don't have a CM15, but....    ;D

Am I right in reading between the lines - that if you just sent "A1 On" to it, and the CM15 wasn't connected -- No exception is thrown????


That would really seem like a API flaw to me.




On Linux, and on the USB devices I've played with - if they're not connected it's really, really, really obvious!  :)
Logged

RichardUK

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
    • Whzan
Re: Detect presence of cm15
« Reply #5 on: July 01, 2010, 04:10:23 AM »

that if you just sent "A1 On" to it, and the CM15 wasn't connected -- No exception is thrown????

Yup. The only time you get an exception is if the driver is not installed, but this exception I belive is thrown by the frame work as I added a reference to my c# project of the com interface of the driver.
Logged
Richard e Colins.
www.whzan.com

RichardUK

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
    • Whzan
Re: Detect presence of cm15
« Reply #6 on: July 01, 2010, 04:16:33 AM »

Correct - you'll get a reply from the CM15a even if the device you're requesting status for doesn't exist.  The reply value is meaningless, but any reply means the CM15a is there.

Not sure about the A6 question.

You might try checking in on Home Automation Chat  www.bdshost.com/ac/   and see if some of the guys there can help.  Best time would probably be between 7PM and 11PM Eastern time.

Good Luck!

ITguy

I could't get this to work as I have the bugged drivers and the latest AHP will not install on my 64bit development system. But I found that the return value of the actual send function returns -1 if the controller is not connected. It is also suposed to return 1 or 0 for the state of the device but as my driver is the broken one and I only get 0. But that is fine as i'm only using it to check for connection of the controller.
 :D

This is what I do, the e11 address was just a test as I knew I had nothing at e11. But works just as well with any other address...

//Cheeky way to test for cm15 connection.
            int res = (int)cm15.SendAction("queryplc", "e11 on", null, null);
            if (res == -1)
            {
               GatewayStatus.X10ControllerState(ID, false);
            }
            else
            {
               GatewayStatus.X10ControllerState(ID, true);
            }

Logged
Richard e Colins.
www.whzan.com
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.