MisterHouse is an active, community-driven, open source home automation project

Configuration

In the mh-samples.rgz file, I've loaded a default set of parameters that should allow you to get MisterHouse up and running without errors. Understand that not everything in MisterHouse is enabled, only a small subset. The default private INI file for MisterHouse is ~mh/misterhouse/bin/mh.ini.

To make sure MisterHouse uses the correct mh.private.ini file, set the shell variable mh_parms to its path (export mh_parms=${HOME}/local/mh.private.ini). Using the private INI file I have provided, you will find that its default settings will allow MisterHouse to start up (see the abbreviated mh.private.ini in Listing  1). You can experiment later with the other values.

Listing 1

A Section of mh.private.ini

 

Lines that begin with a # or @ are considered comments. Any parameter found in the mh.ini file can be overridden in the mh.private.ini. $Pgm_Root is an internal MisterHouse variable; the gd and tk variables should be left set to 0 (turning off the use of the GD and TK libraries). The http_port file should be changed only if you need to use a different port for the MisterHouse's HTTP server. The rest of the variables are there for you to experiment with.

Now It's Time to Play!

To start up MisterHouse, as user mh, type:

cd ; ./start.sh

If no errors occur, MisterHouse will start spewing information to the terminal.

Next, open a browser and type the following URL into the address bar: http://IP_Address:8080/ (replace IP_Address with the MisterHouse server's eth0 IP address). Figure 1 shows the main web page for MisterHouse.

Figure 1: MisterHouse main web page.

No article can do justice to what MisterHouse can do. I will get you started, give you brief introduction, and then give you something to work with. Fortunately, MisterHouse comes with documentation: http://IP_address:8080/docs/index.html.

In the MisterHouse main window (Figure 1), the most important link is the top left MisterHouse button. This button will return you to the home page. The next important button is the MisterHouse Home button. This button will take you to the administration and configuration page, where you can configure, monitor, and enable/disable the various code modules included with MisterHouse (MisterHouse Home | Setup MisterHouse.

Note the lavender status line at the bottom of the page in Figure 1; 115, 86.9F Partly Cloudy, and North @ 0 mph wouldn't be the values on your system. In my home setup, that information is pulled from a Rube Goldberg set of scripts I built for experimenting with. I've simplified everything for this article. In a moment, I'll introduce you to the command-line tools to mimic the data sent by my experiments and instead use MQTT to fill in the status bar information.

User Code

Your user code tells MisterHouse what you want it to do. The code resides in the local/code directory. The filenames you choose can be anything; the only stipulation is that the code inside must be valid Perl and must have .pl as the file extension. One exception is the .mht file (MisterHouse table). When MisterHouse starts up, it reads in the xxx.mht file, converts it to Perl code, puts it into a file called xxx.mhp, and loads that file. This .mhp and other .pl files will be run as Perl code in MisterHouse's main loop. Code that you don't want to run in the loop, such as code for loading a module or initialization code, will be bound by the # noloop=start and # noloop=stop lines. More on that later. In the examples below, I've created two files called example.mht and mqtt.pl. The example.mht file sets up the needed Perl objects, and mqtt.pl uses those Perl objects to make decisions.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News