queryplc command

Started by dave s, September 10, 2005, 11:59:06 AM

Previous topic - Next topic

dave s

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!

skip

Dave,

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

Skip

dave s

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!!!

jim c

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

skip

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

thermon

I've just tried the latest SDK from C++, and queryplc works great.

SkipWill

Quote from: thermon on July 20, 2006, 03:31:10 AM
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

EL34

#7
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
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

thermon

I didn't do anything special to make it work.  I tested it under the C++ source code provided.

swatson

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?

-Bill- (of wgjohns.com)

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.

-Bill- (of wgjohns.com)
bill@wgjohns.com

In the real world, the only constant is change.

When I'm online you can find me in the Home Automation Chat Room!

EL34

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
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm

inquisitr50@hotmail.com

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:( :'

dbemowsk

#13
Quote from: 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?
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.

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.

<?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.

<?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
Dan Bemowski
Owner of PHP Web Scripting LLC
Programmer of RemoteWatch X10
User of any X10 products I can get my hands on.

AidinEslami

hello
please mail the version 3.0.0.200 to my email : aidin.eslami[at]gmail.com

thank you so much.