<?xml version="1.0"?>
<!-- name="generator" content="blosxom/2.0" -->
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">

<rss version="0.91">
  <channel>
    <title>Mark J Cox | Home automation | Open Source Software | Security | Metrics   </title>
    <link></link>
    <description>Here's where you can find everything you ever wanted to know, and less, about me and what I do.</description>
    <language>en</language>

  <item>
    <title>Tablet Design Overhaul</title>
    <pubDate>Wed, 26 Apr 2006 19:13:00 GMT</pubDate>
    <link>/ha/newsoftware.html</link>
    <description>
The biggest problem with my home-grown Home Automation system was that
I'm not a graphic designer.  My displays all looked a little clunky, like
they'd come out of the 1980s.  Guests only ever see the user interface
displayed on the tablets around the house, so I took some time over the 
Easter holiday to make the user interface look a bit nicer.

&lt;p&gt; The user interface is written in Perl/Tk and was designed to be
snappy even on the original Point 510 (100Mhz) tablets.  I'd already
replaced these tablets around the house with Point 1600 tablets (most
picked up on ebay for about 50-100 pounds each) with the main
advantage that the Point 1600 can run at 800x600 in full-colour rather
than the 256 colours of the 510 in the same resolution.

&lt;p&gt; I first looked around the web to see if there were any existing
Perl/Tk projects that had exciting graphic design I could base on, but
I didn't find anything very useful.  In the end I decided to make
the UI look like a web site design proposed by a colleague at Red Hat
for some internal site that didn't get used.

&lt;h2&gt;Screenshots from the new design&lt;/h2&gt;

&lt;p&gt;

&lt;img src=&quot;http://www.awe.com/ha/ham-heat.png&quot; align=left&gt;
&lt;b&gt;Heat&lt;/b&gt;&lt;p&gt;
The Heating interface lets you look at graphs of past readings for
any sensor or change the target temperature of the house.  
&lt;br clear=&quot;all&quot;/&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham-lights.png&quot; align=left&gt;
&lt;b&gt;Light&lt;/b&gt;&lt;p&gt;
Actually we only have a couple of X10 lights in the house, and
we really only ever control the living room lights.
&lt;br clear=&quot;all&quot;/&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham-weather.png&quot; align=left&gt;
&lt;b&gt;Weather&lt;/b&gt;&lt;p&gt;
This is just screen-scraped from the BBC website and updated
every hour.
&lt;br clear=&quot;all&quot;/&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham-cams.png&quot; align=left&gt;
&lt;b&gt;Cams&lt;/b&gt;&lt;p&gt;
We use this screen to look at the security cameras as well
as some other Glasgow web cameras.  The interface allows
multipart-jpeg streaming (compatible with ZoneMinder).
&lt;br clear=&quot;all&quot;/&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham-phone.png&quot; align=left&gt;
&lt;b&gt;Phone&lt;/b&gt;&lt;p&gt;
This actually displays a number of events such as the status
of the house alarm, capturing when the doorbell is pressed,
as well as popping up details of who calls us.
&lt;br clear=&quot;all&quot;/&gt;

&lt;h2&gt;Screenshots of the original design&lt;/h2&gt;

&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham3.png&quot; width=50% align=left&gt;

Old heating interface for comparison.
See &lt;a href=&quot;/ha/software.html&quot;&gt;my original software page&lt;/a&gt; to see
how the other screens looked.&lt;p&gt;
&lt;br clear=&quot;all&quot;/&gt;

&lt;h2&gt;Software&lt;/h2&gt;

I was previously using the Tk/TabBar module from Jarl to provide the
nice tab bars, and a bit of hacking gave the simplified tabbar (with
the advantage that the bar will still nicely wrap over two rows if
needed)

&lt;p&gt;
The rest of it was just messing around with frames and alignment and 
creating the curved edges.  I used the gimp to get a curve I was happy
with, then coverted it from a GIF to xpm with reduced colours.  The
xpm was then coded into the application and simplified so that the
program can generate the right curves for any font size.
&lt;p&gt;

The Perl/Tk I used to create the headings is 
&lt;a href=&quot;/ha/headings.pl&quot;&gt;available here&lt;/a&gt; and 
running that program displays the following:&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham-example.png&quot;&gt;&lt;br&gt;
</description>
  </item>
  <item>
    <title>1-wire Hardware</title>
    <pubDate>Sun, 02 Apr 2006 14:29:00 GMT</pubDate>
    <link>/ha/1wirehardware.html</link>
    <description>
I use a &lt;a href=&quot;http://www.maxim-ic.com/1-Wire.cfm&quot;&gt;Dallas 1-wire
network&lt;/a&gt; for temperature sensing and control around the house.
Ideally you run a single cable from the PC interface and attach
sensors along the wire, but I didn't think of that before the house
was wired.  So instead I use a star network using the existing
cat5 networking to each room, with a one-wire hub from AAG
handling switching between the different spokes of the hub.  
&lt;p&gt;
&lt;img align=right width=200 height=308 src=1wirehub.jpg&gt;
At the Home Automation server is a USB to 1-wire interface unit.  
This interface connects directly to the one-wire hub.  6 outputs
from the hub go to various places around the house.
&lt;p&gt;
Output C6 has a ds18s20 temperature sensor plugged straight into
it, this provides the temperature of the home automation cupboard.
&lt;br clear=&quot;all&quot;&gt;
&lt;p&gt;
&lt;img align=right width=200 height=95 src=tempsensor.jpg&gt;
Output C5 goes to the lounge, which has a single ds18s20 temperature
sensor plugged straight into it, this provides the temperature of 
the lounge which is used as the master control for the heating system.
&lt;p&gt;
Output C2 goes to the master bedroom, again with a single ds18s20
temperature sensor.
&lt;br clear=&quot;all&quot;&gt;
&lt;p&gt;
Output C1 goes to the garage, where a temperature
sensor is connected and poked out of the vent to get the outdoor
temperature, and on the same wire is a 1-wire switch used to 
control the heating system.
&lt;p&gt;
&lt;img align=right width=100 height=148 src=doorbell2.jpg&gt;
&lt;img align=right width=200 height=314 src=doorbell1.jpg&gt;
The final output C4 goes to a hacked wireless doorbell.  A one-wire
switch detects when the doorbell is activated.  The one-wire hub
provides a 5v supply and so we use this to power the doorbell to save
on batteries.
&lt;p&gt;
The home automation sensor polls each device in turn to get a reading.
For short events (like a doorbell push) it monitors a latched register
which shows if the state of the input has changed since the last time
the device was polled.  I'll write more about the software side of
this and give my source code in a later article.
&lt;p&gt;
&lt;br clear=&quot;all&quot;&gt;
More photos of 1-wire:

&lt;style type=&quot;text/css&quot;&gt;
.flickr_badge_image img {border: 1px solid black !important;}
&lt;/style&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;10&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.flickr.com/badge_code_v2.gne?count=8&amp;display=random&amp;size=s&amp;layout=h&amp;source=user_tag&amp;user=57224808%40N00&amp;tag=1wire&quot;&gt;&lt;/script&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p align=&quot;right&quot;&gt;&lt;i&gt;&lt;a href=&quot;http://www.flickr.com/photos/iamamoose/tags/1wire/&quot;&gt;see all at flickr.com&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;
</description>
  </item>
  <item>
    <title>Displaying a moving image with Perl/Tk</title>
    <pubDate>Sun, 12 Mar 2006 15:10:00 GMT</pubDate>
    <link>/ha/multipart.html</link>
    <description>
My home automation tablets use Perl/Tk as their user interface which
makes coding and prototyping really quick and easy and works on both
Linux and Windows platforms.  
&lt;img src=&quot;snowy.gif&quot; width=&quot;332&quot; height=&quot;324&quot; alt=&quot;&quot; align=&quot;right&quot;&gt;
I use &lt;a href=&quot;http://www.zoneminder.com/&quot;&gt;ZoneMinder&lt;/a&gt; for looking after the security cameras around the house and had
set up the tablets to be able to display a static image from any camera
on demand.  But what I really wanted to do was to let the tablets display
a streaming image from the cameras.
&lt;p&gt;

ZoneMinder is able to stream to browsers by making use of the Netscape
&lt;a href=&quot;http://wp.netscape.com/assist/net_sites/pushpull.html&quot;&gt;server
push&lt;/a&gt; functionality.  In response to a HTTP request, ZoneMinder
will send out a multipart replace header, then the current captured
frame as a jpeg image, followed by a boundary string, followed by the
next frame, and so on until you close the connection.  It's perhaps
not as efficient as streaming via mpeg or some other streaming format,
but it's simple and lets you stream images to browsers without requiring
plugins.

&lt;p&gt;
So I wrote the quick Perl/Tk program below to test streaming from
ZoneMinder.  It does make some horrible assumptions about the format
of the response, so if you want to use this with anything other than
ZoneMinder you'll need to edit it a bit.  It also assumes that your
network is quite good between the client and ZoneMinder; the GUI will
become unresponsive if the network read blocks.
&lt;p&gt;
My first attempt ran out of memory after an hour -- I traced the memory
leak to Tk::Photo and it seems that  you have to use the undocumented 'delete'
method on a Tk::Photo object otherwise you get a large memory leak.  The
final version below seems to work okay though.
&lt;p&gt;

&lt;pre&gt;
# Test program to decode the multipart-replace stream that
# ZoneMinder sends.  It's a hack for this stream only though
# and could be easily improved.  For example we ignore the
# Content-Length.
#
# Mark J Cox, mark@awe.com, February 2006

use Tk;
use Tk::X11Font;
use Tk::JPEG;
use LWP::UserAgent;
use MIME::Base64;
use IO::Socket;

my $host = &quot;10.0.0.180&quot;;
my $url = &quot;/cgi-bin/zms?mode=jpeg&amp;monitor=1&amp;scale=50&amp;maxfps=2&quot;;

my $stop = 0;
my $mw = MainWindow-&gt;new(title=&gt;&quot;test&quot;); 
my $photo = $mw-&gt;Label()-&gt;pack();
$mw-&gt;Button(-text=&gt;&quot;Start&quot;,-command =&gt; sub { getdata(); })-&gt;pack();
$mw-&gt;Button(-text=&gt;&quot;Stop&quot;,-command =&gt; sub { $stop=1; })-&gt;pack();
MainLoop;

sub getdata {
    return unless ($stop == 0);
    my $sock = IO::Socket::INET-&gt;new(PeerAddr=&gt;$host,Proto=&gt;'tcp',PeerPort=&gt;80,)
;
    return unless defined $sock;
    $sock-&gt;autoflush(1);
    print $sock &quot;GET $url HTTP/1.0\r\nHost: $host\r\n\r\n&quot;;
    my $status = &lt;$sock&gt;;
    die unless ($status =~ m|HTTP/\S+\s+200|);

    my ($grab,$jpeg,$data,$image,$thisbuf,$lastimage);
    while (my $nread = sysread($sock, $thisbuf, 4096)) {
        $grab .= $thisbuf;
        if ( $grab =~ s/(.*?)\n--ZoneMinderFrame\r\n//s ) {

            $jpeg .= $1;
            $jpeg =~ s/--ZoneMinderFrame\r\n//; # Heh, what a
            $jpeg =~ s/Content-Length: \d+\r\n//; # Nasty little
            $jpeg =~ s/Content-Type: \S+\r\n\r\n//; # Hack

            $data = encode_base64($jpeg);
            undef $jpeg;
            eval {
                $image = $mw-&gt;Photo(-format=&gt;&quot;jpeg&quot;,-data=&gt;$data);
            };
            undef $data;
            eval {
                $photo-&gt;configure(-image=&gt;$image);
            };
            $lastimage-&gt;delete if ($lastimage); #essential as Photo leaks!
            $lastimage = $image;
        }
        $jpeg .= $1 if ($grab =~ s/(.*)(?=\n)//s);
        last if $stop;
        $mw-&gt;update;
    }
    $stop = 0;
}
&lt;/pre&gt;

Russell Handorf used threads to &lt;a
href=&quot;http://www.zoneminder.com/forums/viewtopic.php?t=6037&quot;&gt;support
more than one camera at a time&lt;/a&gt; (although I would probably do this in
a loop or with select instead of threads)
</description>
  </item>
  <item>
    <title>Controlling a Plasma Screen via the Internet</title>
    <pubDate>Sun, 20 Nov 2005 00:00:00 GMT</pubDate>
    <link>/ha/plasma.html</link>
    <description>
Earlier this year I finally got around to buying a replacement TV, and
settled on a Hitachi PD7200 plasma.  First thing I noticed was a port on the back
labelled 'service use only' which sounded like a fun challenge.
&lt;p&gt;
&lt;img src=&quot;hitachiserviceport.jpg&quot; width=300 alt=&quot;service use only&quot;&gt;
&lt;p&gt;
Turns out that on the Hitachi PD7200 plasma this is a serial port that
is enabled by default, so you just need to know the right protocol 
and you can talk to the plasma.  I don't have a PC close to the plasma,
but last year I did buy some Lantronix MSS100 devices which have a 
10/100 ethernet connection at one end, and a serial RS232 port at the other.  
I was't quite sure what I'd use them for, but for under 50 pounds each
they seemed like a bargain at the time.
&lt;p&gt;
&lt;img src=&quot;lantronix.jpg&quot; width=400 alt=&quot;serial to parallel converter&quot;&gt;
&lt;p&gt;
Hitachi technical support replied to my query within hours and
sent me a couple of PDF documents outlining the protocol, so this
was going to be much easier than guesswork.
&lt;p&gt;
Knowing the filename, google found this online version, 
&lt;a href=&quot;http://www.beamerandmore.de/downloads/pages/bedienungsanleitung/hitachi/55PMA550E_PW1_RS232C.pdf&quot;&gt;Hitachi control protocol, pdf&lt;/a&gt;
&lt;p&gt;
A small amount of perl later, and I had script that could query
the TV to find out various things (settings, channel, and interestingly
the number of hours the TV has been on since it started life).  The
script can also get the TV to do various things like turn itself on
and off and select channels.
&lt;p&gt;
&lt;a href=&quot;hitachiplasma.pl&quot;&gt;
&lt;img src=&quot;/mark/gfx/download.gif&quot; alt=&quot;Download&quot; border=0  height=20 width=67 align=middle&gt; Hitachi Plasma control&lt;/a&gt; (perl, 2k)
&lt;p&gt;
So now I have to think of a use for this.  I guess I could get the TV
to change channels when some event occurs (like one of the motion sensors
triggering) or perhaps daily grab the TV panel lifetime to see how many
hours of TV we watch a day (and perhaps what channels).  Perhaps I could
automatically dim the lights and select cinema mode if the channel is
changed to DVD (although I could do that just using a programmable remote).
I'm sure I'll think of a use for this eventually, but it was a fun
diversion for a cold and wet Scottish weekend.
</description>
  </item>
  <item>
    <title>Live outdoor temperature (updated every few minutes, hit reload)</title>
    <pubDate>Fri, 17 Jun 2005 23:49:00 GMT</pubDate>
    <link>/ha/status.html</link>
    <description>
&lt;img src=&quot;http://www.awe.com/ha/temperatures.png&quot;&gt;&lt;br&gt;
</description>
  </item>
  <item>
    <title>Intelliswitch Wall Dimmers</title>
    <pubDate>Fri, 08 Oct 2004 00:00:00 GMT</pubDate>
    <link>/ha/intelliswitch.html</link>
    <description>
We didn't think much about lighting when our house was being built, so
it ended up being fitted out by the builder just like every other new
home with standard white plate light switches.  The lights themselves
however were all the recessed R50 spotlight types.  We went through
a variety of different ideas for lighting control before settling on
using &quot;Intelliswitch&quot; switches for the majority of the house.
&lt;p&gt;
When thinking about home automation most people assume that this includes
having all your lighting under direct control of some computer system.  You
can then control everything from a central point, do cunning scene lighting,
and magically turn on and off lights during the day.  Since our house was
already wired up and we didn't fancy rewiring to install any of the number
of lighting solutions available this left us with a difficult problem.
&lt;p&gt;
&lt;h2&gt;X10 lighting&lt;/h2&gt;

X10 devices are commonly used to control things like lighting and
lamps because they don't require any rewriting.  You can simply use
plug adaptors or light switch replacements and the devices communicate
over the power lines.  So our first experiment was using X10 for
lighting control.

&lt;p&gt;&lt;blockquote&gt;
&lt;img src=&quot;http://www.awe.com/ha/promo-lw10.gif&quot;&gt;&lt;br&gt;LW10 UK light switch
&lt;/blockquote&gt;

&lt;p&gt;The switch most commonly used for this is the LW10 which can turn
lights on and off, dim them, and be controlled by the X10 protocol
from other things.  We didn't much like the look of the LW10; it's
chunky, sticks out of the wall, and according to folks on various X10
forums constantly blows fuses.  Perhaps the biggest problem with the
LW10 is that you can't remotely tell it to go to a discrete dim level.
You can't say &quot;Dim to 50% brightness&quot;, only &quot;Dim by X steps&quot;.  Since
we wanted to do scene lighting this was far from ideal.  Also in the UK
these things are quite expensive; you don't get much change out
of UKP30 per unit.

&lt;p&gt;On the continent the X10 light switches are much better, having
the ability to dim to a discrete level and looking a lot more classy.  
They do need to have a neutral wire at each switch socket to function 
though, which is not common in the UK.  Fortunately when our house
was built the electricial wired a neutral to every socket.  We think
this was to save having to use connectors inside the ceiling as
spotlights were being used, but we'll probably never know for sure. 
Anyway this was good news for us:

&lt;p&gt;&lt;blockquote&gt;
&lt;img src=&quot;http://www.awe.com/ha/promo-lw11.gif&quot;&gt;&lt;br&gt;LW11 German light switch
&lt;/blockquote&gt;

&lt;p&gt;
So we bought one from &lt;a href=&quot;http://www.laser.co.uk/&quot;&gt;Laser&lt;/a&gt; and
put it in the living room, controlling 10 25W R50 spotlight bulbs.
We can't fault the function of this switch, it works reliably and we
can set the level remotely, or using a remote control with a IR X10
receiver in the same room.  However these things are designed to
be fitted to continental backboxes and it never really looked
in place.  &lt;a href=&quot;lw11g.jpg&quot;&gt;See a picture of the lw11 in the
living room&lt;/a&gt;.  We couldn't put the right switch rocker in because
the switch is slightly twisted and it just constantly catches on
the edges stopping it from working reliably.  Also these switches
are a bit more expensive than the UK LW10.

&lt;h2&gt;Just dim it&lt;/h2&gt;

&lt;p&gt;Another problem we had in the house was over-voltage which 
dramatically cut the life of the expensive spotlight bulbs.  Actually
the only place where the life of the bulbs was not affected was in
the en-suite bathrooms which we had fitted with touch switches we'd
bought from somewhere like Argos.  These touch switches were white,
had a LED in the centre, and allowed you to turn lights on and off 
(and critically for the ensuite allowed the lights to turn themselves
off after some number of minutes).  These switches also had a soft
start which we figured was mostly responsible for the increased
lamp life.

&lt;p&gt;&lt;blockquote&gt;
&lt;img src=&quot;http://www.awe.com/ha/promo-touch1.jpg&quot; width=&quot;80&quot; height=&quot;80&quot;&gt;&lt;br&gt;Touch switches in the ensuites
&lt;/blockquote&gt;

&lt;p&gt;So we decided that dimmers were the solution for rooms where we
didn't need automatic control of lighting.  The big blocky white
switches from Argos were not really approriate for the look of the
house.  We looked around and found some amazingly nice looking dimmers
that also were able to be controlled by infrared.  We bought a
few of these from &lt;a href=&quot;www.tlc-direct.co.uk&quot;&gt;TLC&lt;/a&gt; and installed
them in the kitchen and bedrooms.

&lt;p&gt;&lt;blockquote&gt;
&lt;img src=&quot;http://www.awe.com/ha/promo-irdim.jpg&quot; width=&quot;80&quot; height=&quot;80&quot;&gt;&lt;br&gt;Cute IR touchswitches
&lt;/blockquote&gt;

&lt;p&gt;Unfortunately it wasn't long before the first switch stopped working with
a burning smell from inside it.  A month or so later the second switch
stopped working in an identical way.  We gave up and sent the switches back,
perhaps they didn't like the high voltage in the house, they certainly
were not overloaded.

&lt;p&gt;So by now we'd figured out that we didn't really need to be able
to control every light in the house and in fact just the main living room
lights made sense to control and dim for watching movies and so on.  We
also figured out that we really needed to use dimmers with a soft-start
function to help prolong the life of the bulbs.

&lt;h2&gt;Back to where we started&lt;/h2&gt;

I don't know how we found it, but the touch switches we had installed
in the ensuite bathrooms were made by a company called &quot;Touch'n'glo&quot;
in the UK.  Hunting around google we found a web site for them, selling
a range of &quot;Intelliswitch&quot; dimmers.  The basic dimmer allowed you to
touch the light switch to turn the light on and off and hold it down to
dim.  They were available in some lovely brushed metal finishes, 
had switchable colour covers to blend into the decor of the rooms, were
not too expensive, and just looked perfect.  

&lt;p&gt;
We chatted to their sales director and found out that the switches
were designed and built in the UK and that they would soon also be available 
with slaves (for two or three way lighting like on our landings) and 
as multiple gang switches where you want to control more than one light 
from the same place.  Perfect!  We promised to write up a review of the
switches and ordered about 10 of them with a slimline brushed
stainless steel plate.  

&lt;p&gt;&lt;blockquote&gt;
&lt;img src=&quot;http://www.awe.com/ha/promo-intelli.jpg&quot; width=&quot;80&quot; height=&quot;80&quot;&gt;&lt;br&gt;Brushed slimline
stainless steel dimmers
&lt;/blockquote&gt;

&lt;h2&gt;Mini review: Intelliswitch dimmers&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.intelliswitch.co.uk/&quot;&gt;web site&lt;/a&gt; does a
good job of explaining how these work and it's really as simple as
it looks - replacing all ten of the light switches took only an hour
or two and it took us longer to decide what colour inserts to use in
each switch I think.  The only difficulty during installation is 
making sure that you have the load and supply leads correct - the
way our switches had been installed it was impossible to tell from
inspection and we had to rely on a voltage meter (and careful fingers!).

&lt;p&gt;We've been using them now for around nine months without a single
incident, including dimming of some mains halogen GU10 fittings.  The
switches just work, look great, and visitors always admire them.  Some
of the switches have a slight humming noise when they are on which you
can hear when very close to the switches, but that is something you'd
find with any dimmer working in the same way.

&lt;p&gt;So what are the downsides?  to me the only real downside is that
they're not computer or even infrared controllable.  The geek in me
wants to be able to control them remotely.  If these things were X10
compatible those horrible white expensive X10 switches would be left
on the shelves forever.  You can now get RF switches that don't
require rewiring that give you computer control, but they can cost
five to ten times the price, per switch, so it's not very economical.
These intelliswitches are around the same price as you'd buy a 
standard metal wall switch from some large DIY chain.

&lt;p&gt;Okay, there is one more downside that I wasn't expecting.  I was
waiting for the Intelliswitch folks to release their 2-gang and slave
versions of the switch so I could finish converting all the switches
in the house.  At the moment you walk in and see a hallway with
two nice brushed stainless steel switches, and one horrible white
place hall light switch.  About half the switches in the house need
the 2-gang or slave versions.  Originally I was expecting these 
to be available in Spring 2004, but we're not into October and
they are not available.  Intelliswitch didn't reply to my mails, or
phone calls with expected dates, and their web site has been
broken now for a number of months.  Companies house still shows
Touch'n'glo as as existing.  I do hope the company underneath
is okay, these switches simply rock.

&lt;p&gt;
&lt;a href=&quot;http://www.awe.com/ha/officeswitch.jpg&quot;&gt;Intelliswitch in the office&lt;/a&gt;
</description>
  </item>
  <item>
    <title>Custom software using Jabber/XMPP</title>
    <pubDate>Thu, 11 Sep 2003 00:00:00 GMT</pubDate>
    <link>/ha/software.html</link>
    <description>
&lt;h1&gt;Protocol: Jabber&lt;/h1&gt;
&lt;p&gt;
I toyed with several ways of dealing with the home automation system.  Misterhouse looked very impressive and
was written in Perl so easy to extend, but it also liked to take control directly itself of any hardware.  I wanted
each bit of home automation hardware to have its own intelligence, it's own bot, allowing the hardware to exist
on separate machines and architectures.  So I started out writing bits of custom perl for each of the bits of
hardware (with some C for things like serial interfacing which was hard for me to get to work perfectly with Perl).
I then heard about the XAP project which looked quite interesting but seemed to have a number of weaknesses - it mostly
relied on udp broadcast packets for the components to talk together (I wanted components on different network segments, 
some on wireless, some on links I share with video traffic - udp broadcast packets just are not reliable enough), the other
problem was that the components already written were under a license that prohibited commercial use at all.  Not that I
intend to sell this, but if I'm going to work on software I want that sofware under a BSD-style license or failing that
GPL.  So my requirements were to have a lightweight messaging system ideally using XML that could run over a security
layer (for the wireless network) that I could extend and easily write a custom client for.  The answer of course was
Jabber.  With the Net::Jabber module I can easily write bots and clients in Perl for speed, and with the Perl Tk interface
writing user interfaces takes no time at all and they work across platform: 
Linux or even Windows.
&lt;/p&gt;
&lt;p&gt;
The nice thing about Jabber is that clients for Jabber exist for just
about every platform.  It's simply to take the source code for a
Jabber client and add some buttons and things to make it control any
aspect of the home automation system.  And if no source exists you can
simply chat to the lighting bot and tell it &lt;samp&gt;&quot;lights living 18&quot;&lt;/samp&gt;.
The plan is to be able to control this all from a wireless PDA too.
&lt;/p&gt;

&lt;h1&gt;Controller: Fujitsu Point&lt;/h1&gt;
&lt;p&gt;
The big test; would Perl and Tk and a Net::Jabber client run okay on a AMD 100MHz processor running in 800x600 256
colour mode?  The startup time is about a minute, but then once it's done it happily refreshes the screen with no
real visible delays and sends and receives (and parses) messages without a hitch.  Here are some pics from the 
initial interface written over Christmas vacation 2002.
&lt;p&gt;

&lt;img src=&quot;http://www.awe.com/ha/ham1.png&quot;&gt;&lt;br&gt;
&lt;i&gt;Figure 1: Lighting interface (a Jabber x10 bot)&lt;/i&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham2.png&quot;&gt;&lt;br&gt;
&lt;i&gt;Figure 2: TiVo interface (a Jabber TiVo bot communicating with a custom tivoweb module that
returns XML status information)&lt;/i&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham3.png&quot;&gt;&lt;br&gt;
&lt;i&gt;Figure 3: Heating interface (a Jabber to one-wire bot that talks to the one-wire temperature sensors,
logs data using rrdtool, and talks to the one-wire heating switch)&lt;/i&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham4.png&quot;&gt;&lt;br&gt;
&lt;i&gt;Figure 4: Misc stuff interface (the DSL bot talking to the cable modem and the UPS bot talking to the UPS device.  
Alerts also come in here)&lt;/i&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham5b.png&quot;&gt;&lt;br&gt;
&lt;i&gt;Figure 5: Caller ID interface (a Meteor caller id bot with pop-up pics for most of the people we know)&lt;/i&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/ham7.jpg&quot;&gt;&lt;br&gt;
&lt;i&gt;Figure 6: Interface to front door camera (rear only goes into the MV1000 so far)&lt;/i&gt;
&lt;p&gt;

Each hardware component has it's own bot that can be queried for status and can also be made to broadcast
status information either when something changes or every minute.  The client simply parses every message
it receives and displays it in the right place.  Software will be here soon.
</description>
  </item>
  <item>
    <title>Mounting a Fujisu Point tablet on the wall</title>
    <pubDate>Wed, 23 Jul 2003 00:00:00 GMT</pubDate>
    <link>/ha/fujiwall.html</link>
    <description>
I wanted to be able to mount the Fujitsu Point 510 on the wall. I looked
for the official cradle but many months went by without one appearing on
ebay.  A couple of sites show how they mounted their Fujitsu Point into
the wall, but I wanted to be able to lift it off and use it as a tablet
from time to time too.
&lt;p&gt;
Inspiration hit when looking at the back of the Fujitsu and finding a large
number of circular sticky covers - covering really nice screw points.  So
a couple of drywall fixings into the wall and custom brackets later and
here is the result.  The custom brackets were made from
spare PC expansion card slot covers, nice and thin but quite strong)
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/fujiwall1.jpg&quot;&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/fujiwall2.jpg&quot;&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/fujiwall3.jpg&quot;&gt;
&lt;p&gt;
&lt;img src=&quot;http://www.awe.com/ha/fujiwall4.jpg&quot;&gt;
</description>
  </item>
  <item>
    <title>Brief Overview</title>
    <pubDate>Sun, 13 Jul 2003 00:00:00 GMT</pubDate>
    <link>/ha/overview.html</link>
    <description>
&lt;b&gt;Infrastructure&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;&lt;p&gt;3 CAT5 cables to most rooms in the house.  Fortunately the
builder ran some extra cables through the house for me before it was
too late and the final fix happened. I found some cunning 3-outlet
sockets from &lt;a href=&quot;http://www.bka.co.uk/&quot;&gt;BKA&lt;/a&gt; which look good and
blend into a domestic environment.

&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Wireless network (802.11g) that reaches through most of
the house, but on an untrusted part of the internal network.  This
generally gets used by web tablets as the coverage isn't great.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Satellite-grade coax to most rooms.  This allows the cable
modem and cable tv box to all be in separate rooms and away from their
entry point.  Some of the internal cameras use these connections.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;UPS for all the important bits, highly necessary since the house
voltage is regularly over 250 volts and a little tempremental sometimes.
&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;&lt;b&gt;Network&lt;/b&gt;&lt;ul&gt;

&lt;li&gt;&lt;p&gt;Various networking stuff: transparent firewall, second firewall+NAT, 
one  of those D-Link multi-protocol print servers serving a laser and inkjet
&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Home automation server.  In early 2005 my old 400MHz PC finally
gave up.  It was running Red Hat Enterprise Linux 2.1 (it was running
Red Hat Linux even before I started working for Red Hat).  Machine was
replaced with a dual-AMD machine.  This machine runs the &lt;a
href=&quot;software&quot;&gt;Jabber server&lt;/a&gt; and the various HA bots.&lt;p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;A central 19&quot; patch panel for the CAT5, coax,
and 10/100 16 port switch (bought from ebay).  
See &lt;a href=&quot;dscf0542.jpg&quot;&gt;photo&lt;/a&gt; (Mar 2002).
19&quot; Wall bracket from &lt;a href=&quot;http://www.minitran.co.uk/&quot;&gt;Minitran&lt;/a&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Cable internet and TV from Telewest.  The Telewest termination
point is in the garage, see &lt;a href=&quot;Dscf0481.jpg&quot;&gt;photo&lt;/a&gt; (Feb 2002).
The cable goes to the central patch panel where it's split to the
cable modem and runs back to the living room where the decoder lives at
the moment.  
&lt;/p&gt;&lt;/li&gt;


&lt;/ul&gt;&lt;b&gt;Lighting&lt;/b&gt;&lt;ul&gt;

&lt;li&gt;&lt;a href=&quot;intelliswitch.html&quot;&gt;How we chose our lighting switches&lt;/a&gt; and settled on the Intelliswitch.

&lt;li&gt;&lt;p&gt;A german &lt;a href=&quot;lw11g.jpg&quot;&gt;LW11G&lt;/a&gt; X10 dimmer switch controlling 10 25W recessed
lights in the main room, the switch *just* fits in the drywall backbox.
I spent many hours working out where to put the computer control unit,
a CM12U, so that it managed to send signals to reach all the rooms
in the house - nearly everywhere I put it there was a blackspot where
things wouldn't work.  Anyway having the CAT5 meant it doesn't matter
where the CM12U is as the CAT5 provides a serial link back to node0.
An AD10 and LW10 finish off the X10 stuff, controlling two sets of
Christmas lights right now. X10 stuff from &lt;a href=&quot;http://www.laser.com/&quot;&gt;Laser&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;&lt;b&gt;Heating&lt;/b&gt;&lt;ul&gt;

&lt;li&gt;&lt;p&gt;Control of the central heating system (it had a 240v switched input
which we control with a relay from a 1-wire switch.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;A set of one-wire temperature sensors from Maxim together with a
1-wire usb interface to allow logging of temperature from around
the house.  We recently added a 1-wire hub so we could use a star
network of more than a couple of sensors.
Anyway the raw data goes into rrdtool and the
output graphs get uploaded via DAV &lt;a href=&quot;status.html&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;


&lt;/ul&gt;&lt;b&gt;AV&lt;/b&gt;&lt;ul&gt;

&lt;li&gt;&lt;p&gt;TiVo with a Turbonet ethernet board from 9th Tee - allowing
remote control from any machine in the house&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;&lt;b&gt;The rest&lt;/b&gt;&lt;ul&gt;

&lt;li&gt;&lt;p&gt;Control of a &lt;a href=&quot;plasma&quot;&gt;plasma screen&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Five Fujitsu Point 1600 webpads &lt;a href=&quot;fujiwall&quot;&gt;mounted on
 the wall&lt;/a&gt; to control everything.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href=&quot;http://www.pathwaydata.co.uk/CallerIdProducts.htm&quot;&gt;Meteor
Caller ID&lt;/a&gt; unit that logs incoming and outgoing calls.  This is
hooked to a Linux box with a bit of C software to decode the
strange format&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Caller ID displayed on the TiVo by using the jabber system&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Alarm system.  The communicator outputs are also wired to 
a Linux box which triggers various events based on the state of
the alarm&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;SMS alerts.  The main linux box is hooked to a dedicated mobile
phone used to send alerts from the UPS, alarm etc. 
(and allow remote control of various things).  Since phone 
cables here are above ground they're too easy to cut!&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;
&lt;b&gt;Plans (as time and money permits)&lt;/b&gt;
&lt;/p&gt;
&lt;ul&gt;

&lt;li&gt;&lt;p&gt;Control the external lighting and curtains (I installed pull-cord
curtains already to make this easier)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Work out a system for distributed TV.  At the moment the TiVo's
RF output feeds up to a distribution amplified in the loft, need to
work out how to watch DVD's (RGB out only) and work on an IR 
distribution system (currently a single 'One For All' remote extender)
&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Maybe move the TiVo and cable box to the node0 and send the 
signal up to the lounge over CAT5&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;
</description>
  </item>
  </channel>
</rss>