Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Linux smart homes for dummies - part 9 pdf
PREMIUM
Số trang
52
Kích thước
1.6 MB
Định dạng
PDF
Lượt xem
1006

Linux smart homes for dummies - part 9 pdf

Nội dung xem thử

Mô tả chi tiết

Wireless remotes

• UR19A: Wireless remote

• KR19A (SlimFire): Wireless keychain remote

• KR22A: Wireless credit card remote

Wireless kits

• CK18A: X10’s wireless kit

X10 is now supporting the CM15A and has discontinued the CM17A, MR26A,

and CM19A controllers (computer interfaces). The CM15A is too new to have

software available for Linux. (The Linux community doesn’t have the details to

program the new device yet.) But not to worry! There are plenty of places on

the Internet where you can purchase these devices. And the X10 devices are

very popular with online auctions. I did a search and found several CM17As

still available, and I expect that they will be available for quite a while to come.

If you can, try to get the CM18A kit because it’s usually a better deal than the

CM17A alone. The kit comes with the CM17A Firecracker, Palmpad Remote, a

lamp module, and a TM751 wireless transceiver.

The CM17A is an X10 wireless transmitter that isn’t limited to a single house

code (as are the wireless remotes). It can send to all 16 house codes and all

16 unit codes (for a total of 256 unique X10 addresses). The TM751 trans￾ceiver has a built-in module for controlling appliances. This module can be

controlled only by wireless signals. If you’d like a wireless transceiver that

can accept both the power line and wireless commands, the RR501 trans￾ceiver is probably a better choice than the TM751. Both the TM751 and the

RR501 translate the wireless command to a PLC command so that other mod￾ules can also be controlled. Both transceivers are limited to a single house

code. This means that if the CM17A transmits an X10 command for J1 (house

code J, unit code 1), a wireless transceiver with a house code set for A won’t

translate the command for J onto the power line. But it can translate any X10

command with an A house code.

Gathering the Tools

In this chapter, I show you how to use the CM17A, a wireless X10 computer

interface, to send X10 commands from your computer to X10 transceivers

and modules. You have a choice of issuing an X10 command from either the

command line (using the BottleRocket command, br) or a Web interface pro￾vided by your Web server and BlueLava. BlueLava acts as a frontend to the

BottleRocket command. You will be able to access the Web interface from

Chapter 14: Going Wireless with X10 251

22_598236 ch14.qxp 6/27/06 7:41 PM Page 251

other browsers, not just those on your Linux computer. Here’s a list of what

you need:

Software

• httpd, Apache Web server (included with most distributions)

• Perl (included with most distributions)

• GCC compiler

• BlueLava (on this book’s CD, bluelava-0.4.3a.tar.gz)

• BottleRocket (on this book’s CD, bottlerocket-0.04c.tar.gz)

Hardware

• An available serial port

• Firecracker (X10 CM17A); costs about $17 on auction sites

• X10 wireless module (X10 RR501, PAT01, or TM751); costs about

$15–$25 at auction sites

Optional

• Additional X10 modules; they cost about $10–$50 at

www.smarthome.com

• Palmpad wireless remote; costs about $20 from X10

• A keychain remote; costs about $20 from X10

• A credit card remote; costs about $20 from X10

Software

httpd is the Apache Web server that comes with most distributions. It’s ver￾sion 2.0, but if you’re running a system with Apache 1.2, it should work. The

Perl programming language also comes with most distributions. I’m using

Perl version 5.8, but BlueLava should work with Perl version 5.6. All the

recent distributions of Linux use Perl 5.8. I’m not sure about using Perl 6.0

(it’s too new), so I don’t recommend it at this time. The BottleRocket soft￾ware package needs to be compiled, and any version of the GNU C compiler

should work.

BlueLava is the Web frontend, the software you’ll access with your Web

browser. BlueLava was created by Bruce A. Locke and is now maintained

by Ian Wilkinson. BottleRocket is the Firecracker software. BottleRocket

sends the X10 commands to the CM17A; Tymm Twillman created it, but I

now maintain it.

252 Part V: X10-ding Your Environment with Home Automation

22_598236 ch14.qxp 6/27/06 7:41 PM Page 252

Hardware

You need an unused serial port. There is one limitation on the kind of serial

port you may use: It must support control of the RS232 leads (DTR and RTS

specifically). Some USB adapters, such as those that support connectivity to

PDAs, don’t support control of the RS232 leads. I don’t know of any other

serial ports that have a problem with controlling the RS232 leads.

After you’ve decided on the port, just plug in the CM17A and make a note of

the serial port. It’s usually something like /dev/ttyS0 for COM1 or /dev/

ttyS1 for COM2. If you want, you can use a serial cable to move it away

from the back of the computer. This might help with the distance the signal

can travel because the metal computer case can block the X10 signal.

Setting Up the X10 Wireless Network

It’s time to get busy with configuration, compilation, and installation (and I

said it without inhalation) of the Apache (httpd), BlueLava, BottleRocket, and

the CM17A — Firecracker and X10 wireless module.

Setting up the X10 transceiver

Now would be a good time to set up the X10 transceiver, which is a simple

process that involves setting the dials to the X10 address. The X10 trans￾ceiver has two dials: The top one is the unit code (1 through 16), and the

bottom one is the house code (A through P). To change the unit and house

code, you turn the appropriate dial to set the X10 address. By default, the

address of a new module is set to A1.

The house code is very important because it’s the house code that the wireless

module will translate into a power line command. The house and unit code are

the X10 address that the wireless module will listen to for commands, but the

module will translate only X10 commands with the same house code. If you

want to change it to something other than the default, you can. If you have a

wireless remote, however, remember that the X10 house code that it transmits,

as part of the X10 command, must also match that of the wireless transceiver

so that it will translate or respond to the wireless commands. In other words, if

you change the house code of the transceiver, you must also adjust the house

code of the wireless remote so that they match.

The CM17A doesn’t need to be set up for an X10 house code because it can

send to any X10 address. As long as there is a wireless transceiver listening on

that address, the command will be acted upon or passed to the power line.

Chapter 14: Going Wireless with X10 253

22_598236 ch14.qxp 6/27/06 7:41 PM Page 253

Starting the Apache http server (httpd)

If you have Fedora 4 and you’ve installed everything, you need to perform

only a few commands to get httpd started. Other Linux distributions will

require different amounts of work but will be similar to the instructions found

here. If you don’t have Apache installed on your system, you need to install

it. Follow the directions for Apache at its home page: www.apache.org.

Apache serves up the BlueLava Web pages. BlueLava, in turn, calls on

BottleRocket to issue the X10 commands to the Firecracker, which sends the

wireless X10 signal to the wireless receiver to turn on/off the device attached

to the module. In Fedora, it’s very easy to turn on the Web server — just

follow these steps:

1. Type su - and press Enter to switch user (su) to the root user. When

you’re prompted for root’s password, enter it.

2. Type cd /etc/init.d and press Enter.

This command puts you in the directory with the startup scripts.

3. Type chkconfig --list httpd and press Enter.

This command checks to see what level the program will be run at. If

you get and error here, you might not have Apache installed. This is

what you should get back:

# chkconfig --list httpd

httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

4. Type chkconfig --level 345 httpd on and press Enter.

This turns the Web server on at levels 2, 3, 4, and 5. Next time you

reboot, the Web server will automatically start on its own.

5. Type chkconfig --list httpd and press Enter to double-check your work.

The output should look like this:

# chkconfig --list httpd

httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

6. Type ./httpd start and press Enter to start the Web server.

You see something like this:

# httpd start

Starting httpd: [ OK ]

If you use the chkconfig and set the levels that Apache will run at, you don’t

have to worry about restarting Apache each time you reboot Linux. It will

come up automatically. You needed to start it only this one time because it

wasn’t told to start when you last rebooted. You now have your own private

Web server on your machine. To see the Apache documentation, open your

Linux Web browser and enter the following in your browser’s address bar:

file:///var/www/manual/index.html.en

254 Part V: X10-ding Your Environment with Home Automation

22_598236 ch14.qxp 6/27/06 7:41 PM Page 254

This is the English-language Web page, but Web pages are available in other

languages, also. Just see the language links on the page.

Installing BlueLava

Now that you’ve started the Apache http server (it must be running before

BlueLava can be used), it’s time to install BlueLava. To install it, follow these

steps:

1. Take the CD from the back of this book and insert it into your

CD-ROM drive.

2. In your terminal window, type cd /var/www/cgi-bin and press Enter.

This is the default directory for Apache (httpd).

3. Type sudo tar jxvf /bluelava-0.4.4.tgz and press Enter. When prompted

for a password, type the user root’s password.

This step installs BlueLava. Don’t be surprised by the information that

appears on the screen (unless it’s an error); it’s just there to let you

know it’s doing something.

4. Type cp -f /media/cdrom/chapter15/bluelava.conf.Fedora bluelava/

bluelava.conf and press Enter.

This step installs the default config file for BlueLava. This step saves

you from having to do manual editing of the bluelava.conf file.

Installing BottleRocket

After you’ve installed the BlueLava application, you’re almost ready to use it.

The last software package to install is the BottleRocket. You have to config￾ure, compile, and install BottleRocket. As scary as that sounds, it’s actually

just a few easy steps:

1. With the book’s CD still in the CD-ROM, type cd and press Enter at a

command line.

BottleRocket is also included on the CD. Typing cd takes you back to

your home directory.

2. Type tar zxvf /media/cdrom/chapter15/bottlerocket-0.4c.tar.gz and

press Enter.

3. Type cd bottlerocket-0.04c and press Enter.

4. Type cp Makefile Makefile.bak and press Enter.

Chapter 14: Going Wireless with X10 255

22_598236 ch14.qxp 6/27/06 7:41 PM Page 255

Tải ngay đi em, còn do dự, trời tối mất!