-->

Smart Home Automation Part IV - Server and Adding Your Home

 


To be a truly effective smart automated home, you will need a server that’s on 24/7. Although many of the devices you’ve seen (such as the CM11U in Chapter 1) can be programmed to work offline, you only get a sense of power when there is something ready, willing, and able to make decisions at any time of the day or night. And a timed light switch doesn’t count.

There are so many cool and interesting technologies in a home environment that it’s very easy for the ideas to run away from themselves and for you start to place orders for the biggest and most powerful servers that you can’t afford! In reality, there is no need to have only one server, provided there is only one in overall charge.

Purposes of Servers

The workload of a server breaks down into three areas:

  • CPU processing power
  • Disk space
  • Bandwidth capabilities

I’ll cover these in order.

CPU Power

With a few exceptions, home automation software takes very little power. All the standard tasks, such as web servers, e-mail, alarm clocks, SMS processing, message routine, and music playback require virtually no processing, and the lowliest Mini-ITX is capable of handling everything without breaking a silicon sweat.

Transcoding media from one format (such as the high-definition DVD rip stored on your server) into another (a smaller version suitable for low-end hardware such as the MVP or for playback on your portable device) is significantly more processor-heavy. Consequently, it is not uncommon to have two main servers, each one dedicated to these two main tasks.

Disk Space

Again, most of the HA tasks don’t require lots of hard disk space, so if your operating system fits (and they’re approaching 1GB in size these days), then the extra 25MB required for the control software is not going to break the bank. Only the media server requires extra space, and for this you’ll need as much space as you can afford. External USB drivers are an excellent way of cheaply (and conveniently) increasing disk space, and they’re fast enough to stream movies to the server and then across the network.

You might consider a separate file server whose sole job is to provide files for the rest of the house. In this way, it can be stored in a physically secure location (hidden out of sight, perhaps in the loft or attic) to prevent precious data from being accidentally destroyed or stolen. Securing the server in a solid rack also helps prevent against theft, because no one can easily walk off with a Backblaze Pod (http://blog.backblaze.com/2009/09/01/petabytes-on-a-budget-how-to-build-cheap-cloud-storage/)!

Server Extensibility

In the corporate world, improving the facilities of a server generally means more memory or more disk space. To us, it also includes new hardware. Although not all HA applications or servers require new hardware, it is best to consider what else the server might handle.

TV cards are obvious, because a high-powered server could record from several TV stations at once or transcode a channel into a head unit–friendly format for streaming. Projects such as PromiseTV (www.promise.tv) take this to an extreme, but it’s a viable option.

Similarly, additional sound cards can provide extra scope to functionality. Although the setup in Linux can be slightly painful, having two sound cards allows you to directly control the audio in other rooms. This can remove the necessity of having local control panels, since you can use any device that connects to the computer, such as a web browser, phone, or HR10U connected through Cosmic.

Furthermore, remember that each sound card has inputs as well as outputs. This allows you to build a large-scale baby monitor for each room in the house. If you have a voice recognition system (covered in Chapter 5), then you have instant control in each room. There have been projects in the past to coax 6.1- supported sound cards to into three separate stereo ones, but they have not been maintained as well recently.

Bandwidth Capabilities

This is generally a nonquestion, since the current crop of network cards are all at least 100Mb, which is fast enough to distribute several movie streams around the house. The modem speed will usually limit your external streaming capabilities, but so will many other factors such as broadband contention in your area, current network traffic, and the target machine and its LAN.

Unlike corporate servers, most home servers can suffice with only one network port since a decent stand-alone router can perform most of the necessary filtering and configuration tasks that often need two Ethernet sockets. However, any future upgrades to your machine (such as moving the firewall software to the server) or changes in family (introducing a separate restricted intranet for the kids) will need a second port.

Also note that there is no longer any cost benefit of buying hubs over network switches, so a switch should be the only choice because it allows the full 100Mb to every port, and therefore every machine, on the network. You should route all network cables back to a single switch located physically next to your Node0 server to minimize maintenance. In a standard three- or four-bedroom house, this switch should have at least 16 ports.

Types of Server

Naturally enough, given the title of this book, the server will be running Linux. It is not by luck that Linux is able to run on virtually any device, so it’s no longer a question of hardware compatibility, but one of compromise between physical size, power consumption, and CPU power. There is nothing ultimately special about the hardware. Off-the-shelf machines are fine. You will be familiar with most (if not all) of the devices listed here. We need to consider their specific relative merits in the HA sphere. In most cases, the server will always have a mouse, keyboard, and monitor attached (unlike those in the business centers) to allow for simpler software maintenance—and if the server is located somewhere accessible, the monitor can display a web page presenting the current “house report status” for virtually zero processing cycles. When these peripherals are not to be connected permanently, you may need to adjust the BIOS to allow the machine to boot without them. This is especially true of desktop machines that will beep three times when no monitor is present and often issue the infamous “No keyboard connected – Press F1 to continue” error.

Rack Mount

These can be bought in many variants including those with redundant or dual power supplies and quad processors being the standard rather than the exception. Consequently, these power houses of processing can handle the transcoding needs of several users simultaneously, with enough cycles to spare to handle all the other services (web, e-mail, and so on) without affecting any other user. They are the industry standard for commercial applications for a reason since they can handle any load, for any length of time, and can run happily for many years without change.

Unfortunately, they are suitable for home use only if you can place them away from the living areas since they usually have large noisy fans inside and give off a lot of heat. Although the noise can be muted by placing the machine in a cupboard, you can’t generally achieve the same result by replacing components with low-noise equivalents, since they’re generally not of the standard PC design.

The heat is also something you will need to effectively dispose of. Air conditioning is standard in offices but not at home where the same effect is generally achieved by opening a window. Running a rack server at home will often need some kind of extractor fan at the very least.

The non-PC-ness will also hit home when considering its upgrade status. You will not be able to fit a PCI TV card into many rack machines because the connection form factor and size will be prohibitive. You will also need to buy a physical rack, or half-rack, in which to mount the unit. These are designed and priced at commercial installations, and although you will always need some kind of mounting for all the equipment mentioned earlier, there are cheaper ways of doing it with DIY shelving.

Desktop PC

This is the most popular choice, for all the obvious reasons: they are understandable, common, cheap, and built for home use. They can also be upgraded easily with additional cards, and replacements for worn-out (or too noisy) parts are available in your local bricks-and-mortar store. The current range of machines is fast enough to perform transcoding for a couple of media head units around the house, as well as handle all the other standard tasks.

Unfortunately, the home machine is intended to be used as a home machine, that is, for a few hours in the evening to check e-mail and play games. Using it as a server, running 24/7, can strain the physical components of the machine (fans and discs mostly) and increase the risk of breaking the machine’s integrity. Unlike racks, these machines are built to a price point, not a quality factor, and so will use components that allow the price to hit that magic 299 figure, or whatever. Consequently, these components might have a lower tolerance for temperature variances (which will happen if the machine is working all day) or have a lower mean time between failures (MTBF). When the machine is continually accessing data, either from memory or from a hard disk, the chance of this happening will naturally increase.

My personal setup uses a desktop PC as the media transcoding server, which runs most of the time. I bought higher in the price range than I would for a traditional desktop machine, with quieter-thanstandard fans and better components. I also bought spares for the fans at the same time so that if I needed to replace the moving parts of the machine, I would have some available. RAM chips (which are, admittedly, also likely to go bad over time) are usually available for many years after a machine’s release, whereas the particular size of CPU fan isn’t. This is because any server that lasts several years will outlive the current design of processors and motherboards, making spares for these components very difficult to come by. I also admit that when (not if) these components finally die, I will probably be unable to buy replacements and so will have to endure the pain of setting up an entirely new machine.

Mini-ITX

The Mini-ITX is a family of machines based around the 170 ×170mm ITX motherboard. Within this specification, there are a number of different options with varying processors, graphics chips, and cooling methodologies. This includes many machines that are fanless, relying only on the heat sink for cooling. This makes them more energy efficient than their desktop counterparts and suitable for placing in more communal areas, such as the living room where they are often used as media players.

Like desktop machines, there are a wide range of configurable options with ITX machines including TV (S-Video) and DVI output, compact flash (CF) adapters for diskless operation, wireless networking, and so on. They also have standard PCI ports for other cards. This configurability is both their manacle and demonic charm, because the workability of any particular device isn’t necessarily known when you buy the machine. Although any ITX is powerful enough to run all the basic services of an HA setup, most machines cannot transcode media fast enough, and the older ones cannot play back modern formats (such as DivX, which has a fairly high CPU requirement). Furthermore, there are some issues with outputs, other than SVGA, being supported by the Linux drivers, making it an issue for using them as a head box for anything other than projectors. New combinations of ITX are released on a regularly basis, along with updated drivers, so always check with your dealer for support, along with the current web forums.

The other configuration consideration with the ITX machine is the case, since it’s not supplied with the machine and you have to buy it separately. Furthermore, since space is such a premium here, you should buy any and all peripherals you intend to keep inside the case at this time. You should not expect to be able to update, or add to, the components and still have it fit within the same case. Even a 3mm gap between components can be the difference between a nice working system and one that overheats.

So, consider whether you want a hard drive or CF card and whether a (slimline) DVD player would be necessary at the start.

Note Always buy the case from the same dealer as the machine so you can ensure they will fit together. These cases are considerably more expensive that desktop cases and therefore a costly mistake.

Naturally, with so many cases to choose from, you have every chance of getting just the size you want. They come in four basic variants, with most HA servers being a cube or rack, while the ITX motherboards used in media units often choose book.

  • Book, around 70 ×270 ×320mm, with up to two drive bays; not all support PCI cards
  • Cube, around 180 ×220 ×280mm, with up to four drive bays and usually a PCI card
  • Rack, a 1U (482.6 ×44.45 ×381), with up to four drive bays and up to two PCI cards
  • Vehicle, variable around 210 ×254 ×56mm, with one or two drive bays and occasionally one PCI card 
A vehicle mount case is used for mounting in harsh environments, such as a car or garage, where it can be used as a kids entertainment center or web terminal. All four come in a variety of sizes, with the drive bays being either 2.5 inch or 3.5 inch. It should be note that not all ITX cases are compatible with all types of motherboards. In the ITX world, one size certainly does not fit all. So, check and recheck your specification.

ITX has begat two younger brothers, the Pico-ITX with a 100 ×72mm motherboard and the Nano- ITX at 120 ×120mm. Although the size reduction isn’t worth the price increase if you still have to buy a larger case to fit a DVD drive, this size of machine can be hid virtually anywhere, making it good for media head units or for running control panels in the kitchen.

Mini-PC

The Mini-PC is a high-power, prebuilt PC in a box that has a very small form factor (often around 80 ×50 ×30mm) and usually a similarly low-power footprint. This causes them to be sometimes termed GreenPCs, but whereas Mini-PC often has a low-power footprint, a GreenPC must have one, as should its manufacturing process. Typical machines of this type include the Zonbu and Fit-PC2.

Functionally, they are a cross between laptops (because they’re prebuilt and therefore can’t be upgraded, and the OS really needs to be preinstalled to ensure a complete set of drivers), desktop machines (with a high machine spec and single network port), and Mini-ITX machines (which look nice when placed under TVs, for use as head units). Consequently, many people will use them as more clientfocused machines for web browsing and media playback. But, as I’ve mentioned previously, the CPU required for most of your HA tasks is so minimal that these are perfectly suited to it. They also make good secondary servers in cases where the building itself doesn’t allow for a single machine in Node0 to reach the entire house, as can be the case with X10 messages and wireless communication. Furthermore, since the power usage of these devices is often 10 watts or less, they are efficient and add very little overhead to an existing setup.

The specifications of these machines differ wildly, because many include custom hardware to improve on the apparent capabilities. The Fit-PC2, for example, includes only a low-powered Atom processing but is able to play back HD 1080p H.264 video by incorporating hardware acceleration.

The biggest downside with these machines, however, is the lack of bravado when demonstrating your HA setup to friends. After showing how you can e-mail your light switch, send a text message to your video, and have your own home web server, opening a cupboard to show a small box that fits inside your hand is often a letdown for the male ego!

Custom Embedded

This group features both system-on-a-chip (SoC) machines and single-board computers (SBCs), of which there are many, including the Mini-ITX machines you saw earlier and the NSLU2 from Part 2.

There are as many combinations of devices as there are uses for machines, so each needs to be considered on its own merits as the various components one often considers standard on a PC, such as a keyboard, mouse, and monitor, are not available on all SBCs such as the Gumstick. Also, some machines, such as the NSLU2, can have issues with seemingly normal peripherals, like USB hubs, and refuse to work with them. Consequently, these types of device are usually better suited to client machines in confined areas of the house, rather than servers, because the server will be running a wide range of software where any annoyances of hardware incompatibility will generally outweigh the benefits of size.

Power Consumption

For many, home automation is likely to be the first time you need to consider the total cost of ownership (TCO) of a machine by factoring in its power usage. This can be computed empirically by using an electricity usage monitor, like Kill-A-Watt (www.p3international.com/products/special/P4400/P4400-CE.html). Such a device can be plugged into the wall on one side and the computer on the other to determine the power it’s using at any particular time. This will vary depending on whether it’s in the following states:

  • Idle
  • Playing optical media
  • Processing media (playback, recording, and transcoding all differ)
  • Being used as a desktop machine

Knowing this information can help you calculate its running cost by multiplying the wattage shown by 8.76 (the number of hours in a year, divided by 1,000) to produce the number of kilowatt-hours. This is then multiplied by the cost per kilowatt-hour, which is generally shown on your electricity bill, to produce its TCO.

Note You can even tweet your home’s power usage with the simple hack known as Tweet-a-Watt, from www.ladyada.net/make/tweetawatt. There are also alternate solutions such as Owl, AlertMe, Wattson, and Enistic.

Unless the server manufacturer gives you its full power consumption data (remember that this varies according to task), you can only make a guess at its TCO. Table 4-1 shows some approximate numbers. They have been culled from various empirical tests, although only their relative values should be considered and only then as a guide.

To reduce consumption costs, you can do several small things for both the computer and the other
home hardware connected to it.

First, switch it off. This applies primarily to consumer electronics such as monitors and TVs, whose power consumption in standby is almost as high as it is in normal mode. Various products on the market detect standby mode either by monitoring the drop in power usage or by catching the IR signal to switch off the TV and consequently isolate all power to the device. In this mode it is, however, impossible to switch it back on automatically. You can manage this automatically using X10 or C-Bus.

Second, stop hard drives spinning. This reduces their consumption from 7W to around 1W, depending on device. You can achieve this with the hdparam tool by configuring it like this:

  1. # /etc/hdparm.conf
  2. /dev/sda {
  3. spindown_time = 60 # this means 5 minutes, since each spindown unit is 5 seconds
  4. }

Note This is reported to work only when the BIOS supports AHCI. In all other cases SATA drives should be controlled with the sg3-utils package.

From a longevity point of view, however, hard disks should not be continually spun up and then down since the ball bearings will grind more and eventually wear out. Furthermore, the cost of getting them to spin back up is very high, so you really need to have kept them spun down for around 20 minutes to make the savings worthwhile.

Switch into standby, suspend to RAM, or hibernate to disk mode, each saving progressively more power than the previous one. The Advanced Power Management (APM) daemon and tools handle the process itself, while the sleepd daemon can be to used to trigger the APM tools automatically upon certain conditions, such as lack of activity or input.

Use alternative components. With the green lobby influencing most companies, you can buy more power-efficient devices than ever before. Better power supplies6 can provide efficiencies in excess of 80 percent on moderate loads (90W), less powerful graphics cards use less power generally speaking (and often don’t need fans), LCDs monitors are more efficient than CRTs, and the power usage in CPUs can vary wildly, so consider replacing them.

Unplug any unused devices, such as the CD drive used once for installation (but never again), USB units, and so on. This can be extended by using external hard disks throughout your system (with the exception of the boot device), which can be powered down via X10 after unmounting.

Make use of more solid-state discs and/or laptop hardware where possible. Both are intended to work from batteries and therefore have more suitable CPUs and hardware inside them. For the primary control server, these are perfectly adequate.

Use virtual machines (running on VMware, for example) instead of using a completely separate machine. This can offer real benefits when a particular device requires a specific version or operating system. The extra power used in processing the virtual is far behind that of a physical machine. 

Reducing the load is something that should be considered in as many cases as possible because, although you might save only a watt, over the course of a year this can add up to a reasonable savings.

Server Coordination

Having multiple servers to control your house is fine. But if they’re all switched on all the time, your electricity bill will increase disproportionately to the benefit gained. This also doesn’t consider the case where the various machines can’t communicate because the master server is offline.

Coordinating how to switch specific machines on and off to save power is an easy problem...for a human. But it’s incredibly difficult for a machine for automate! You would need to know what services are running on which machines, what dependencies exist on other hardware, and so on. This information would need to be synchronized among all machines in case one went offline (because of power outages or loss of network connectivity).

Consequently, it is better to not try or to do one of the following:

  • Have human-designated time cycles for each machine.
  • Expect a larger than usual electricity bill.

When running a separate media server to transcode streams to the MVPMC, for example, you will know that the machine needs to be on from 6 p.m. each weekday and all weekend, for example. If the machine is also in charge of recording TV programs, you will have write custom code to prevent it from switching off during one of those recordings.

The inverse timetable is true of a machine intended to be a download server, when you only want it to be leeching your bandwidth during the early hours of the morning when you’re not likely to be web surfing or working from home.

Although it is possible for a machine to self-terminate (through the Linux command shutdown -h now), you can’t generally force it to wake up at a specific time. Therefore, you will always need one machine (such as the lowest-power device you have) that remains on 24/7 to coordinate all the others.

Having a machine switch on automatically requires a technology called Wake on LAN (WOL). WOL is enabled on many machines (although sometimes defaulted to off in the BIOS) whereby the motherboard watches for a specially formatted network message containing a “magic packet” sent directly to the machine in question. Since there is no IP address for an machine that is powered down, the MAC address must always be used. (It’s labeled as HWaddr from an ifconfig command.) The command and package to initiate this magic is as follows:

etherwake 00:1d:33:a5:63:16

Note that this works only from a “soft” power down and needs power available to it, along with that of any routers between the sending machine and the target. That’s an important point to remember during a power cut!

Note Sometimes a password is required for a WOL command to be accepted. This is set in the BIOS of the particular machine and passed as an argument to etherwake

Switching particular machines off is easier, because it’s something most desktop users do every day, so I’ll spend little time on it here. In its traditional invocations, you can initiate a shutdown with a single command, with a given delay from the issue of the command to the action with any console alert message you choose. You can also countermand any unenacted shutdown command with the -c flag.

All shutdown commands must be carried out by that machine’s root user, and since root is disallowed from connecting to a machine through ssh by default, it is not always obvious how to shut down a remote machine.

The standard method is to use sudo, letting a nonprivileged user connect to the machine and then upgrading themselves to root temporarily to shut down the machine with the following:

sudo shutdown -h now

Although a password is generally required for sudo, this can be waived by amending the /etc/sudoers file with a line such as this:

steev localhost=NOPASSWD: /sbin/shutdown

This can be automated further by issuing the command from a script that relies on a little-used feature of ssh, namely, the ability to log in, execute a command, and then quit:

ssh steev@myhomemachine.homelinux.net 'sudo shutdown -h now'

Since the shutdown command was created at a time when all users worked on the console, the alert message is generally invisible to most house users, so you might like to create a shutdown script that uses speech synthesis or music to indicate that the server is being switched off. However, since reboots and shutdowns in Linux are rare and you’re probably in the next room to your “users,” this is less important.

Shutting down any Windows machines on your network may be more difficult, since the method for doing so is less well defined. A command such as the following:

net rpc shutdown -I 192.168.1.100 -U windows_username%their_password

can work in many instances but is dependent on firewalls, file-sharing options, and even the version of Windows.

Given these commands to start up and shut down most machines in your home, you can effectively coordinate them to ensure the best power usage scenarios for your needs using a simple crontab on your primary server.

UPS

An uninterruptable power supply (UPS) is an essential piece of kit for anyone relying on moderate- to high-cost technology. And since your house is now a high-cost peripheral to that high-cost technology, it becomes important part in your HA setup—not just to eliminate the effects of short-term power dropouts and blackouts but to prevent the damage caused by surges.

Most UPS units work on the same principle. Namely, a device looking like an oversize multigang power strip connects the mains and a battery together to provide consistent power to four or more sockets. In the cheaper and most commonly seen devices, the device monitors the mains supply and, if it fails or drops below a specified threshold, switches to the battery. The second type of UPS supplies the output from the battery at all times and uses the mains power to keep the battery charged. The shape of the output waveform varies too and is usually governed by the cost of the device. The output of the cheaper devices is usually a square wave, while more expensive ones have a sinusoidal wave form. This doesn’t matter much for computers but can provide a difference when powering an audiophile record player, as mentioned in Chapter 3. Whenever a power drop is noticed, an alarm will sound and repeat the audible warning periodically. When the battery reaches a critically low level, the shutdown procedure will be initiated via the USB (or serial) cable so that the machine(s) connected to the UPS can close down safely. Each unit comes rated for a different VAs, indicating how much you can draw from it when it is disconnected from the mains. You will usually need a higher VA than the wattage. The required VA is the watts divided by the power factor of the connected device(s). The temporal duration of protection ranges from a few minutes to quarter of an hour, depending on what machines are connected to it and the tasks running on those machines. You can refer to Table 4-1 for a rough guide. For a buying, always get as high a power rating as possible.

Note With most UPS units, the power sockets will be divided between those that are powered in the event of an outage and those that aren’t. All sockets are generally protected against surges.

Given, say, four powered sockets, you have to decide what devices will use it. Naturally, your server should be a given. That’s followed by the home’s internal router or switch so that a “shutting down” message can be sent and processed by the other machines on a UPS. (This is for the computers benefit only, since any human will have noticed the lights going out and will instantly panic knowing they haven’t hit the Save button on their application.) You may also want to keep the broadband router on the UPS also so that a warning message (via e-mail, for example) can be sent. This is usually a minor consideration, but if you work remotely with the machine, this will prompt you to ease up on any processor-heavy tasks so that the UPS can last for longer.

Note When the UPS is first installed, test it with the circuit breaker but not by pulling the plug out, which can introduce a floating ground that is dangerous to electronic equipment.

The discussion of multiple servers reappears here, since it can be beneficial to have a low-power master server on the UPS, with the media-transcoding machine on its own UPS, to preserve the longevity of the main server and even finish recording that vital episode of Doctor Who you might have normally missed during the power cut!

If both servers are fairly high power and you have only one UPS, then it is usually worth consolidating both into one box to limit the power drain on the unit.

You might also consider keeping one powered socket for a monitor, perhaps connected to the second media server UPS unit. If you keep it turned off, it’ll draw very little power from the UPS, but in the event of a problem, you are able to see the machine running through its shutdown procedure, and you can ensure its closedown routine is working effectively. Without this, you will either have to trust the UPS software daemon is working or keep a laptop handy with a fully charged battery.

Tip You can ensure your laptop is fully charged by using the crontab to switch on an X10 module for at least an hour every night.

Once the hardware UPS is in place, you then need a way to detect that the power has gone and so begin the shutdown procedure.

Most UPS units come with a USB cable (sometimes with a proprietary connector on one end, so don’t lose it!) that allows a PC to query the state of the unit. Those that don’t have one are not generally worth buying. Granted, they are cheaper, and your data is probably safe with the journaling filesystem you’ve already installed, but the extra cost and peace of mind knowing you’ll get a clean shutdown is worth it.

Note It is possible to mimic the shutdown functionality of a UPS by using heyu to monitor the power lines and, if it sees two (or more) lights going off at the same time, trigger a shutdown. But this method is liable to false positives and doesn’t work during daylight hours.

Three primary packages are available to handle a UPS, all of which conflict if used together. They are apcupsd, nut-hal-drivers, and nut. I’ll cover the latter since it is the most recent, flexible, and actively developed.

First, perform a traditional installation:

apt-get install nut

The setup procedure then involves creating four configuration files in your /etc/nut directory:

  1. # /etc/nut/ups.conf
  2. [apc]
  3. driver = usbhid-ups
  4. port = auto

This references the appropriate driver for your UPS unit,7 which I have called apc here:

  1. # /etc/nut/upsd.conf
  2. ACL all 0.0.0.0/0
  3. ACL localhost 127.0.0.1/32
  4. ACCEPT localhost
  5. REJECT all

This indicates that only the local machine should react to UPS messages, which eliminates hackers spoofing a UPS failure and causing your machine to switch off. Then set up a basic user that has access to daemon by doing this:

  1. # /etc/nut/upsd.users
  2. [local_mon]
  3. password = mypasswordhere
  4. allowfrom = localhost
  5. upsmon master

You can then configure the daemon by specifying its process commands:

  1. # /etc/nut/upsmon.conf
  2. MONITOR apc@localhost 1 local_mon mypasswordhere master
  3. POWERDOWNFLAG /etc/killpower
  4. SHUTDOWNCMD "/sbin/shutdown -h now"

You can set up multiple users if you will be monitoring the UPS from alternate machines, but it’s not necessary, since you’ll probably create a web page holding this information. You can then fix the permissions for the files (since there’s a password in there you’d probably rather the world didn’t see):

  1. sudo chown root:nut /etc/nut/*
  2. sudo chmod 640 /etc/nut/*

and start the daemon running, like so:

  1. upsdrvctl start
  2. /etc/init.d/nut start

This can be made to start at every boot by editing the /etc/default/nut file. You can then query the state of a given UPS and check that it’s working by issuing the following command, where apc is the name given earlier:

  1. upsc apc

The output is something like this:

  1. battery.charge: 100
  2. battery.charge.low: 10
  3. battery.charge.warning: 50
  4. battery.date: not set
  5. battery.mfr.date: 2009/01/21
  6. battery.runtime: 705
  7. battery.runtime.low: 120
  8. battery.type: PbAc
  9. battery.voltage: 13.5
  10. battery.voltage.nominal: 12.0
  11. driver.name: usbhid-ups
  12. driver.parameter.pollfreq: 30
  13. driver.parameter.pollinterval: 2
  14. driver.parameter.port: auto
  15. driver.version: 2.2.2
  16. driver.version.data: APC HID 0.92
  17. driver.version.internal: 0.33
  18. input.transfer.high: 266
  19. input.transfer.low: 180
  20. input.voltage: 242.0
  21. input.voltage.nominal: 230
  22. ups.beeper.status: enabled
  23. ups.delay.shutdown: 20
  24. ups.delay.start: 30
  25. ups.firmware: 829.D2 .I
  26. ups.firmware.aux: D2
  27. ups.load: 49
  28. ups.mfr: APC
  29. ups.mfr.date: 2009/01/21
  30. ups.model: Back-UPS ES 700
  31. ups.productid: 0002
  32. ups.serial: 5B0904T46000
  33. ups.status: OL
  34. ups.timer.reboot: 0
  35. ups.timer.shutdown: -1
  36. ups.vendorid: 051d

It is possible to have several UPS units controlled by a single server. This is usually beneficial since it allows your master server to handle all the system administration tasks, giving a single point of entry to the home network, which can be hardened as appropriate.

Having gotten the machine to shut down, you need a way of making it start up again once the power is back on full-time. This becomes a hardware problem, and success is governed by whether there is an option in the BIOS to start up on power or similar. In the case of the NSLU2, you can physically hack the circuit board to perform the same task. It is also theoretically possible to hack the switch in a standard PC in a similar fashion, but it’s not recommended.

The WOL trick covered earlier generally doesn’t work across the Internet since it is a Wake on LAN feature. And even if your machine isn’t behind a router or modem that filters out such packets, something else generally will be. If it’s vital for your home machine to be powered for as long as possible and your machine cannot be made to boot when the power is connected, then you can employ an NSLU (hacked as shown in Chapter 2) as a bootstrap to issue WOL commands to your various server machines.

Backups

There are only two important things to say about backups:

  • Do them.
  • Test them.

Everything else is mere details.

The first detail is whether these should be held on-site, that is, at home, or off-site in a remote location, such as a colocated server or hired virtual machine. In an ideal world, you would adopt both.

Keeping them off-site helps minimize loss caused by local problems, while on-site backups are useful for data that you cannot possibly store elsewhere, such as configuration scripts and network plans that you’d need to rebuild the HA system should there be major failure.

The next detail is what data actually needs to be backed up. Again, in an ideal world, that would include everything on every machine in the house. In reality, you have to consider the cost of replacing the data and the time necessary to perform the backup. This usually boils down to anything that you’ve personally created, such as the following:

  • Photographs
  • Letters
  • Program code
  • Artwork
  • Digital video
  • Music

Each member of the family will have their own list that they will be responsible for. You, as the HA administrator, will also want to back up the server configurations.

From here you can decide on the technology needed to carry out this task. Programmers will already be aware of source control tools, such as Subversion (http://subversion.tigris.org/), and will be advocating their use. For the uninitiated, these tools don’t just keep a copy of the latest version; they keep data to re-create copies of all the versions you’ve ever created, allowing you to go back in time to see what you wrote last week and why that does (or doesn’t) work! For the most part, it’s a good choice for code and system configurations because, as a developer, you have the mind-set necessary to perform the necessary update-merge-commit cycle at every juncture. However, with some coaxing, most family members will become au fait with it. Accessing the files requires a Subversion client, and there are several to choose from (such as TortoiseSVN or SmartSVN) that also have versions for Windows, eliminating that support headache. This also gives family members the ability to access their files from outside the home with no extra effort or software. On the downside, however, you will have to educate the family that word processing documents are usually stored in a binary format and, as such, are nextto-impossible to merge together if they change the same file at home and at school. Nor is it particularly efficient to use source control for large files that change often, such as raw Adobe Photoshop images.

Note Subversion stores its own work files inside the current directory, meaning they will each be littered with .svn folders. This is only a mild nuisance for end users but can cause bigger problems when they appear in system configuration folders such as /etc.

To make a direct copy of one set of files from one directory to another, you can probably use cp at the end of each day. However, this will wastefully copy files that haven’t changed, and so rsync was born. rsync is a very old copy and backup program but is still a venerable workhorse. I make backups of my code directory, for example, with this single line:

rsync -a code steev@remote-backup-host.com:~/backup/daily

I recover them (for testing8) with this:

rsync -a steev@remote-backup-host.com:~/backup/daily code

The options here perform a recursive update, while maintaining all symlinks, permissions, and user settings and is the most typical in home situations. The manual pages detail other possibilities. rsync does have two problems, however. The first is that it’s available primarily for Unix-oriented platforms. Versions are available for Windows (such as DeltaCopy and the version with Cygwin), but they take a little while to set up and can be tricky.

The second issue is that it requires a password to be interactively given in order to log in to the remote site. This is a nuisance and prevents any kind of automatic backup. For a remote site to allow a user to connect without a password, they must first establish an alternative form of trust—in this case, the exchange of public keys. To copy from machine A to machine B, B must have a copy of A’s public key. To copy from machine B to machine A, A must have a copy of B’s public key. In our case, machine A is at home with our files, while B is a remote machine for backup.

So, our home machine must generate a key for the user who’ll be doing the copying. 

ssh-keygen -t rsa

which by default can be found in ~/.ssh/id_rsa.pub. This is then copied to the remote machine (perhaps using a password-directed rsync) and appended to the list of authorized keys that the remote user will accept:

cat id_rsa.pub >> ~/.ssh/authorized_keys

Once this is done, you should be able to rsync without a password:

rsync -a --bwlimit=100 steev@remote-backup-host.com:~/backup/daily code

Note that this limits the bandwidth (with the bwlimit argument) to 100 kilobytes per second so that other applications can make use of the Internet, since rsync and ssh are rather greedy when teamed up together.

One potential administration problem that can exist here is for the home user to be refused a connection because the address from which they’re connecting does not match the one used in the key. This can happen when the hostname is something simply like linuxbox1 but appears to the remote machine as netpc-london-isproute-isp.com or something equally unhelpful. The target machine, by comparison, will usually have a fixed name since it must be addressable from the outside world. Since the home machine name might change (at the whim of the ISP), the easiest solution is to reverse all the instructions given here! That is, use the remote server to connect to the home server, generate a key for the remote server only, and reverse the arguments to the rsync command so that the remote server pulls the data from the home machine in order to perform the backup. It is curious to note that it is the direction of the connection that requires the authentication, not the direction of the copy process.

Note The root user cannot, by default, connect through ssh. Although it is possible to override this, it is not recommended, so create a new user, create the ssh key for them, and use their crontab to initiate the daily backup.

Although this solves the problems for Linux and MacOS users, there still needs to be a solution for Windows. If you can afford the time, preparing rsync on Windows can be worthwhile. Alternatively, you might want to instill best practices into the family by introducing a manual backup solution that requires them to do something to back up their work. This is one area in which Subversion scores higher, because the workflow encourages this automatically. What can be done instead is to create a writable SMB shared area on the network that is accessible to everyone, and it is their responsibility to add their files to it every night before bed. You can then use rsync to back up this network folder remotely. There are several free and shareware utilities for Windows that provide the copy-based backup necessary for the first step.

Of course, everything I’ve said assumes that you’re storing your data at home. In most cases that will be true, but it is now easier than ever to buy space on a remote server (through Amazon’s S3, for example, with a virtual machine), which means you never need to back up. Of course, backups are still being done (by the automated tools and support staff at the server provider), but they’re transparent to you.9 In the cases of external storage, you would only want to store data that was fairly small in size since streaming a full movie from a remote server would be unwatchable, and having to wait until it had downloaded would be equally annoying and defeat the purpose. These situations are beneficial in some cases because they mean no personal data is ever stored at home. So if a burglar steals your laptop, you haven’t lost the novel you’ve been working on.

Some people prefer to protect their private data in public, by using services such as Flickr, Google Docs, and YouTube. The situation is the same as earlier with the exception that, being free services, there are fewer warranties about loss of data. Indeed, Google Mail has a personal storage limit of just over 7GB, which allows you to back up your data by saving them as attachments in your mail account! Or by using gmailfs.

There is also the possibility of backing up the physical items in your home, namely, your media. Although the importance in CDs and DVDs is in the packaging, it is possible to save the contents by ripping them (as we covered in Chapter 3) onto external hard disks and placing the drives themselves in storage, either held with friends, with family, or in a professional safe. You could probably arrange a pairing scheme with suitably technical friends who will store your collection of discs in return for you keeping theirs. The same pairing idea works if you both rsync your media to each other during quiet periods of network traffic, such as during the night, for example.

Hiding Your Home

Having a home connected to the Internet provides a way of consuming your media when away from home, remotely configuring your machines, and checking that you did indeed turn the lights off. It also provides great bragging rights! However, having it connected in this is naturally a concern for some.

Even with the technical security issues I’ll be covering in Chapter 5, there’s some extra scope for hiding your automated home in much the same way as you’d put a blanket over the valuables in the car when you park it.

One way is to set up two domain names for your home machine. The first should be considered the public site, which provides a smoke screen, and may contain a web site and blog featuring your cat! By being the default web site, this will be used whenever the IP address is used alone. (I’ll cover the method when discussing virtual hosts in Chapter 5.) You can then additionally set up a second domain with access to your home automation web pages. You will still secure these pages, naturally, but this is a good first step.

Although registering domain names is easy enough, it is not necessarily the best option when dealing with home machines, because your IP might change when a DHCP lease is not renewed at the whim of the ISP, and you’d have to wait another 24 hours for the DNS information to repropagate through the various DNS servers. Although this is unlikely, even if you decide to power down the server every night, better solutions are available by using dynamic DNS. The method assigns an arbitrary subdomain, from a known primary domain, to a given IP. Because subdomains do not need to be propagated by DNS before they can be used, they have a more immediate effect and can be registered for very little money—in most cases, zero.

One such service is available from dyndns.org. After registering (also free!), you can create your own subdomain and point it to your home server. This subdomain can extend from one of several primary domains, such as homelinux.net, mine.nu, or dnsalias.com. The T&C requires that you update this record periodically to ensure it’s still active, but this can be done automatically with appropriate routers or through a package such as ddclient. This should be run periodically, either in daemon mode or from crontab, to keep their records up-to-date. The configuration simply requires your login credentials for DynDNS and the subdomain names you want to update.

  1. # /etc/ddclient.conf

  2. daemon=600
  3. use=web, web=checkip.dyndns.com/, web-skip='IP Address'
  4. login=your-username
  5. password=your-password
  6. protocol=dyndns2
  7. server=members.dyndns.org
  8. my.homelinux.net

Because this is a DNS record, only the name is registered. It’s still up to you to support the services. But this is what you want, because it allows you to run your own servers for e-mail, the Web, SSH, and so on.

You can hide behind more curtains by providing access only through an external proxy—a proxy whose existence and login is known only to you. The first step is to prepare the hosts.allow file with the following:

sshd: LOCAL myhidden.privateserver.com

and add the paranoid inverse to hosts.deny:

sshd: ALL

As you can guess, when used in combination, this limits all SSH connections to those originating from the local (192.168.x.x) network and those on an external server that might be a colocated server, work machine, or shell account.
Note These rules can apply to all protocols, not just SSH, by changing sshd to ALL in the previous examples.
This approach is not without risk, however, because should your server become inaccessible for any
reason, you will be able to connect to it (and therefore solve the problem) only from the specified
machines, which might be difficult if you are on vacation.

Note If your private server supports multiple domains, the name that is specified here to sshd must be the canonical one.
You can extend this idea by controlling your house through an alternate protocol, such as Simple Object Access Protocol (SOAP), from a remote server, although this does open up two potential points of attack.

Adding to Your Home

The simplest way to incorporate automation into your home is through wireless—or at the least, automation that uses no new wiring. This second approach covers a surprisingly large amount of ground, including networking through WiFi and Ethernet over Power, appliance control (with X10 over the existing power cables), and media distribution (with TV senders.) But even then, with so many devices occupying the 2.4GHz range, there will be a limit to what is possible and how far it can be expanded. So, naturally, a wired approach will begin to win favor, which will require some drilling of holes and running of cables.

In all the advice that follows, remember that you must always plan ahead, thinking about what each room will have in it, what it could have in it next year, and how it will be used. Running cables is a  imeconsuming process and not something that wants to be repeated, so it’s better to lay too many and have unused sockets than it is to run out when you attempt to plug in a new gadget and find that you first need to buy an expanded unit. Cable is, after all, comparatively cheap when compared to the cost of installation or maintenance. Having two cables is a also useful redundancy measure in all the following examples, if you have the space to include them.

General Considerations

Except in very esoteric cases, Node0 will always be at the center of your HA installation. Even if it is not physically close to the center of the house, all cables should be run into it. This is known as a star
configuration.

The process of running cables from one location to another is known as pulling cables, since it involves the act of pulling them through one set of holes to another. When you’re adding to an existing home, you will generally need to drill holes in the ceilings and pull cables down through wall-mounted trunking, as shown in Figure 4-1. With self-builds, you may have the opportunity to place the cables inside the walls themselves, making them invisible except for the wall plate beside the skirting board.

Of course, if you’re doing some major redecorating, then you might decide it’s worth removing the wall and replastering to make the cabling invisible.


Note If you are planning a projector in any room, then you will generally need to run cables within the ceiling itself, which involves lifting the floorboards of the room above. When this is likely, do it earlier since you won’t want to do it later and might live without a projector; plus, you can take the opportunity to lay a lot more cables in the same space than you would normally.

Remember that all cables have different flexibilities, so when pulling them, it is best to be as careful as possible, as if they were all fragile. Cat5 cables, as a guide, are generally stiffer than stereo AV, so try not to bend or kink the cable as you pull it through, and do so in a slow methodical manner. Don’t jerk the cable, because this causes friction on the sheath. You might find it beneficial to use a length of drainpipe, or exposed trunking, to provide a channel in which cables can move and sit. The use of drainpipe also ensures there are as few corners as possible, with sharp corners being the worst offenders.

There is no trick to the act of pulling cables, although doing so with a partner will more than halve the time taken. You should gather them in bunches and tie the ends together with string that is twice as long as the cables. Tie the cable ends to the string middle, which allows you to pull them through en masse. You will then be left with half the string running alongside the cable and both ends of string visible. (One end of the run will have half the string, and the other will have a small amount, but that’s OK.) With this method, you can leave the string in place and tie it to new cables for pulling, should you need to add new cables.

Next I have two words about documentation—do some! It is best to label everything: cables, conduits, plugs, sockets, everything. This is also true of your living room and TV installations since your VCR, PVR, DVD, and TV will generally all sport identical black plugs! Use several bands of colored tape at each end to distinguish them, such as red-red-green-blue. (Begin labeling using the color nearest the cable end.) You should document these color codes as you go and reference them by taking photographs of the setup depicting the cables, connections, and wiring inside each box. Although they do not make for very interesting viewing, they will become essential if you ever need to change or repair anything.

Wired Network

Every room in the house should have at least two Cat5 cables running to it, directly from Node0. The living room should have at least four, as should the master bedroom. If you’re lucky enough to have a separate TV room, then so should this. You should also have two Cat5 in the attic or loft if possible because this provides a very secure location for your personal storage devices. If you have enough space between the wall joists and the patience, running two Cat5 cables to every light switch is also a good piece of planning for the future. Determining the number of necessary sockets is usually calculated by doubling the number you think you need. And then doubling it again! In short, you can never have too many ports.

Note Buy (or borrow) an IDC tool to bed down the Cat5 cables into their sockets. It will ease the process and, with so many sockets to do, pay for itself in time.

Having dual sockets isn’t just for redundancy, as mentioned earlier, but for many other practicalities such as debugging, since any unit plugged into Cat5 may (will?!) go wrong at some point in the future.

The easiest way to solve this is to sit down next to the device in question with a laptop to diagnose the problem. Having a second Cat5 socket makes this easier, because you’re not reliant on wireless, and it lets you double-check the network socket at the same time.

Cat5 should also be wired in abundance because it can usefully be applied to non-networking problems. That is, the cable can be reused to provide power with a Power over Ethernet system, supply HDMI signals,10 or provide electricity to low-powered wall units such as tablet machines. This is why I suggested Cat5 to the light switches earlier, because you can replace the old switches with high-tech touch panels with significantly more configuration possibilities. There is also the possibility of upgrading your X10 modules to C-Bus, if that’s the route you want to take, using Cat5 cables.

In addition to power, Cat5 sockets can be fitted with cheap adapters to make them compatible with ISDN or standard landline telephones, should you want to extend your standard phones in this way. If you can see the potential for a lot of Cat5 reappropriation, then it is worthwhile to upgrade from two ports to four ports in each room. In this way, you can keep two of them as traditional network sockets, which can always be extended further by adding a network switch to one of them, and give the other two alternate uses such as phones or power.

The location for the Cat5 sockets will often be governed by the wall into which you’re placing them. This is usually near the corners, which is good aesthetically speaking if you’re using external wall trunking. It’s also practical since you’ll want to place them close to the power sockets in each room so that devices using both sockets can run shorter (and therefore, tidier) cables. These devices typically include media head units, printers, laptops, and touchscreens.

Note Keep a reasonable distance between the network cable and power cable to minimize electrical noise. This is naturally true of any type of data cable.

If you read the hardware catalogs, you will see two types of Cat5 cable listed: solid core and stranded, with the solid cores being used for in-wall installations and the stranded variety being used for patch cables, since it’s more flexible. In reality, however, making your own patch cables is rarely done since they’re so cheap and more trouble than they’re worth.

Note Pull the longest cable runs first from the drum. What’s left will suffice for shorter runs between machines and routers.
Once the cables are laid, you should terminate on each end with a socket, such as the one shown in Figure 4-2.

Figure 4-2. A typical network point. I needed to make a separate hole in this one to eliminate a sharp cable bend.


You can then use patch cables to connect from the socket to the device. (Connecting an in-wall cable directly to a plug is asking for trouble, since it’s likely to move and be pulled more often, which can break the plug connection at the other end.)

In my installation, the cables running from each socket are color-coded as follows:

  • Blue: Any cable that goes from a wall socket to a switch or router
  • Gray: For connecting devices—computers, media units and so on—in the local area
  • Red: Temporary devices, such as laptops

You might decide on a different color scheme, but the idea still stands because it lets you know whether the cable can be safely removed if you need to rewire or borrow a cable. 

Wireless Points

Wireless is an addition to a wired network, not a replacement for it, so the WiFi routers and repeaters should exist to provide access primarily in those places where a wired network isn’t already available.

This often includes the kitchen, porch, and shed. Additionally, having wireless access in the main living spaces makes it easier to move around when the communal areas get too busy or noisy to work in.

Consequently, placing an access point in rooms at the back of the house may be preferable. It doesn’t need to be located in Node0, because it is wireless; therefore, provided it is connected to the wired network at some point, you will be fine. As noted earlier, there will be some instances when Node0 cannot physically provide WiFi coverage to the necessary areas of the house.

The position of the access point, however, is not an obvious choice since its range is affected by interference and obstructions, as well as distance. And these can only be determined empirically. Begin by placing the access point near the ceiling in a central part of the house, because this will give the best “line-of-sight” connection to most of the building, and then test the signal strength. You can buy specific devices for this, but unless you can borrow one, it’s cheaper and no more difficult to walk around the house with a laptop.

WiFi signals are lost by two methods, absorption and reflection, and although walls cannot be avoided in a home, partition walls have less absorption effects than structural ones made of brick. Shiny surfaces, including glass, mirrors, and metal should also be avoided because the reflection of the signal introduces more internal protocol collisions and therefore less bandwidth and more dropped connections.

I’ve mentioned some of the devices operating in the WiFi 2.4GHz range, such as TV senders, cordless phones, microwave ovens, and baby monitors, which can also create interference, but you should not forget that other electrical devices, such as motors, fan heaters, and fluorescent lighting, can also have a negative affect.

Instead of WiFi, you can achieve pseudowireless connectivity by using Ethernet over Power to limit these problems. There are several EoP devices on the market (such as the MicroLink dLAN) where each unit plugs into both the wall socket and a networked device. Since this uses the same idea as X10, whereby a signal is hidden on the mains supply, it is susceptible to the same noise and interference.

Audio Cabling

Chapter 3 covered the idea of remote processing, whereby the music is decoded on a PC and the resultant signal is fed over standard audio cables to other speakers or amplifiers. The process of adding this wiring is fairly simple, since the cables are fewer in number, thinner, and more flexible than Cat5, which requires smaller holes and less mounting at each end. A standard stereo pair consists of only four wires, with two connectors at each end for left and right. You can use any connector you prefer, but phono sockets are good enough quality, easy to mount, and cheap.

The face gang plates for AV are more expensive than you’d expect, especially when compared to the cost of the (more complex) Cat5 sockets, but they usually come with extra sockets for SVGA monitors and composite video. With a drill, however, you can build your own using a standard blank facing plate, as shown in Figure 4-3.


Figure 4-3. An AV connection for stereo and composite video. The top row sends the local AV signal upstairs, and the bottom row receives an AV signal to downstairs. Note the trunking on the left and the exit for network cables on the right, which is simply passed through from the trunking.





The type and quality of the audio cable are an important decision, although not as important as audiophiles would make you believe! These cables are likely to be several meters long and used with some fairly standard connectors, so any cable greater than 42 strand is usually wasted. In fact, for some units, such as those placed in the kitchen, the extra ambient noise in the environment will render any critical listening impossible. In these cases, you could do as well with simple bell wire. In all cases, it’s worth getting shielded stereo cable since it is bound into pairs, with a mark on one of them, making it obvious at each end which cable is intended to be ground.

The other side of audio cabling is the connection of a passive speaker distribution system, where the output to one set of speakers is routed to several others, without additional amplifiers. The same rules apply as stated earlier. You can also reuse the color-coding idea of network cables and use one color for powered cables (which enter and leave the amplifier) and a different one that distributes the signal to other speakers. You can see this in Figure 4-4, where you’ll also note the black line on the white cable, indicating ground.

Figure 4-4. The speaker distribution bay. This model also support push-button switches to turn each
speaker pair on or off (not shown).

If you can ensure that the cables won’t move much, you can take the cables directly from the speaker switch box into the wall and along to the speaker, without using separate connectors as I did for the phonos. You would do this for better fidelity, which you can improve by soldering the cable directly to the speaker terminals themselves.

Other Access Points?

With Cat5 being such a ubiquitous method of cabling, there are fewer demands on the range of cabling that there once was. But they’re still worth considering.

Telephones, for example, can make use of Cat5 sockets with an inexpensive adapter, so there is no need to wire for them explicitly, particularly with the increased uptake of mobile and VoIP, so add phone-only sockets only if you think you’ll need them.

Infrared signals can be sent over wireless (but this adds to the already overcrowded spectrum) and through cables with IR distribution amplifiers (necessary to stop the already weak signal from dissipating further). But it is generally better sent over Cat5, using gateway devices like the Keene IR Anywhere, from Part 1.

Power is always an issue in HA installations, because there’s never enough where you need it. Unless you are able to self-build, you won’t have a choice as to where the sockets are or how many you have. You can always cheat the issue by converting any existing sockets into multigang units or by adding a spur from an upstairs light to provide a couple of sockets in the loft. This not only gives you the opportunity of adding a small secure filesystem in the loft, but it means you can use the space to store X10 DIN Rail devices where they are out of the way and don’t add the heat in Node0 itself.

Note Don’t pack DIN rails too closely to each other because the heat can induce problems in operation. The recommended minimum separation is 20mm.

Additional power conduits are also useful for lighting driveways and powering electric garage doors. In the former case, you need only a low-power (around 12v) supply, which can also be used for water fountains, flood lights, outdoor Christmas trees, cameras, and PIRs. They can also help power sensors, such as the VAL-1 vehicle alerts that indicate when a car is approaching the garage or driveway. You can even install two to correctly determine the direction of travel, as we suggested for the Arduino door mat in Part 2.

Note If your electric garage doors take ten seconds to open, for example, but your sensor is only in range when you’re five seconds away from the door, you will need to employ a custom RF gateway circuit to trigger the door earlier.

There are also the high-powered devices, such as the garage doors, and mains sockets in a shed or garage for power tools. These are generally coated in rubber for isolation against the elements. In all cases, consult an electrician and the laws of your country before installing electrical equipment outside!

Note You could also use the driveway sensors to switch on the porch light, ready for your arrival.

Depending on the scale of you CCTV installation, you might also need to run separate cables for each camera back to the camera switching device. You can find information about these in Part I.

Conclusion

There is clearly more to a home network installation than a few cables and a network card. By carefully considering all the possible functions of the home ahead of time, you can ensure you run enough cables, of the right type, to each room in the house. Even then, you might still run out. Also, by aggregating as much of the technology in one place as possible, you create a central hub called Node0. This physical proximity allows you to place IR transmitters and control cables between devices and ensure that everything can be controlled from a single area. Again, plan the purpose and features of this area so that everything fits in and (importantly) has a method to access the machine’s panels, plugs, sockets, and power.





0 Response to "Smart Home Automation Part IV - Server and Adding Your Home"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel