Skip to content

MisterHouse Overview

ggodart edited this page Dec 31, 2020 · 1 revision

MisterHouse is a perl program for time, event, web, socket, and voice based home control functions. It currently runs on Windows and on Unix platforms, including Raspian, Linux and Mac OSX.

Perl objects are used for various types of items to give a powerful but concise programming interface. Here is some example code:

$dishwasher = new X10_Item 'B1';         # B1 is the dishwasher X10 code
set $dishwasher ON if time_now '10:30 PM';

speak "I am now closing the curtains at $Time_Now" if time_now "$Time_Sunset + 0:15";
speak "The time is $Time_Now" if time_cron '30,35,40,45,50 6 * * 1-5';

play(file => 'stairs_creek*.wav') if state_now $movement_sensor eq ON;

$v_bedroom_curtain = new Voice_Cmd '[open,close] the bedroom curtains';
curtain_on('bedroom', $state) if $state = said $v_bedroom_curtain;

Items and events are defined by using your favourite text editor and creating members of Perl code in a directory of your choice. For example, all the code that runs in Bruce's house is in the /mh/code/bruce directory.

After starting MisterHouse, in addition to the timed events that you defined, you can trigger MisterHouse actions with any of the following:

  • Sockets, Device state changes and Serial ports can trigger events.
  • Built in Web Server. In addition to several example web interfaces, if you are familiar with HTML, you can write your own customised interface.
  • Telnet. This is customisable with the telnet.pl module.
  • MQTT messages.
  • Voice commands. On Windows platforms, you can use the MSVOICE icon in your tray (the green V) to control the Voice Recognition (VR) mode (manual, keyword-activated, or continuous). You also select your TTS (Text To Speech) voice with MSVOICE. On Unix platforms you can use the Festival TTS engine and pick among different accents and languages. On Linux, you can install IBM's ViaVoice SDK to enable Voice Recognition.
  • Tk GUI. MisterHouse has a data entry field where voice commands can be entered.
  • Command line. Typing any voice command from a command line, using the mh/bin/house command
  • xcmd_file. Programmes can create voice commands to the 'xcmd_file' (see mh.ini)

The interpreted nature of Perl allows us to change/add/delete an event members quickly, without re-starting MisterHouse. After changing code, you tell MisterHouse to re-load the user event code. If there is a syntax error with the new code, the previous version of the code is re-loaded.

Re-loading 20 event members with 1500 lines of event code takes about 2 seconds. MisterHouse takes about 2->5% of the CPU on a Raspberry Pi 4 with over 50 devices defined.

Clone this wiki locally