Installing HouseAgent on Linux

Following up on yesterday’s post, here are the instructions to install HouseAgent on Linux.
I took one of the most popular Linux distribution’s (Ubuntu) for this blog post, but it should be easy to apply this guide for other distributions as well.

Step 1: installing HouseAgent prerequisites

The first step is to install the HouseAgent prerequisites, there are two (Erlang and RabbitMQ) but you can install them using a single command line.
Start the terminal in Ubuntu:

Now enter the following command:

Installing HouseAgent on Windows

It has been two weeks ago since I released the first (private) beta version of HouseAgent. A handful of people starting testing and playing with it, and I noticed that documentation and instructions are lacking a bit.
In this blog post I will guide you through the process (in very basic steps) of installing the core of HouseAgent. The good news is, that this will get core of HouseAgent up and running. The bad news is that you can’t do anything with, not without plug-ins at least. I will dive into the subject of installing plug-ins in another blog post.

Step 1: installation of RabbitMQ (and Erlang)

RabbitMQ is the message broker required by HouseAgent, you can download it from here.
You need the server with Windows installer:

After you have started the RabbitMQ setup, it will alert you that you also need Erlang:

HouseAgent: plug-ins

Yesterday’s post introduced HouseAgent. In today’s post we will dive deeper into HouseAgent plug-ins and their architecture. HouseAgent plug-ins can be programmed in any language, but Python is by far the preferred language for plug-ins.
The previous post mentioned that a plug-in is a completely isolated component in the HouseAgent network. While this is true for the plug-in itself, it doesn’t apply to the plug-ins GUI pages. These GUI pages hook into the coordinator directly.
Inside the plug-in you have total freedom of what you want to do with it, do you want to talk to a serial port? No problem. Do you want to fetch a website and report those values? No problem either. Maybe you want to read out a certain file generated by another program? Guess what..
Although you have total freedom of what happens inside the plug-in, there are certain rules to stick to when it comes to reporting to the broker. This is required for other components to understand the messages send by your plug-in. To provide the plug-in developer with an easy way to interact with the broker and use certain standardized messages (value updates, power on commands etc.) HouseAgent provides a plug-in API.

Introducing HouseAgent

HouseAgent is a multi platform, open source home automation application.

That was the short introduction of something I have been working on for quite some months already. HouseAgent has been running as my own home automation software for some time.
I hear you asking, why not use one of the standard software products available? There are a couple of reasons for that:

Horstmann HRT4-ZW Thermostat – open ends

A few weeks ago I received an e-mail from a guy who rather stays anonymous, but had some really great additional/detailed information about the HRT4-ZW thermostat.
There’s some things I missed out, or did configure along the way while tinkering with this device but forgot to mention. So here’s a post about these “open ends”.

  • Previously I mentioned an “ERASE” mode, this is actually “EXCLUDE” mode. This mode should only be used if your thermostat was previously installed in a z-wave network, I guess this was the case when I first set-up my thermostat. The protocol reset does more or less the same but is more extensive. It removes any network information from the HRT4-ZW and returns it to the factory default state (The double press of the dial is to avoid accidental operation)
  • The way incorporate the devices with a controller (in my case the Aeon Labs Z-Stick) is to start with both in an unassigned state. Install each device separately on to your controller. The Association between the two devices may be done using the ‘A’ command on the HRT4-ZW and pressing the install button on the ASR. This does not require knowledge of the node numbers. The install (network) button is required for installation. You need to hold the button down for over a second.
  • I forgot to mention about the wake-up time, I changed the wake-up time while it was in the LI (listen) mode. The default wake-up time is around 23 hours, which is a bit long when you want your thermostat changed. I changed it to 256 seconds or in other words 4 minutes and 16 seconds (the bare minimum value), but I might change it to a higher value again later on.. please see the point below why..
  • The 2 year battery life (as reported by Horstmann) is based on normal use as a stand-alone thermostat. Use in a network where the HRT4-ZW is woken up regularly will reduce this time. That’s why there is a minimum wake-up interval. Battery life should not be a problem in practice, but please note that when the HRT4-ZW is in installer mode (switch 1 up) the Z-Wave module is permanently powered and takes much more power. This is why my battery life reported 90% after some tests. 0% is 2V and 100% is 3V or above. A new set of batteries will normally give just over 3V (2xAAA, 1.5v each)
  • There is actually a second and third configuration parameter I forgot to mention about. The second one allows you to change to Fahrenheit messages. The third one allows you to set a delta t for reporting temperature changes. A message will be sent to associated nodes if the temperature changes by delta t. This parameter defaults to 1°C.
  • When controlled by Z-Wave messages rather than turning the dial, you can actually set the setpoint to 0.1°C steps. This will not show up on the display as it’s only 2 digits, but it will attempt to control to it. For example you could set the setpoint to 20.6°C if you wished. 21°C will be shown on the display as the demand temperature is rounded up. Fahrenheit temperatures are converted internally to the nearest 0.1°C so will not give you more accuracy.

Some really valuable additional information, thanks a lot Mr.Anonymous ! :-)

The power of open source and social coding

A few weeks ago I published the open-zwave Python wrapper. I basically started with a small wrapper suiting my personal needs. After a couple of days I was asked to share the code on Github. Until then I never used Github before.

I did not expect anything from that whole social coding thing. But then after a couple of days two guys (Steve Davidson and Drew Perttula) started commiting code (a lot of code!) to the project. Here’s the result of 3 weeks on Github:

52 commits with 5,421 additions and 510 deletions

Really impressive, thanks a lot guys!
Steve even made a really nice curses interface to it, here are some screenshots (click for full view):

This interface available on Github as well.

Horstmann HRT4-ZW Thermostat

About one month ago I ordered a Horstmann HRT4-ZW thermostat. I came across this z-wave thermostat while I was surfing across the web. As far as I know this is the only EU thermostat available right now. Some of the features I like and I was looking for in a z-wave thermostat:

  • Control the setpoint
  • Get a setpoint report when it is manually changed (also notifications of battery levels and the room temperature)
  • Get the actual room temperature

There are several posts on the Micasa Verde and Homeseer forums that device is not working in their software, despite this fact I decided to take the risk and order this device. The total cost including shipping costs was just under €100.
The HRT4-ZW is a thermostat system that consists of two devices, one controller (the user side of the system, where you control the set point etc.) and a receiver (this one needs to be attached to your HVAC system). Here’s a picture of both devices:

Bus pirate: reading BMP085 temperature

This post continues upon the last Bus Pirate post. In that post I was able to read a register from a BMP085 pressure chip.
In this post I will use the pyBusPirate python library to read the BMP085 temperature value (pyBusPirate allows you to script actions to the bus pirate)

Let’s start by reading the uncompensated (raw) temperature value, as described in the datasheet:

Bus pirate: “talking” to chips (BMP085 used as sample)

Today I received a package from Seeedstudio, containing some components and yes, also a bus pirate. The Bus Pirate is an open source hacker multi-tool that talks to electronic stuff. Some information about it’s features can be found here:
To test the functionality of the bus pirate, I used a BMP085 pressure sensor chip. This chip allows you to measure barometric pressure, as well as temperature. This chip uses the I2C protocol, a protocol that “talks” between chips (for example, a microcontroller and a sensor).
I2C can be analyzed with the bus pirate. Enough introduction, let’s start by practice.

This is how I connected the bus pirate to the BMP085:

Bus Pirate BMP085(pin)

+3.3volts, Vpullup VDDA, VDDD (3,4)

From Python module to GUI, software evolution

Having a Python module to control a z-wave network is great, but not really directly useful in practice. I can’t imagine myself switching lamps on and off everyday using a Python script.
However, with a nice GUI it will become much more useful. Today I created a GUI around the py-openzwave module, for use within my home automation software (HouseAgent)
HouseAgent uses a plugin structure so I can easily add new plugins in a few basic steps:

  • Add the needed HTML templates for the GUI interface
  • Create some Python code to query the right information from the specific plugin
  • Add some device types to the database