Please login or register.

Login with username, password and session length
Advanced search  

News:

The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Pages: [1] 2

Author Topic: Query plc does work, but.................  (Read 36429 times)

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Query plc does work, but.................
« on: October 22, 2008, 10:30:30 AM »

Quote
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's info is above is correct.

I could not remember why query plc was working for me, so I did a test just now.
I am able to make query plc work only if the module I am inquiring about is actually installed in AHP.
I don't use AHP and it is not running at the time I do my queries, but I do have it installed on the PC that is doing the queries with my VB 2008 express program.

If I do a query on a module that is not set up in AHP, I get a zero on the query, even if the module is actually on.

This does not help developers who want to distribute their software to people who do not have AHP installed.

If you do have AHP installed on your PC and are only doing personal stuff with your own programs, go ahead and add the modules to AHP that you need to query.
Test this and see if it works for you after doing that.

Here's a screen shot of me doing my test on G16 module.
I have the G16 module installed in AHP, but AHP is not running.

I am turning G16 on and off with the buttons at the bottom of the form.
I am doing the query with the button at the bottom of the form after turning the module on or off.
The lines below each query are an x10 traffic monitor reporting what x10 traffic has been received.
« Last Edit: October 22, 2008, 10:41:19 AM by EL34 »
Logged
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

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Query plc does work, but.................
« Reply #1 on: October 23, 2008, 10:28:42 PM »

Anyone test this to see if it works?
Logged
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

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: Query plc does work, but.................
« Reply #2 on: October 24, 2008, 12:39:22 AM »

Sorry, I haven't had time to test if it requires all the modules to be registered in AHP or not.

My first impression, based on earlier tests with my own software makes me think that the issue is the version of the ahscript.dll file and not AHP registration of the modules, but I may be wrong.

I will try to get around to testing both possibilities soon.

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

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Query plc does work, but.................
« Reply #3 on: October 24, 2008, 08:20:49 AM »

I only use AHP to turn a module on and off at dusk and dawn.
Easier than me programming dusk and dawn in my program.

I wonder if the modules are registered in the cm15a when I download the macro?

I cannot get any non AHP modules to respond to query but installed modules do just fine.
Logged
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

TDawg

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 1
Re: Query plc does work, but.................
« Reply #4 on: October 31, 2008, 11:22:17 PM »

Hi,

I have the same problem with queryplc always returning 0. Sendplc works fine. I have the CM15U from Marmitek. The module(s) in question are all registered in AHP. The problem occurs whether AHP is running or not. The CM15 is of course connected and powered. Modules are active.

What do you mean "the version [of ahscript.dll] supplied with AHP is 3.0.0.200"? - the ahscript.dll only comes with the SDK surely? I have only one version on my system that's for sure...and it's the 183 version from the SDK... ???

Here's my VB6 code:
-----
Option Explicit
Dim WithEvents ActiveHomeObj As ActiveHomeScriptLib.ActiveHome
Dim dump, res

Private Sub Form_Load()
   Set ActiveHomeObj = New ActiveHome
   dump = ActiveHomeObj.SendAction("sendplc", "h4 on")
    res = ActiveHomeObj.SendAction("queryplc", "h4 on")
   dump = MsgBox("H4 Status: " & res)

End Sub
-----
I always get the message "H4 Status: 0"

Help! 
Logged

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: Query plc does work, but.................
« Reply #5 on: November 01, 2008, 01:56:30 AM »

Quote
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's info is above is correct.

I could not remember why query plc was working for me, so I did a test just now.
I am able to make query plc work only if the module I am inquiring about is actually installed in AHP.
I don't use AHP and it is not running at the time I do my queries, but I do have it installed on the PC that is doing the queries with my VB 2008 express program.

If I do a query on a module that is not set up in AHP, I get a zero on the query, even if the module is actually on.

This does not help developers who want to distribute their software to people who do not have AHP installed.

If you do have AHP installed on your PC and are only doing personal stuff with your own programs, go ahead and add the modules to AHP that you need to query.
Test this and see if it works for you after doing that.

Here's a screen shot of me doing my test on G16 module.
I have the G16 module installed in AHP, but AHP is not running.

I am turning G16 on and off with the buttons at the bottom of the form.
I am doing the query with the button at the bottom of the form after turning the module on or off.
The lines below each query are an x10 traffic monitor reporting what x10 traffic has been received.


I finally got around to doing a proper test on this theory.

I renamed my .ahx file and forced AHP to start with a new empty file, i.e. no rooms, modules or macros defined.

I cleared the interface and then downloaded the empty .ahx setup.

In the downloaded setup, the "Monitored House Code" was "L" and I changed the transceived house code selections so that all house codes are transceived.

I then ran a JScript program I had written some time back that uses queryplc to show the status of modules.

The "Monitored House Code" (house code "L") modules jumped right up with their status.

The other addresses came up as "undefined".

As a test, I used a plug-in stand-alone X10 controller to send "P2 On" and "P2 Off" commands (pressing the "Refresh Staus" button in my program after each command).

The "Non-Monitored" P2 address changed appropriately from "undefined" to "On" then "Off" ad infinitum, as expected.

My conclusion is that, as I believed, queryplc reports the correct module status even if the module is not defined in AHP or the CM15A.

Only modules assigned to the "Monitored House Code" will be tracked by the CM15A when the computer is off.

When the computer is on, the X10 service will track all module states, but once turned off and restarted, the X10 service will report "unknown" as the module state of any module that is not on the "Monitored House Code" until it sees a command for the non-monitored module.

Clear as mud?  ;)

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

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Query plc does work, but.................
« Reply #6 on: November 01, 2008, 08:26:08 AM »

Ah, ok, that splains why I am able to get good queries from that G16 module in my test above.
I have AHP set to automatically detect the monitored house codes
G code is one of 5 house codes that is being monitored in AHP.

I only use AHP for one macro, a dusk and dawn macro
1) The AHP macro works fine and
2) It's way more effort to write the code for a dusk and dawn module on/off to replace that macro.

When I download that one macro to the CM15A, the monitored house codes must also be downloadeded into the CM15A???

After I download that macro, I don't use AHP.
Logged
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

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: Query plc does work, but.................
« Reply #7 on: November 02, 2008, 12:22:53 AM »

Ah, ok, that splains why I am able to get good queries from that G16 module in my test above.
I have AHP set to automatically detect the monitored house codes
G code is one of 5 house codes that is being monitored in AHP.

I only use AHP for one macro, a dusk and dawn macro
1) The AHP macro works fine and
2) It's way more effort to write the code for a dusk and dawn module on/off to replace that macro.

When I download that one macro to the CM15A, the monitored house codes must also be downloadeded into the CM15A???

After I download that macro, I don't use AHP.

Yes, downloading timers and macros also downloads the monitored house code setting.

However, what I was really saying above is that queryplc works to retrieve the last known status of any module whether defined in AHP or not.

The CM15A itself keeps track of the last known status of modules on the "Monitored House Code" and so queryplc can retrieve their status even if it changes when the computer is off.  The status of other modules is tracked by the X10 service running on the computer and should come up as undefined until the X10 service sends or receives an X10 signal for that module while the computer is running.
Logged
-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

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Query plc does work, but.................
« Reply #8 on: November 02, 2008, 07:53:24 AM »

Ok, thanks Bill
Logged
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

iraj.shafagh

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 5
Re: Query plc does work, but.................
« Reply #9 on: December 12, 2008, 05:50:21 AM »

hi
plz chek this code, may be useful

Private Sub ActiveHome1_RecvAction(ByVal bszAction As Variant, ByVal bszParm1 As Variant, ByVal bszParm2 As Variant, ByVal bszParm3 As Variant, ByVal bszParm4 As Variant, ByVal bszParm5 As Variant, ByVal bszReserved As Variant)
Debug.Print bszAction, bszParm1, bszParm2, bszParm3, , bszParm4, , bszParm5, bszReserved

End Sub

 ;)
Logged

USdangerboy

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 32
Re: Query plc does work, but.................
« Reply #10 on: December 28, 2008, 02:55:11 AM »

This works fine, but I get '-1' for off and '1' for on.  I used the following function myself so I can call it anytime.

Example to CALL the function
GetUnitStatus("c2")
or more appropriately ...
If GetUnitStatus("c2") = False Then SendCommand("c2 bright 25")

The Function itself
Code: [Select]
   
Public Function GetUnitStatus(ByRef unitID As String) As Boolean
        Dim myStatus
        ActiveHomeObj = New ActiveHome
        myStatus = ActiveHomeObj.SendAction("queryplc", unitID + " on")
        Console.WriteLine("DEBUG: Query of unit " + UCase(unitID) + " returned: " + Convert.ToString(myStatus))
        If myStatus = -1 Then Return False
End Function

Here is the console output when I run this c2 starts out ON, fyi

DEBUG: Query of unit C2 returned: 1
NOTE: Now turning off Family Room Lights (C2)
ACTION->RecvPlc CODE->c2        CMD->Off        PAR3->  PAR4->  PAR5->
------------------------------------------------------------------------------
DEBUG: Query of unit C2 returned: -1
NOTE: Found lights off, now setting Family Room Lights to level 25 (C2)
ACTION->RecvPlc CODE->c2        CMD->Bright     PAR3-> 25       PAR4->  PAR5->
------------------------------------------------------------------------------


Hope this helps :-)
« Last Edit: December 28, 2008, 02:58:45 AM by USdangerboy »
Logged
If at first you don't succeed, skydiving is not for you.

andrey

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 1
Re: Query plc does work, but.................
« Reply #11 on: January 02, 2009, 02:37:12 PM »

Hello,

I have the same problem as TDawg. I have only one ahscript.dll in my system and it is the 183. I downloaded the AHC and the SDK this week and reinstalled (December/January) and it is still the 183.

And as him, I had no success with queryplc, I've tried to change the house code, add the module and everything that was mentioned in any of the 5 or 6 previous threads about the queryplc.

Bill, maybe only you has this ahscript version 3.0.0.200. That's why it only works with you! Where did you get it? (btw., I tried the link you provided in other threads and it was the same... 183).

Thanks,

Andrey

Logged

-Bill- (of wgjohns.com)

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 81
  • Posts: 1340
  • He's just this guy. You know?
    • wgjohns.com
Re: Query plc does work, but.................
« Reply #12 on: January 03, 2009, 02:11:35 AM »

Hello,

I have the same problem as TDawg. I have only one ahscript.dll in my system and it is the 183. I downloaded the AHC and the SDK this week and reinstalled (December/January) and it is still the 183.

And as him, I had no success with queryplc, I've tried to change the house code, add the module and everything that was mentioned in any of the 5 or 6 previous threads about the queryplc.

Bill, maybe only you has this ahscript version 3.0.0.200. That's why it only works with you! Where did you get it? (btw., I tried the link you provided in other threads and it was the same... 183).

Thanks,

Andrey



I honestly can't say where I got 3.0.0.200.  My best guess would be either a very early AHP or AHP update, or an earlier version of the SDK.   ???

I have emailed X10 about the issue, but, so far no reply as to why they reverted to an older version of the file.   :(
Logged
-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!

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: Query plc does work, but.................
« Reply #13 on: June 09, 2009, 12:18:24 AM »

I am building a web app and am having some issues with this as well.  For starters it is not allowing me to create an ActiveX object, so I am stuck using the EXE instead of the DLL.

Code: [Select]
    Public Shared Function OnOffStatus(ByVal address As String) As Boolean
        Dim onoff As Boolean
        Dim startInfo As System.Diagnostics.ProcessStartInfo
        Dim proc As System.Diagnostics.Process

        startInfo = New System.Diagnostics.ProcessStartInfo()

        With startInfo
            .FileName = "cmd"
            .Arguments = "/C """ & AHSDK & """ queryplc " & address & " on"
            .LoadUserProfile = True
            .UseShellExecute = False
            .RedirectStandardOutput = True
        End With

        proc = System.Diagnostics.Process.Start(startInfo)

        Select Case proc.StandardOutput.ReadToEnd
            Case "0" : onoff = False
            Case "-1" : onoff = False
            Case "1" : onoff = True
        End Select

        proc.WaitForExit()

        Return onoff
    End Function

The problem is that it is not returning anything (not a 1, not a 0, nothing).  Does anyone know what could be the problem?
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: Query plc does work, but.................
« Reply #14 on: June 11, 2009, 04:08:37 PM »

I wanted to also mention that I have tried running the exact same command from the command line and am getting no results.

I have run
Code: [Select]
C:\Program Files (x86)\Common Files\X10\Common>ahcmd "queryplc" "a1 on" and nothing is returned, it simply goes down a line without anything returnd in the CMD screen... anything I'm missing?

PS: I am running the 200 version.
Logged
Pages: [1] 2
 

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