Please login or register.

Login with username, password and session length
Pages: 1 [2]

Author Topic: How are we supposed to send RAW commands?  (Read 18952 times)

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #15 on: November 12, 2012, 02:53:25 PM »

You had better do all of your research before the trial period ends !
I have always put up with the delay when stringing multiple commands together. In fact, I padded them with thread.sleep values in between each command, just to make sure that I didn't lock up the interface. If you have some sort of x10 controller and you set two devices with different codes to go on at the same time, is there any delay ?. I just have the sdk installed and no AHP. You should be able to create anything that AHP can do.


Yeah, I'm gonna cut my teeth into this tonight when I get off work. I'll run the AHP software through the sniffer and see what comes out. AHP doesn't "seem" to have a delay in my setup. When I say "Living Room Lights On", my lamp module and my two light switches appear to receive and execute the commands at the same time.
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #16 on: November 12, 2012, 02:54:53 PM »

PS: the lite version of that software isn't too expensive if I had to purchase it beyond the 14 days... thanks for the recommendation.
Logged

spval

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 30
Re: How are we supposed to send RAW commands?
« Reply #17 on: November 12, 2012, 02:58:15 PM »

It is great software. Good luck with the project.
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #18 on: November 12, 2012, 03:31:25 PM »

Interesting followup... I suppose I'm still not fully understanding .

Here's the output from running A1 through to B16, all with "on" commands.

Code: [Select]
04 66 06 62
04 6e 06 62
04 62 06 62
04 6a 06 62
04 61 06 62
04 69 06 62
04 65 06 62
04 6d 06 62
04 67 06 62
04 6f 06 62
04 63 06 62
04 6b 06 62
04 60 06 62
04 68 06 62
04 64 06 62
04 6c 06 62
04 e6 06 e2
04 ee 06 e2
04 e2 06 e2
04 ea 06 e2
04 e1 06 e2
04 e9 06 e2
04 e5 06 e2
04 ed 06 e2
04 e7 06 e2
04 ef 06 e2
04 e3 06 e2
04 eb 06 e2
04 e0 06 e2
04 e8 06 e2
04 e4 06 e2
04 ec 06 e2

Notice how A1 - A16 all end in "06 62"? I was under the impression that "06 62" was the equivalent of "on"
however
Notice how B1 - B16 all end in "06 e2"? That must mean that there's a different "on" trigger for each house code?

It's the same with "Off" codes... A1 - A16 end in "06 63", where B1 - B16 end in "06 e3"...

Logged

spval

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 30
Re: How are we supposed to send RAW commands?
« Reply #19 on: November 12, 2012, 03:53:55 PM »

Your observations are correct. Actually, the ending "2" is the "on" and an ending "3" would be "Off". Fun, eh ?
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #20 on: November 12, 2012, 05:21:58 PM »

Logged

spval

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 30
Re: How are we supposed to send RAW commands?
« Reply #21 on: November 12, 2012, 06:01:37 PM »

Did you ever get a chance to read the x10 protocol info. There is a outline of what the hex codes stand for. For instance, the beginning "04" is probably always constant (a checksum or header), so you wouldn't have to deal with it.

Have a look at this url:

http://software.x10.com/pub/manuals/cm11a_protocol.txt

« Last Edit: November 12, 2012, 06:15:24 PM by spval »
Logged

spval

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 30
Re: How are we supposed to send RAW commands?
« Reply #22 on: November 13, 2012, 05:28:41 AM »

Here is the code to receive an event, just in case you didn't have it already:

C#:
using ActiveHomeScriptLib;
using System.Threading;
public class Form1
{
   ActiveHomeScriptLib.ActiveHome ActiveHomeObj;

   private void  // ERROR: Handles clauses are not supported in C#
Form1_Load(object sender, EventArgs e)
   {
      ActiveHomeObj = new ActiveHome();

   }


   public void  // ERROR: Handles clauses are not supported in C#
ActiveHome_RecvAction(object bszRecv, object vParm1, object vParm2, object vParm3, object vParm4, object vParm5, object vReserved)
   {
      TextBox1.Text = (bszRecv + "  " + " " + vParm1 + " " + vParm2 + " " + vParm3 + " " + vParm4 + " " + vParm5) + Constants.vbCrLf;
      TextBox2.AppendText(TextBox1.Text);
   }


   private void  // ERROR: Handles clauses are not supported in C#
Button1_Click(object sender, EventArgs e)
   {
      ActiveHomeObj.SendAction("sendrawplc", "04 66");
      // CM15A replies with 0x55  (always)
      ActiveHomeObj.SendAction("sendrawplc", "06 62");
      // turn A1 On
      // CM15A replies with 0x55  (always)
   }


   private void  // ERROR: Handles clauses are not supported in C#
Button2_Click(object sender, EventArgs e)
   {
      ActiveHomeObj.SendAction("sendrawplc", "04 66");
      // CM15A replies with 0x55  (always)
      ActiveHomeObj.SendAction("sendrawplc", "06 63");
      // turn A1 Off
      // CM15A replies with 0x55  (always)
   }
}

VB:
Imports ActiveHomeScriptLib
Imports System.Threading
Public Class Form1
    Dim WithEvents ActiveHomeObj As ActiveHomeScriptLib.ActiveHome
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ActiveHomeObj = New ActiveHome

    End Sub

    Sub ActiveHome_RecvAction(ByVal bszRecv As Object _
                      , ByVal vParm1 As Object _
                      , ByVal vParm2 As Object _
                      , ByVal vParm3 As Object _
                      , ByVal vParm4 As Object _
                      , ByVal vParm5 As Object _
                      , ByVal vReserved As Object) Handles ActiveHomeObj.RecvAction

        TextBox1.Text = (bszRecv & "  " & " " & vParm1 & " " & vParm2 & " " & vParm3 & " " & vParm4 & " " & vParm5) & vbCrLf
        TextBox2.AppendText(TextBox1.Text)
    End Sub
   

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ActiveHomeObj.SendAction("sendrawplc", "04 66")
        ' CM15A replies with 0x55  (always)
        ActiveHomeObj.SendAction("sendrawplc", "06 62") ' turn A1 On
        ' CM15A replies with 0x55  (always)
    End Sub

   
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ActiveHomeObj.SendAction("sendrawplc", "04 66")
        ' CM15A replies with 0x55  (always)
        ActiveHomeObj.SendAction("sendrawplc", "06 63") ' turn A1 Off
        ' CM15A replies with 0x55  (always)
    End Sub
End Class

The first portion of that protocol page contained the basic x10 protocol that you needed, but the rest was written for a CM11A interface. I don't want you and your buddies at stackoverflow.com to get off on a wild goose chase.
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #23 on: November 13, 2012, 11:47:02 AM »

Yeah I appreciate this. The code that @AbdiasSoftware posted on my question is a little uh, overwhelming.

I know how to write code to execute the calls against the SDK, and I'm not at all worried about that part in my project.

All I was trying to do is find a correlation between the raw calls and the human readable calls, and write a function that would return the appropriate raw codes when the human readable codes are input.

Since I haven't found a way to string multiple raw codes together in a single call, this whole adventure might be moot. I might as well use the human readable codes.

Code: [Select]
   ahsdk.SendAction("sendplc", "A1 ON");
   //wait for a "0" response
   ahsdk.SendAction("sendplc", "A2 DIM 20");
   // rinse / repeat

To me, this looks ugly, and I was hoping that the `sendrawplc` would allow the equivalent of

Code: [Select]
    ahsdk.SendAction("sendplc", "[{A1 ON}, {A2 DIM 20]}");
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #24 on: November 13, 2012, 02:53:47 PM »

looks like my friends over at StackOverflow don't like my question :(
Logged

spval

  • Full Member
  • ***
  • Helpful Post Rating: 1
  • Posts: 30
Re: How are we supposed to send RAW commands?
« Reply #25 on: November 13, 2012, 03:14:26 PM »

I see one very small shortcut:
For stacked commands, if the HC and Function are the same, you can do a
ActiveHomeObj.SendAction("sendrawplc", "04 66");
ActiveHomeObj.SendAction("sendrawplc", "04 65");
ActiveHomeObj.SendAction("sendrawplc", "04 64");
ActiveHomeObj.SendAction("sendrawplc", "04 63");
ActiveHomeObj.SendAction("sendrawplc", "04 61");

followed by a single Function command:
ActiveHomeObj.SendAction("sendrawplc", "06 62");

I suppose this saves some time. Bottom line seems to be only one HC/Device per packet.
Logged

rockinthesixstring

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 24
Re: How are we supposed to send RAW commands?
« Reply #26 on: November 14, 2012, 12:58:19 PM »

This is what I needed

Code: [Select]
Housecode Device Code Binary Value Hex Value
A 1 0110 6
B 2 1110 E
C 3 0010 2
D 4 1010 A
E 5 0001 1
F 6 1001 9
G 7 0101 5
H 8 1101 D
I 9 0111 7
J 10 1111 F
K 11 0011 3
L 12 1011 B
M 13 0000 0
N 14 1000 8
O 15 0100 4
P 16 1100 C
Logged
Pages: 1 [2]
 

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