Call MisterHouse to Regulate Your Heat

Combine MisterHouse with Perl scripts, X10 and the Linux kernel to create an automated zoned radiant heat system.


ti103 = /dev/ttyS0

You may want to configure a number of other parameters, such as latitude and longitude, that would make MisterHouse more useful, or if you wanted to make heating decisions based on the weather report but nothing else specific to heating control.

Figure 3. Radio Shack/X10 Appliance Module Controlling Circulator

X10 devices are set up in a separate configuration file, x10.mht. The parameters for each device are the type of X10 module, its address, name and the groups to which it belongs. I needed an entry for each appliance module controlling the circulator for each zone. An example entry would be:

X10A, C1, Circulator1, All_Heat|Night_Setback

for an X10 appliance module with a C house code and a 1-unit code named Circulator1 included in the groups All_Heat and Night_Setback. In a MisterHouse Perl script, one way this can be turned on is with the code set:

$Circulator1 'ON';

and all Night_Setback devices can be turned off with:

&set_all($Night_Setback, 'OFF');

If you have multiple X10 controllers, you may need to assign a controller to the device. And, it is very useful to assign labels and groups to devices. mht files are transformed into mhp (Perl code) files as part of MisterHouse startup, or they can be reloaded on a running system through the MisterHouse user interface. Once X10 devices are correctly entered into the .mht file and MisterHouse starts up, they can be controlled manually by the UI, or they can be controlled programmatically via bits of Perl. It also is possible to add X10 devices to MisterHouse directly from the MisterHouse Web interface.

MisterHouse supports a number of user interfaces, including a Tk interface and Telnet. But, the primary interface I use is the built-in MisterHouse Web server. By default, it should come configured to work and should be on port 8080. Using a Vserver made it easy to move it to the standard http port 80. Inside my home, browsing brings up the MisterHouse main page.

Figure 4. DS1820 1-Wire Test Rig

I had several available alternatives for interfacing MisterHouse to 1-Wire. MisterHouse can communicate directly with 1-Wire devices through a 1-Wire serial interface, and they are configured in an .mht file much like X10 devices. One of the machines I was planning on using did not have sufficient serial ports for both the X10 controller and the 1-Wire serial controller, so I opted for a 1-Wire USB controller. MisterHouse currently does not directly support the 1-Wire USB controller. But there are several Linux-specific means of using the 1-Wire USB controller. The Linux 2.6 kernel recently added support for a number of 1-Wire devices and interfaces. This is what I would have preferred to use. Unfortunately, at the time I was developing the code, it was very new and not well documented. There is a 1-Wire filesystem that maps 1-Wire devices to a filesystem. digitemp, a standalone program for both Linux and Windows, can read 1-Wire devices from both USB and serial interfaces, and that is what I elected to use.

My first implementation had digitemp polling all the DS1820 temperature sensors inside MisterHouse. My current implementation has digitemp polling the temperature sensors as an external cron job and recording the information into an RRD database. The following Perl script creates an RRD database with entries for each DS1820 in the @sensor list:

# Category = HVAC
@sensor = ( "28E8E30500000083", "2853327C000000D4");

my $cmd = "rrdtool create temp.rrd --start N --step 60 ";
for $i ( 0 .. $#sensor) {
 $cmd .= "DS:$sensor[$i]:GAUGE:120:30:180 ";
$cmd .= "RRA:MIN:0.5:60:8760 ";
$cmd .= "RRA:MAX:0.5:60:8760 ";
$cmd .= "RRA:AVERAGE:0.5:60:8760 ";
print "$cmd\n";
my $result = system($cmd);

DS:$sensor[$i] specifies the data source (each DS1820), 30:180 are the min and max values for the data source and GAUGE is a particular RRD data source appropriate for temperature sensors. There are three archives: a Min, Max and Average.

I live in the US, so all temperatures are in Fahrenheit; however, digitemp can read and record either Centigrade or Fahrenheit values, and all other values throughout the system are relative to those reported by digitemp.

Polling is accomplished with the following script:

# Category = HVAC

@sensor = ( { sn => "28E8E30500000083", temp => 0 },
	    { sn => "2853327C000000D4", temp => 0 });

# Read the output from digitemp
open( DIGITEMP, "digitemp_DS2490 -c /etc/digitemp.conf \
 -a -q -o\"%s:%R:%.2F\" |" );
while( <DIGITEMP> ) {
 if( $_ =~ /^nanosleep/i ) {
  my $now = localtime;
 } else {
  my ($dvc,$sn,$temp) = split(/:/);
  print "dvc=$dvc sn=$sn temp=$temp\n";
  $temp = 185 unless ($temp);
  for $i ( 0 .. $#sensor) {
   if ($sn eq $sensor[$i]->{sn}) {
    $sensor[$i]->{temp} = $temp ;
close( DIGITEMP );
my $cmd = "rrdtool update temp.rrd N:";
for $i ( 0 .. $#sensor) {
 $cmd .= ":$sensor[$i]->{temp}";



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

In floor heat system

Ryan McDougall's picture

I am interested in knowing more on the system you have installed and on the operations and management of it. We have existing the pipe work in our house to place an in floor heating system but we have not installed a system to this point. I am myself an automation expert and have plans for doing the control system on my own. I am however needing some help with the equipment selection, heating is not something I have much experience with and would like to know what you are using for circulation valves and what temperature of water you are circulating. I am assuming that the valve you have does both circulation and when the temperature is low is will dump to tank to pull heated water back from the system. I am also wondering about circulation methods, do you base circulation on you water temperature or room temperature. I have lots of questions so as long as you are willing to answer I would very much enjoy.
Ryan McDougall

multiple temp sensors

Anonymous's picture

did you ever install multiple temperature sensors in a room to understand the difference between perceived temperature and actual room temperature? thanks for the write-up (i'm an aspiring (considering grad school) architect, designing my own house with a bit of programming knowledge as well).

Peerceived temperature

dhlii's picture

In my list of experiments to do related to this are temperature sensors at different locations within the room.
Radiant floors put the heat at your feet. Perceived temperatures are strongly effected by the actual temperature of ones feet. Rooms also have a temperature profile that changes vertically. If we want both thermal comfort and energy efficiency then we need to start designing systems that create the greatest perception of comfort - without taking a blunderbus approach to HVAC.


Guide to Finance's picture

Thanks for sharing

Apt-get couldn't find package misterhouse

Joatmon's picture

I tried to use the apt-get installation indicated in the article, but it returned "E: Couldn't find package misterhouse". Any ideas as to what I am doing incorrectly?

Misterhouse debian package

Probebot's picture

You can download the debian package here...
Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
On Demand
Moderated by Linux Journal Contributor Mike Diehl

Sign up now

Sponsored by Skybot