Jump to content

AD2USB -> NSLU2 -> ISY-99


kevkmartin

Recommended Posts

I am trying to get my Ademco Vista 20 panel successfully communicating with my ISY-99.

 

Based on research, it seems the best way to do that is to use an AD2USB device, connected to a hacked NSLU2 to create a "Network Device" that can communicate directly with the Ademco Panel.

 

So far, I have acquired an AD2USB, downloaded the ser2sock.c software, and hacked (uNSULng) the NSLU2.

 

I am having a great deal of difficulty on how to proceed.

 

I believe the next step is to cross-compile ser2sock.c on the NSLU2.

 

Has anyone successfully done this?

 

All help appreciated!

Link to comment

I've never used that device but I have been playing around with the NSLU integrated with the isy-99i. (I posted some threads in the Network Resources secton). Which software version did you use to hack your NSLU? I used the basic one - Unslung.

 

I've had to compile one program on my NSLU. I had to download the development package wich included the compilers. I looked quick, but I couldn't figure out what I loaded. Once you have that, you sould be able to compile that program.

 

Based on this article:

http://www.nslu2-linux.org/wiki/Applications/AlarmSlug It looks like the NSLU should recognize the USB adapter with the built in drivers?

 

I'll look so more for the compilers, and see if I can figure out what I used.

Link to comment

Waht I did was load the package called optware-devel. On my Unslung version it's :

 

 

ipkg install optware-devel

 

It's a really large package. 150mb+ I think. Some additional informaiton here: http://www.nslu2-linux.org/wiki/HowTo/N ... ngPackages

 

That package includes a bunch of stuff. More than is probably necessary. Someplace it installs gcc the c compiler. I think that's what you will need. You should be able to move forward from there.

Link to comment

I don't think I made any changes. When I was using it, it was to compile a module to be used with the LUA interpreter. ( a language I know very little about ). I used the MAKE and .config that came with it.

 

Did you reboot the NSLU after making that changes? Maybe some environment variable needs to be set?

 

David

Link to comment

I just logged into my NSLU, using puTTy in WINSCP. I logged in as ROOT. At the command line I type just GCC and I got "no input files". So it's finding GCCc fine.

 

Does your c program require something else? Is it downloadable someplace? I could try and compile it and see what errors I might get. If it compiles on mine, that it would be some kind of config issue at your end.

Link to comment

I was able to compile it. I had to move it into /opt/bin to make it execute. Then change the permissions 0755.

 

I couldn't upload it as it was - it doesn't have an extension.

 

Rename it to just ser2sock from ser2sock.zip. I copied it using WinSCP from the NSLU. I hope it goes back jsut as easily.

 

If you can't download it from here, I'll email. Let me know if that works.

ser2sock.zip

Link to comment

Here is the output I get when I run it:

 

Welcome to Unslung V2.3R63-uNSLUng-6.10-beta

 

---------- NOTE: THIS SYSTEM IS CURRENTLY UNSLUNG ----------

 

 

BusyBox v1.3.1 (2007-12-29 03:38:35 UTC) Built-in shell (ash)

Enter 'help' for a list of built-in commands.

 

# ser2sock

Usage: ser2sock -p -s

 

-h, -help display this help and exit

-p port socket port to listen on

-s serial device ex /dev/ttyUSB0

options

-i IP bind to a specific ip address default is ALL

-b baudrate set buad rate default to 9600

-d daemonize

-t send terminal init string

-g debug level 0-3

-c keep incoming connections when a serial device is disconnected

-w milliseconds delay between attempts to open a serial device (5000)

 

Error missing serial device name exiting

#

Link to comment

Interested where you go with this

I just got an ad2usb last week

I have perl code reading the ad2usb output then making rest calls to the iSy to set state variables based on zone changes

I will probably make a page on my Linux box that an iSy network resource can call and drive my panel via the ad2usb

Link to comment

Hopefully this is usable to you. Not much error checking yet. And...obviously need to store things like hostname, passwords, etc in variables.

 

I put any faulted zones in an array. As we get "ready" messages from the panel, I move the arrays to old and older. Once I have a now, old, and older...I can look at the values and make sure the event actually happened. I really struggled with this logic.

Once an even happens, I run a rest command to update the state variable in the ISY as well as update a SQL table.

I have planned changes to pick up the LRR output to record who armed/disarmed.

 

 

#!/usr/bin/perl -w

use strict;

use Switch;

use DBI;

 

my $database = 'house';

my $server = 'localhost';

my $user = 'insteon';

my $passwd = 'insteon';

 

our $DB = DBI->connect("dbi:mysql:$database:$server", $user, $passwd, {PrintError => 0} );

open (SERFH, "/usr/bin/tail -f /dev/ttyUSB0 |") || die "Can't tail device\n";

 

our @active_alarms = (0,0,0,0,0,0,0,0,0,0,0,0,0,0);

our @last_alarms = (0,0,0,0,0,0,0,0,0,0,0,0,0,0);

our @oldest_alarms = (0,0,0,0,0,0,0,0,0,0,0,0,0,0);

our $previous_arm_status = "Unknown";

my $output;

while ()

{

switch ($_)

{

case /\[1/ { armed_status("Unarmed"); }

case /\[.1/ { armed_status("Armed away"); }

case /\[..1/ { armed_status("Armed home"); }

case /\[............1/ { armed_status("Armed instant"); }

case /\[...............1/ { armed_status("Armed stay"); }

case /FAULT/ { $output =$_;

$output =~ s/.*FAULT//;

$output =~ s/\s//;

$output =~ s/^0//;

$output =~ s/"//;

$output =~ s/\s.*//;

chomp ($output);

$active_alarms[$output] = 1;

}

} #switch

} #while

 

sub armed_status

{

my $now = localtime();

my $system_cmd;

my $new_arm_status = shift;

if ($previous_arm_status ne $new_arm_status)

{

sql_update(0,$new_arm_status);

$previous_arm_status = $new_arm_status;

}

my $j = 0;

foreach (@active_alarms)

{

if (($oldest_alarms[$j] == 1) and ($last_alarms[$j] == 0) and ($active_alarms[$j] == 0))

{

print "Delete zone $j $now\n";

$system_cmd = "/home/isy/isy_rest --isy isy99-home-auto --username admin --password 123 /vars/set/2/" . $j . "/0 ";

system ($system_cmd);

sql_update ($j,0);

}

if (($oldest_alarms[$j] == 0) and ($last_alarms[$j] == 0) and ($active_alarms[$j] == 1))

{

print "Add zone $j $now\n";

$system_cmd = "/home/isy/isy_rest --isy isy99-home-auto --username admin --password 123 /vars/set/2/" . $j . "/1 ";

#print "$system_cmd\n";

system ($system_cmd);

sql_update ($j,1);

}

$j ++;

}

@oldest_alarms = @last_alarms;

@last_alarms = @active_alarms;

@active_alarms = (0,0,0,0,0,0,0,0,0,0,0,0,0,0);

}

 

sub sql_update

{

my $node = shift;

my $status = shift;

my $query = sprintf "UPDATE alarm SET status='%s' WHERE zone='%s'",$status,$node;

print "$query\n";

my $rows_affected = 0;

$rows_affected = $DB->do($query);

}

Link to comment
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.6k
×
×
  • Create New...