Home Automation Setup: May 2011

| categories: home automation, backend, xpl | View Comments

I was planning to answer a question in a comment on previous post and wanted to talk about the number of xPL clients that I have running. Rather than just quoting the number, I thought I'd make a post to put my response in context.

Most of my xPL components support the hbeat schema. So I can identify them by sending a hbeat.request message. My perl xpl-sender command can do this:

bash$ xpl-sender --schema hbeat.request --wait 10

By default, the sender just sends the specified message and exits. But, with the --wait parameter, it prepares to receive replies, sends the message and waits the specified number of seconds for any replies. The output from the above command is a summary of each received hbeat.app reply:

xpl-stat/hbeat.app: bnz-apcups.apc -> * 5/53556/192.168.32.1
xpl-stat/hbeat.app: bnz-blue.slave -> * 5/51540/192.168.32.1
xpl-stat/hbeat.app: bnz-ccost.slave -> * 5/58435/192.168.32.1
xpl-stat/hbeat.app: bnz-dmx.slave -> * 5/44072/192.168.32.1
xpl-stat/hbeat.app: bnz-gpower.slave -> * 5/59772/192.168.32.1
xpl-stat/hbeat.app: bnz-heyu.slave -> * 5/56009/192.168.32.1
xpl-stat/hbeat.app: bnz-lcdproc.slave -> * 5/41722/192.168.32.1
xpl-stat/hbeat.app: bnz-linux.slave -> * 5/46917/192.168.32.1
xpl-stat/hbeat.app: bnz-lirc.slave -> * 5/33992/192.168.32.1
xpl-stat/hbeat.app: bnz-mpd.slave -> * 5/32798/192.168.32.1
xpl-stat/hbeat.app: bnz-ownet.slave -> * 5/46631/192.168.32.1
xpl-stat/hbeat.app: bnz-rfxcomrx.slave -> * 5/40448/192.168.32.1
xpl-stat/hbeat.app: bnz-rfxcomtx.slave -> * 5/48635/192.168.32.1
xpl-stat/hbeat.app: bnz-sendsms.slave -> * 5/47592/192.168.32.1
xpl-stat/hbeat.app: bnz-smart.slave -> * 5/43472/192.168.32.1
xpl-stat/hbeat.app: bnz-udin.slave1 -> * 5/50553/192.168.32.1
xpl-stat/hbeat.app: bnz-udin.slave2 -> * 5/52187/192.168.32.1
xpl-stat/hbeat.app: bnz-wol.slave -> * 5/33981/192.168.32.1
xpl-stat/hbeat.app: bnz-zenah.slave -> * 5/39324/192.168.32.1
xpl-stat/hbeat.app: bnz-mythtv.vz -> * 5/34473/192.168.32.6
xpl-stat/hbeat.app: bnz-smart.vz -> * 5/34298/192.168.32.6
xpl-stat/hbeat.app: bnz-xosd.vz -> * 5/34487/192.168.32.6
xpl-stat/hbeat.app: bnz-xvkbd.vz -> * 5/49051/192.168.32.6

Each summary is of the form:

message_type/schema: source-identifier -> target interval/port/ip

and each source-identifier is of the form:

vendorid-deviceid.instanceid

My vendor id (developer id) is bnz, the device id is typically the type of the device being managed, and the instance id is typically the hostname of the machine running the client.

There are two machines in the list vz (which is my main mythtv box) and slave (which is the main home automation server). (The observant may notice that there is also apc but that is actually running on slave monitoring an APC UPS via USB but the instance id is changed as a convinience in order to distinguish between slave and the UPS as they both report power/battery information.) The clients on the mythtv box are:

  • xpl-mythtv which reports the percentage utilisation of the video inputs/tuners,

  • xpl-smart which reports disk temperatures so I can turn on fans to extract warm air from the server room,

  • xpl-xosd which responds to osd.basic schema messages showing on-screen display text using xosd, and

  • xpl-xvkbd which sends fake key presses to the active window (probably a security risk even though the keys always go to mythfrontend).

The clients on slave are:

  • xpl-apcups which reports status of my APC UPS and sends events if when the UPS switches between mains and battery and vice versa,

  • xpl-blue which monitors for the presence of various bluetooth devices so that my house "knows" when different people are home,

  • xpl-ccost which monitors my mains power usage (or at least it did until it got confusing when I started exporting power) and the solar power generated by the PV panels on my roof,

  • xpl-dmx which sends commands to a Milford Instruments DMX Transmitter to control a Pulsar ChromaZone 12 Controller which in turn drives a number of ChromaRange lamps,

  • xpl-gpower which reports my power usage information into the Google PowerMeter API,

  • xpl-heyu which uses the heyu X10 software control my mains appliances and lights,

  • xpl-jabber which enables interaction via XMPP instant messages (such as Google Talk),

  • xpl-lcdproc which responds to osd.basic schema messages showing text on a picoLCD-4x20-slideshow device using the [lcdproc][] protocol,

  • xpl-linux which reports Linux battery status and events, system temperature, etc.,

  • xpl-lirc which reports LIRC IR remote button presses (so that I can switch the kettle on or send wake-on-lan packets using a basic TV remote control),

  • xpl-mpd which controls a Music Player Daemon to play music in several zones around the house,

  • xpl-ownet which is an interface to an OWFS Daemon that reads from temperature/humidity sensors and writes to relay controllers on the one-wire network in my house,

  • xpl-rfxcomrx which is an interface to an RFXCOM RF Receiver that reports RF messages received from various sensors, switches, etc.,

  • xpl-rfxcomtx which sends RF messages via an RFXCOM RF Transmitter to control X10, HomeEasy, etc. devices,

  • xpl-sendsms which sends SMS messages via any service supported by the SMS::Send Perl API (I use the service from Connection Software),

  • xpl-smart which reports disk temperatures,

  • two instances of xpl-udin to control two UDIN USB Relay Controllers to momentarily pulse the open/close inputs of several blind and curtains,

  • xpl-wol which sends wake-on-lan packets (using the etherwake command) to wake up devices that are shutdown in order to save power (such as my mythtv box), and

  • zenah which is the brains of my house - triggering actions based on timers and incoming xPL messages.

I am also running several other clients that run in stealth mode - that is only sending messages and not listening for or responding to hbeat.request messages. These "inputs" include:

  • a web frontend,

  • an experimental daemon supporting the lightswitch API so that I can use existing Android (or iPhone) applications to control my house, and

  • some security-related inputs (that I wont be writing much about).

I'm currently trying to refactor the code to separate out the device-related code from the xPL code and to reduce the coupling between the web interface and the zenah "brains". This will probably involve a couple re-write of the zenah component and the web interface.

Read and Post Comments

Rackmount ITX

| categories: home automation, backend | View Comments

This is going to be the heart (or maybe that should be brain) of our automated home.

ITX Inside

At the moment it's named "slave" after a computer from Blake's Seven. If it works out well enough we might rename it "Orac" or "Zen".

I'm hoping there is enough space in there to fit in a PCI serial card and hide the VIOM in some of the spare space.

Read and Post Comments

More jabber bots

| categories: home automation, backend | View Comments

I spent a little time coding a Perl module to hide the details of bots. Had a little trouble with the Net::Jabber modules because I couldn't find the XML stream socket to add to the select loop of the new module. I might email the author of the Net::Jabber modules to ask about this.

After converting the two existing modules, I decided to take a look writing a temperature monitor using the Dallas 1-Wire stuff, that I'd been trying to find time to look at for a few days. Fortunately Debian includes the digitemp package so it didn't take long to get this working. The only problem was that it was worryingly hot in my computer room thanks to the current unusually hot summer weather.

While I'd been busy coding, I'd not noticed the problems with our ADSL link going up and down every thirty seconds. So I decided to write a monitor for the network interfaces on my firewall too. That took only a few minutes which means the modules I wrote are already helping.

Read and Post Comments

Jabber!

| categories: home automation, backend | View Comments

I looked at spread, but I was getting too many errors from the Perl API. So for now I'm going to use Jabber clients for the messaging infrastructure.

I wrote two simple clients using the Net::Jabber perl modules. The first was for X10, that reports events and will take commands, and then a second for caller id, that will report calls/rings and will accept commands to send to the modem. These thumbnails link to genuine screenshots - edited only to remove my mobile number.

X10 Chat Window Caller Id Chat Window

Read and Post Comments