#!/usr/bin/perl -w ############################################################################### # lightsoff.pl - Danny Sauer - cloudmaster@cloudmaster.com # turns all lights in my room off # # 1.0 - simple script put together # I think it was based on example code from the X10 module... # 1.1 - changed around a little so it can more easily be modified by others # added $house and $defaultport, specifically # also added comments # # ToDo - modify the programs to behave as on or off based on argv[0] # # Keep everything in this comment box unmodified, you can do whatever else # you want to this program (except claim you originally wrote it). ############################################################################### # you (prolly) need to set the house code for your location, # and maybe the default serial port (AKA $defualtport) my $house = 'D'; my $defaultport = '/dev/ttyS0'; ############################################################################### # you don't need to change anything else (I hope). # It's not like there's a lot *to* change... :) ############################################################################### use Device::SerialPort 0.06; use ControlX10::CM17 qw( send_cm17 0.05 ); my $port = shift @ARGV || $defaultport; my $serialp = Device::SerialPort->new($port,1) || die "Can't open $port: $^E\n"; my $command = $house . 'N'; send_cm17($serialp, $command);