X10 Community Forum

🖥️ActiveHome Pro => SDK => Topic started by: dave s on September 10, 2005, 11:59:06 AM

Title: queryplc command
Post by: dave s on September 10, 2005, 11:59:06 AM
Has anyone had any luck using
the 'queryplc' command that is part of the
SDK object? I can send commands to turn
modules on and off, however even if a
module is 'on' the 'queryplc' command does
not tell me this. Help!
Title: Re: queryplc command
Post by: skip on September 23, 2005, 02:59:43 PM
Dave,

Queryplc has been broken for a while...it
stopped working with 3.18x

Skip
Title: Re: queryplc command
Post by: dave s on October 04, 2005, 07:27:58 PM
Skip, thanks for your reply. Is there
anyone out there from X10 listening. What
good is a SDK if the functionality is
broken!!! My one experience with your tech
support has been a decent one, however I
cannot fathom why nobody from X10 will
respond to all the posts on this forum
where people need your help!!!
Title: Re: queryplc command
Post by: jim c on October 04, 2005, 10:17:00 PM
I would assume you are trying to query one
of the Bi-Directional Pro Moduals, not the
Standard X-10 units,  It's been over a year
since I was last doing coding for my old
Unit, but that was the only one that would
respond to queries, and I got a message
back telling me that was correct,  unless
they have changed all the units (Would be
nice, but not very likely
Title: Re: queryplc command
Post by: skip on October 07, 2005, 02:57:17 PM
Jim,

In 3.17x i could successfully do a queryplc
on the old x10 modules.  It worked fine, as
ahp kept track of the module status. I built
a system to control my garage door around it
and it worked like a charm.

After installing 3.18x queryplc started
returning 0 on all requests.

Skip
Title: Re: queryplc command
Post by: thermon on July 20, 2006, 03:31:10 AM
I've just tried the latest SDK from C++, and queryplc works great.
Title: Re: queryplc command
Post by: SkipWill on August 28, 2006, 03:54:36 PM
I've just tried the latest SDK from C++, and queryplc works great.

Thermon,

I would sure like to know how you did it :).  It stopped working for me after version 3.2x and whatever I do, queryplc returns 0 even with 2 way modules (it used to work with 1 way modules as well).

What version of AHP are you using?  Are you using the SDK as downloaded from X10?

Thanks

Sklip
Title: Re: queryplc command
Post by: EL34 on February 26, 2007, 10:19:28 AM
queryplc works ok for me so far using Perl, cm15A and AHP
The $Status variable below = 256 if module I1 is on and = 0 if I1 is off.
AHP also displays the correct status of the module after sending an on or off command via my Perl script

Perl Code:

### Set this to where ahcmd.exe is located ###
use constant AHCMD => "ahcmd";
my($housecode,$command,$tmp);

### Query, On = 256 , Off = 0 ###
$Status = system(AHCMD. " queryplc ". " I1 on");

### Turn on I1 only if it is off ###
if ($Status eq 0)
    {   
    system(AHCMD." sendplc "."I1"." "."on");
    }


Edit: OOOps, sorry forgot to set text as code
Title: Re: queryplc command
Post by: thermon on April 03, 2007, 11:56:33 AM
I didn't do anything special to make it work.  I tested it under the C++ source code provided.
Title: Re: queryplc command
Post by: swatson on December 04, 2007, 06:54:31 AM
Can someone convert the above example to PHP?
I have tried several things and I cannot get queryplc to return a value with PHP.
Also, why does the JavaScript example of the SDK work in IE only and only on my home PC?
Title: Re: queryplc command
Post by: -Bill- (of wgjohns.com) on October 22, 2008, 01:58:06 AM
I have emailed X10 about this problem.  There has been no response so far, but this might explain your problem:

The issue with the SDK is that the ahscript.dll file supplied in the SDK is version 3.0.0.183 while the version supplied with AHP is 3.0.0.200.  The most obvious problem with this is that software that uses the SDK version of the file gets erroneous results when attempting to use the “queryplc” command.  Many that have tried to develop software using the SDK have complained that the “queryplc” command always returns a result of 0.  Granted this is only an issue if the developer or end user doesn’t have AHP installed, or the developed software accesses a local copy of ahscript.dll instead of the one installed by AHP, but it does lead to a lot of frustration when trying to develop software and the “queryplc” command doesn’t appear to work.

Title: Re: queryplc command
Post by: EL34 on October 22, 2008, 10:35:54 AM
I just did a test to see why query worked for me in my VB 2008 express app, the results are here in this post.
http://www.x10community.com/forums/index.php?topic=16677.msg91907
Title: Re: queryplc command
Post by: inquisitr50@hotmail.com on April 30, 2009, 08:16:53 AM
As someone said in this forum what good is an automation system if you can't know the status of a module .
If query plc is not working and you can only send command you are sending command as a blind .
X10 should stop sending me e-mail for selling me product and start sending me answer to my question .
When will we have a command that work both ways
thank  >*< B:( :'
Title: Re: queryplc command
Post by: dbemowsk on December 24, 2009, 01:09:32 PM
Can someone convert the above example to PHP?
I have tried several things and I cannot get queryplc to return a value with PHP.
Also, why does the JavaScript example of the SDK work in IE only and only on my home PC?
I realize that this is an old post, but in the event that someone stumbles across this as I did in my search for the queryplc command for use in PHP, here are my findings:

First off, download and replace the ahscript.dll file (version 3.0.0.200) as described by x10diehard in this post http://www.automationvista.com/Board/ShowTopic.aspx?Topic=24 (http://www.automationvista.com/Board/ShowTopic.aspx?Topic=24).

Next, I created a \bin\ folder in my webroot folder which I put the ahcmd.exe file

Now for the meat.  I have written an x10 command function for PHP that works for me.  The function should be able to handle any x10 command.
Code: [Select]
<?php
/*
    execute an X-10 command
    types : sendplc, queryplc, sendrf, recvplc, recvrf

    For queryplc command, return[1] will be either -1 (unknown), 0 (off), or 1 (on)
    when sending "on" to the $action parameter
 */
function x10cmd($type$hcode$ucode$action$time="") {
    
$cmd $type." ".$hcode.$ucode." ".$action." ".$time;
    
exec(".\bin\ahcmd ".$cmd$return[0], $return[1]);  
    return 
$return;
//End function x10cmd
?>


An example use of the above function is listed below.
Code: [Select]
<?php
//send our x10 command for module M2 and get the status
$status x10cmd("queryplc""m""2""on");
//print the status 
switch ($status[1]) {
    case -
1:
        echo 
"Unknown";
        break;
    case 
0:
        echo 
"OFF";
        break;
    case 
1:
        echo 
"ON";
        break;
}
?>


Hope this is useful to many...

Dan
Title: Re: queryplc command
Post by: AidinEslami on March 20, 2010, 10:34:43 PM
hello
please mail the version 3.0.0.200 to my email : aidin.eslami[at]gmail.com

thank you so much.
Title: Re: queryplc command
Post by: pconroy on March 21, 2010, 12:34:31 PM
I'm curious - how does (or how *did*) queryplc work?

Did the unit have a little NVRAM and keep track of the last state of a module?

I mean - I thought you couldn't ask a LM465 what it's state is?
The LM14's - yes - but not a Lamp or Appliance module.

I'm storing the last update sent in a mySQL database.
Cuz that's what I thought I had to do.

thanks!
Title: Re: queryplc command
Post by: dbemowsk on March 21, 2010, 02:44:48 PM
The CM15A remembers the state of modules that it controls.  There are drawbacks to that.  For instance, I have some WS13A wall switches in my house.  If I go and manually turn them on at the switch, the CM15A doesn't know that I did that because the WS13A didn't transmit a signal to it telling it that I activated it.  However, if I use AHP to activate it, the CM15A is what is turning it on or off and remembers it.  The same goes for an RF remote.  Since the RF remote runs through the CM15A, it can remember the state.

Hope that all makes sense

Dan B.
Title: Re: queryplc command
Post by: -Bill- (of wgjohns.com) on March 21, 2010, 08:13:42 PM
To expand on dbemowsk's explanation:

The CM15A itself remembers what it last sent out to each of the 16 X10 addresses in the "Monitored House Code".

The CM15A driver software on the computer remembers what it last sent to all 256 X10 addresses.

So, when you first boot the computer, the status of most X10 modules will be unknown and only the ones in the "Monitored House Code" will likely be correct, as the driver software can read those from the CM15A, but not the rest.

 >!
Title: Re: queryplc command
Post by: pconroy on March 21, 2010, 11:13:12 PM
<Ed McMahon Voice>

Thank you sir!
I did not know that!   :)

</Ed McMahon Voice>