CTX35 read input compatibility

Forum about Xanura, Eaton Holec and Marmitek and other brand X10 and A10 devices.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

Hi,

I just got my ctx35, i´ve got it to work under linux but the DIM function dont seem to work although the manual says a A2ADIM should be it. But where do you put the amount of dimming? it just put it at 100%

Also when i try to read out my serial port and send X10 commands (not Xanura) commands i dont see anything from the device. Although its compatible with X10 it does not send this out from the device?

It does reply to my commands and i get a normal return back.

Any other linux persons that have a clue for me?
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Digit »

Hi,

The only hint i can give you is that my ACT TI-213 (=equivalent to ctx35 more or less) docs say that when it responds back with the command you sent to it, this means that the device has succesfully sent the command over the powerline. So i would first make sure it is really not sent out on the powerline.

I have no DIM experience (more the binary type), so can't help you with that.

Regards,
Robert.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

Well sending is not the issue this works since my devices go on and off. If i use a RF remote that transfers it to X10 i want to see this command coming by my ctx35 so i can update the status of a device.
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Bwired »

Hi Snelvuur
I don't if I understand your problem the right way but you need to query the CTX35 every time to see if there is data received.
I query the CTX35 with "$>2800008C#" and it's returning all the incoming X10 signals like for example the X10 code generated by the MS13A motion sensor.
Pieter
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

Pieter,

Thats where i'am stuck. I can send everything but i dont know how to see for instance a ms13a sensor code coming by. I have my /dev/ttyS0 and i can put a tail on it and send data to it. I get reply's when i send a "on" signal for instance. (i get the "$<2800!4" returned which is OK) but i dont see anything else. Do i need to put it into a different state and if so is that still allowing me to send signals to it?

I tried to query it with the command you gave me but its only showing back the "$<2800!4" with no extra new data. But i did turn on some light via remote.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

(tried to upload but didn't work, so sorry if this is bad)

Ti103.pl code seperated from misterhouse but still the polling is a bit off for me. Here is what i have sofar (might be handy for others)

You still have to use normal naming codes like "A1AON" to turn device A1 from housecode A on.

#!/usr/bin/perl

my %X10Preset2 = (
"M" => 0,
"N" => 1,
"O" => 2,
"P" => 3,
"C" => 4,
"D" => 5,
"A" => 6,
"B" => 7,
"E" => 8,
"F" => 9,
"G" => 10,
"H" => 11,
"K" => 12,
"L" => 13,
"I" => 14,
"J" => 15,
);

my %X10Preset = (
"M7" => 0,
"ED" => 5,
"EC" => 10,
"C7" => 15,
"KD" => 20,
"K4" => 25,
"O7" => 30,
"OA" => 35,
"G6" => 40,
"AF" => 45,
"AA" => 50,
"I6" => 55,
"NF" => 60,
"N2" => 65,
"F6" => 70,
"DB" => 75,
"D2" => 80,
"LE" => 85,
"PB" => 90,
"P8" => 95
);

my %X10Unit = (
"1" => "01",
"2" => "02",
"3" => "03",
"4" => "04",
"5" => "05",
"6" => "06",
"7" => "07",
"8" => "08",
"9" => "09",
"A" => "10",
"B" => "11",
"C" => "12",
"D" => "13",
"E" => "14",
"F" => "15",
"G" => "16",
"J" => "ON",
"K" => "OFF",
"O" => "AUN",
"P" => "AUF"
);

sub sendblk {
my ($port, $str) = @_;
my $data = "\$>28001" . $str ;

my $cksum = 0;
my $n_char = "";
my @loc_char = split (//, $data);
foreach $n_char (@loc_char) {
$cksum += ord($n_char);
}
$data = sprintf("%s%02X#",$data,$cksum % 256);
return 0 unless $data;
printf("TI103 send: $data\n");
print $port "$data";

return 1;
}

sub mysend {
my ($port, $X10String) = @_;

my $X10Cmd = "";
my $ret = 1 ;


printf("TI103.pm: X10Command[$X10String]\n") ;

$X10String = uc($X10String);

$X10String =~ s/ALL_LIGHTS_OFF/#01/;
$X10String =~ s/EXTENDED_CODE/#02/;
$X10String =~ s/EXTENDED_DATA/#03/;
$X10String =~ s/HAIL_REQUEST/#04/;
$X10String =~ s/HAIL_ACK/#05/;
$X10String =~ s/PRESET_DIM1/#06/;
$X10String =~ s/PRESET_DIM2/#07/;
$X10String =~ s/STATUS_ON/#08/;
$X10String =~ s/STATUS_OFF/#9/;
$X10String =~ s/STATUS/#10/;
$X10String =~ s/ALL_LIGHTS_ON/#11/;

$X10String =~ s/BRIGHT/L/;
$X10String =~ s/DIM/M/;
$X10String =~ s/ALL_ON/O/;
$X10String =~ s/ALL_OFF/P/;
$X10String =~ s/ON/J/;
$X10String =~ s/OFF/K/;

printf("TI103.pm: X10Command[$X10String]\n") ;

my $Cmd = "" ;

my @str = split (//, $X10String);

my $ii = 0;
while ($str[$ii]){
$Cmd = "";
my $House = $str[$ii++];
# need to log an error here
return unless $str[$ii]; # report incomplete data error
if ($House !~ /[A-P]/) {
printf("TI103.pm: invalid house code [$House]\n") ;
return ;
}
my $Type = $str[$ii++];
if ($Type =~ /[1-9A-GJKOP]/) {
#printf("House code Unit code\n");
$X10Cmd .= $House . $X10Unit{$Type} ;
} elsif ($Type =~ /[LM\-\+\&]/) {
#printf("Dim/Bright\n");
if ($Type =~ /[\+\-]/) { # Bright/Dim with Value
if ($str[$ii] =~ /[\{\[\(]/) { $ii++; }
my $val = 0;
while ($str[$ii] =~ /[0-9]/) { $val .= $str[$ii++]; }
if ($str[$ii] =~ /[\}\]\)]/) { $ii++; }
return unless $val < 100;
return unless $val > 0;
$Type =~ s/\+/B/;
$Type =~ s/\-/D/;
$X10Cmd .= sprintf("%s%s%02d", $House, $Type, $val);
} elsif ($Type eq "&") { # Preset (1-63)
return unless ( $str[$ii++] eq "P\n");
if ($str[$ii] =~ /[\{\[\(]/) { $ii++; }
my $val = 0;
while ($str[$ii] =~ /[0-9]/) { $val .= $str[$ii++];}
if ($str[$ii] =~ /[\}\]\)]/) { $ii++; }
$val = ($val < 10) ? "0" . $val : $val;
$X10Cmd .= $House . "X" . $val ;
} elsif ($Type eq "L") { # fixme Brighten as per Misterhouse way (+40)
$X10Cmd .= $House . "BGT" ;
#X10Cmd .= $House . "B40"; # "BGT" ;
} elsif ($Type eq "M") { # fixme Dimmer as per Misterhouse way (-40)
printf("A dim command\n");
$X10Cmd .= $House . "DIM" ;
#X10Cmd .= $House . "D40"; # "DIM" ;
} else {
printf("Fall through ($Type)\n");
}
} elsif ($Type =~ /[#]/) {
my $val = 0;
while ($str[$ii] =~ /[0-9]/) { $val .= $str[$ii++];}
if ($val == 1 ) {
$X10Cmd .= $House . "AUF";
} elsif ($val == 2 ) {
# $X10String =~ s/EXTENDED_CODE/#02/;
#$X10Cmd .= $House . "";
#Extended Code
# $>28001 A[1]01 3F 31 A[1]013F31 2D#
} elsif ($val == 3 ) {
# $X10String =~ s/EXTENDED_DATA/#03/;
#$X10Cmd .= $House . "";
} elsif ($val == 4 ) {
$X10Cmd .= $House . "HRQ" ;
} elsif ($val == 5 ) {
$X10Cmd .= $House . "HAK";
} elsif ($val == 6 ) {
# $X10String =~ s/PRESET_DIM1/#06/;
$X10Cmd .= sprintf("DIM%02d", $X10Preset2{$House});
} elsif ($val == 7 ) {
# $X10String =~ s/PRESET_DIM2/#07/;
$X10Cmd .= sprintf("DIM%02d", ($X10Preset2{$House}+16));
} elsif ($val == 8 ) {
$X10Cmd .= $House . "SON";
} elsif ($val == 9 ) {
$X10Cmd .= $House . "SOF";
} elsif ($val == 10 ) {
$X10Cmd .= $House . "SRQ";
} elsif ($val == 11 ) {
$X10Cmd .= $House . "ALN";
} else {
printf("TI103.pm: invalid Macro code [$val]\n") ;
return ;
}

} else {
printf("TI103.pm: invalid Type code [$Type]\n") ;
return ;
}
}

printf("TI103.pm: SendX10 Complete X10 command [$X10Cmd]\n") ;
sendblk($port, $X10Cmd);
return ;
}

# This is cheating and non-portable

my $string;

$port = "/dev/ttyS0";

open(SNET, "+>$port") || die("Can't open $port!\n");

system("stty 19200 -echo < $port"); # This looks wrong!

foreach $string (@ARGV) {
mysend(SNET, $string);
}

#sendblk(SNET, "$>2800008C#");
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Bwired »

Hi Radipfire,
If there is nothing to receive I get the "$<2800!4B#" on my comport when I query the CTX35. If there is something to receive I receive data like "$<2800! C01C01B3#" "$<2800! CONCON2B#"
Sorry but I'm not in to Perl, I'm a Microsoft guy :-)

btw you can only upload: ".jpg", ".pdf", ".gif", ".zip", ".doc", ".jpeg", ".txt"
so please rename the file to .txt in the future.

Pieter
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Bwired »

Perhaps this helps? the TI103-RS232 (ctx35) instruction manual.
<b>Download Attachment:</b> [img]images/icon_paperclip.gif[/img] TI103 instructions<br />
check also the page of Phil Kingery regardding the TI103 CTX35 http://www.act-solutions.com/kingery16.htm
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

Pieter,

I use my rf remote to power on x10 stuff with a rf->x10 receiver from x10 too. Can it be that i dont see any new messages from the ctx35 because those messages are x10 and not xanura x10? That i need a xanura remote with a xanura receiver? Because i'am switching on/off the whole house by all kinds of stuff but when i try to send the query it always sends back "$<2800!4B#" and nothing more.
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Bwired »

A10 and X10 is fully compatible. I use mostly Xanura products. Note that still some of the Xanura products are exactly the same as the Marmitek. For example the MS13A is the same product for both campany's. As said before I receive my Marmitek MS13A on the CTX35. The CTX35 has a buffer, so if I query the CTX35 after 5 minutes I receive a lot of commands.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

Ok, just checking since i'am pretty new in trying to get a piece of perl code to work which is bigger then my normal "hello world" and i want it to work nicely also so that others can use it too.
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

The person that goes on wins.. i finally got more understanding on the protocol and how its used with the serial port under perl too.

$<2800! A07A07 AONAON A01A01 AONAON A02A02 AONAON A03A03 AONAON A07A07 AOFFAOFF A01A01 AOFFAOFF A02A02 AOFFAOFF A03A03 AOFFAOFF5F#$<2800!4 is one of the responses coming back for the ctx35 under perl in linux.

Pieter, what is your poll interval under visual basic? Do you read it every second or after 5 minutes? Do you have a understanding how to parse the data, is it always 2 segments of data for a unit?

Getting at least closer, at one point i almost gave up and looked at homeseer again. I felt so down about homeseer that i went back and tried and tried untill it worked hehe.
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Bwired »

Ok that is good News!
You are right about the segments but its not always like that. for example Dim
its $<2800! ADIMADIMADIM[chksum]#
I'm still working on my driver as well so haven't figure it all out yet. Just send as much different X10 commands on the powerline and then query the CTX35.
The polling frequency depends on your needs, for example: if you want to switch on a light after the MS13A is triggered by motion the polling frequency should be very high. BTW it is to bad that the CTX35 is not sending directly the received data on the rs232.
Did you also handle the checksum for every command.
Regards.Pieter
User avatar
Snelvuur
Forum Moderator
Forum Moderator
Posts: 3156
Joined: Fri Apr 06, 2007 11:01 pm
Location: Netherlands
Contact:

CTX35 read input compatibility

Post by Snelvuur »

I´am not 100% sure into how all works, because i got the part working for sending with a valid checksum. Only when i send the query one it doesn´t answer straight away. I have to send another command over that with a checksum too to get a response. And this only works after i do a manual `echo $>2800008C# > /dev/ttyS0´ have to dig a bit deeper and look more at the code i got from people.

I also notice a part about reading the serial port waiting for ´let the 0xc3 ack take hold´ sounds like there is some sort of response from the serial port you might use to know some data has arrived. Not sure thought need more time which is the biggest issue.
User avatar
Willem4ever
Global Moderator
Global Moderator
Posts: 805
Joined: Mon Oct 30, 2006 3:48 pm
Location: Uithoorn / Netherlands

CTX35 read input compatibility

Post by Willem4ever »

Snelvuur, if you are a 'C' person you can have a look at my code. Its need cleaning up, but it should get you started.
Post Reply

Return to “X10, A10 Xanura Marmitek Forum”