Hardware Reference
In-Depth Information
which could be retrieved and processed with XSLT or combined with the feeds from each family member into one
for display on a house notice board. The results here are less verbose than their cURL counterparts, making it easier to
process, at the expense of less contextual information.
Facebook
Although Twitter has adopted a broadcast mechanism, Facebook has continued to focus on the facilitation of a
personal network with whom you share data. For HA, you are probably more interested in sharing information with
friends than strangers, so this can be the better solution. However, writing an app that uses Facebook has a higher
barrier to entry with comparatively little gain. It does, by way of compensation, provide a preexisting login mechanism
and is a web site that many people check more often than their e-mail, so information can be disseminated faster.
However, Facebook does change its API periodically, so what works one day might not work the next, and you have to
keep on top of it. If you are using Facebook as a means of allowing several people to control or view the status of your
home, it is probably easier to use your own home page, with a set of access rights, as you saw in Chapter 5.
If you're still sold on the idea of a Facebook, then you should install the Developer application and create
your own app key with it. This will enable your application to authenticate the users who will use it, either from
within Facebook or on sites other than Facebook through Facebook Connect. (A good basic tutorial is available at
www.scribd.com/doc/22257416/Building-with-Facebook-Social-Dev-Camp-Chicago-2009 .) To keep it private
among your family, simply add their ID as developers . If you want to share information with your children, getting
them to accept you as a Facebook friend can be more difficult, however! In this case, you might have to convince them
to create a second account, used solely for your benefit. Facebook doesn't allow you to send messages to users who
haven't installed the app (or are included in the list of developers), so this requires careful management.
The technical component is much simpler, by comparison, because Facebook provides standard code that
can be copied to a directory on your web server and used whenever your app is invoked from within Facebook. It is
then up to you to check the ID of the user working with your app to determine what functionality they are entitled to
and generate web pages accordingly. You can find a lot of useful beginning information on Facebook's own page at
http://developers.facebook.com .
Automation
With this information, you have to consider how it will be used by the house. This requires development of a most
personal nature. After all, if you are working shifts, then my code to control the lights according to the times of sunrise
and sunset will be of little use to you. Instead, I will present various possibilities and let you decide on how best to
combine them.
Timed Events
Life is controlled by time. So, having a mechanism to affect the house at certain times is very desirable. Because a
computer's life is also controlled by time, there are procedures already in place to make this task trivial for us.
Periodic Control with Cron Jobs
These take their name from the chron ological job scheduler of Unix-like operating systems, which automatically
executes a command at given times throughout the year. There is a file, known as the crontab , which has a fine level
of granular control regarding these jobs, and separate files exist for each user. You can edit this file belonging to the
current user (calling export EDITOR=vi first if necessary) with the following:
crontab -e
Search WWH ::




Custom Search