Thanks for trying to help. I figured it out after some tinkering. Here
is my code. It allows me to be notified in case of an open door. I have
yet to install conditions to check if security is armed or disarmed, but
this is real basic. It also turns on a simple camera when the window is
opened. I am going to try to get a timer function built around the
camera though. I built this project to do a demonstration at school and
will eventually implement to my home for more practical use.
Thanks,
Tim M.
-------------------------------------------
$weeder_port =3D new Serial_Item( "AX0", 'init', 'weeder');
$weeder_port -> add ("A!", 'reset','weeder');
my $living_window;
#During startup or when the weeder powers up we want to configure it:=20
if ($Startup or (state_now $weeder_port eq 'reset') or $Reload){
$living_window =3D new Serial_Item("AIH", 'opened', 'weeder');
$living_window -> add ("AIL", 'closed');
$living_window -> add ("ARI", 'read');
$living_window -> add ("ASI", 'init');
$kitchen_door =3D new Serial_Item("ALH", 'open', 'weeder');
$kitchen_door -> add ("ALL", 'closed');
$kitchen_door -> add ("ARL", 'read');
$kitchen_door -> add ("ASL", 'init');
$camera =3D new Serial_Item("ALN", 'on', 'weeder');
$camera -> add ("ASN", 'off');
$camera -> add ("ASN", 'init');
select(undef,undef,undef,0.25);
set $weeder_port 'init';
#select(undef,undef,undef,0.25);
set $living_window 'init';
set $kitchen_door 'init';
set $camera 'init';
}
my $remark1 =3D "window unknown";
my $remark2 =3D "door unknown";
my $alert=3D0;
$test1_button =3D new Serial_Item('AIL');
if (state_now $test1_button) {
$remark1 =3D "living room window closed";
print_log "$remark1";
set $camera 'off';
speak $remark1;
}
$test2_button =3D new Serial_Item('AIH');
if (state_now $test2_button) {
$remark1 =3D "living room window opened";
print_log "$remark1";
speak $remark1;
set $camera 'on';
$alert=3D1;
}
$test3_button =3D new Serial_Item('ALL');
if (state_now $test3_button) {
$remark2 =3D "KITCHEN DOOR CLOSED";
print_log "$remark2";
speak $remark2;
}
$test4_button =3D new Serial_Item('ALH');
if (state_now $test4_button) {
$remark2 =3D "KITCHEN DOOR opened";
print_log "$remark2";
speak $remark2;
$alert=3D1;
}
$my_test1 =3D new Voice_Cmd 'check [window,door,3]';
if ($state =3D said $my_test1) {
if ($state eq "window") {
speak "$remark1";
}
elsif ($state eq "door") {
speak "$remark2";
}
elsif ($state =3D=3D 3) {
print_log "Test 3 to the print log";
}
}
if ($alert=3D=3D1)
{
my $subject=3D"";
if ($remark1 eq "living room window opened") {$subject=3D$remark1;}
if ($remark2 eq "KITCHEN DOOR opened") {$subject=3D$remark2;}
if (&net_connect_check) {
# Use to =3D> 'user@...', or default to your own address (from
net_mail_account_address in mh.ini)
&net_mail_send(subject =3D> "$subject", text =3D> "email sent at
$Time_Date",
# to =3D> 'bruce@... ;
winter@...',
debug =3D> 1);
speak "Security Notification has been sent";
$alert=3D0;
}
else {
speak "Sorry, you are not currently logged on to the internet,
so I can not send mail";
}
}
---------------------------------------------------------------------
-----Original Message-----
From: misterhouse-users-admin@...
[mailto:misterhouse-users-admin@...] On Behalf Of Jeff
Sent: Wednesday, August 10, 2005 7:39 PM
To: misterhouse-users@...
Subject: RE: [mh] can't figure out how to init the weeder board
And what is the exact error?
At 4:07 PM -0500 8/10/05, Tim McCann wrote:
>Actually I am using weeder_init.pl - I just put foo in as that is a
>universal variable.
>
>All I want is to send the weeder board ASI and ASL on startup for now.
>When I use weeder_init.pl I replaced the variables with my sensor names
>(only 2 to begin with). Aw heck here is the code I am running - no
>laughing though:
>
Jeff Pagel, MIEEE
jeff AT pagel D0T net http://www.pagel.net (715)359-8033
Cell:(715)551-9283
------------------------------------------------------------------------
------
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing &
QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
________________________________________________________
To unsubscribe from this list, go to:
http://sourceforge.net/mail/?group_id=3D1365
|