![]() |
||||||||||||||||||||||||||||||||||||||||||||||||
October 8, 2025 Wednesday 12:37 AM
|
Presenting MisterHouse as a Highly Customizable SmartHome Solution
Paraphrased from the MisterHouse homepage on sourceforge.net.
MisterHouse is an open source home automation program written in PERL. MisterHouse uses commodity sensors and control devices and initiates events based on time, web, socket, voice, and serial data. Perl subroutines and objects are used to give a powerful programming interface This is what the setup file looks like:# # Type Address VariableName Groups Other Info # The PLM is a main communications interface from the computer's USB port to the PowerLine INSTEON_PLM, PLM, MyPLM # Generics are just simple variable, no address info GENERIC, running_fake_household, Security_Settings GENERIC, jimmies_nightstand_status GENERIC, ds_i_motion_1_status GENERIC, us_i_leaksensor_1_status INSTEON_MOTIONSENSOR, 28.5B.70, ds_i_motion_1, Sensors #Downstairs Insteon motion sensor Model 2420M V2.0 1910 INSTEON_MOTIONSENSOR, 28.50.AA, us_i_leaksensor_1, Sensors #Upstairs Insteon Leak Sensor INSTEON_APPLIANCELINC, 2E.6D.52, jimmies_nightstand, All_Lights|Insteon_Lights #2457D2 R3.6 3514 INSTEON_APPLIANCELINC, 2E.60.D5, christmas_lights, All_Lights|Insteon_Lights #2457D2 R3.6 3514 ######### # X10 Security items reecived over W32 RF=>Serial Interface RF, 81, door81, Security, FrontDoor RF, CE, doorCE, Security, GarageDoor RF, 22, kr10a_22, Security, securityremoteKR10A_1 ######### # X10_Sensors for detecting motion and brightness X10MS, M1, ms14a_m1, Sensors, MS13 # This detects both motion and brightness X10I, L1, security_light, All_Lights|Security_Lights|Study(10;10), PLM # This is a plug in appliance/light module X10I, L2, upstairs_light, All_Lights|Security_Lights|Study(10;10), PLM X10I, D2, misc_light, All_Lights|Security_Lights, CM17This is what typical code looks like: $fountain = new X10_Item 'B1'; set $fountain ON if time_now '6:00 PM'; $movement_sensor = new Serial_Item 'XA2', 'stair'; play(file => 'stairs_creek*.wav') if state_now $movement_sensor eq 'stair'; $v_bedroom_curtain = new Voice_Cmd '[open,close] the bedroom curtains'; curtain('bedroom', $state) if $state = said $v_bedroom_curtain; ####################################################################################### # X10 multi-button remote control handler # Note, the codes in the $remark string are for my easy visual logfile scanning and can be simplified. if (state_now $kr10a_22) { # If the state of variable $kr10a_22 has changed, do this $ls=state $kr10a_22; # Store the current state of $kr10a_22 in $ls (in case the value changes during the decision tree) if ($ls eq 'lightson') { my $remark = "[C] Event: ++++L Turning all lights ON by Security Remote KR10A(22) command"; set $all_lights ON; print_log "$remark"; } elsif ($ls eq 'lightsoff') { my $remark = "[C] Event: ----L Turning all lights OFF by Security Remote KR10A(22) command"; set $all_lights OFF; print_log "$remark"; } elsif ($ls eq 'armawaymin') { my $remark = "[C] Event: ++++S Arming Security System by Security Remote KR10A(22) command"; set $mode_security 'armed'; print_log "$remark"; } elsif ($ls eq 'disarm') { my $remark = "[C] Event: ----S Disarming Security System by Security Remote KR10A(22) command"; set $mode_security 'unarmed'; print_log "$remark"; } elsif ($ls eq 'panic') { my $remark = "[C] Event: ++++P PANIC generated by Security Remote KR10A(22) --------------"; set $mode_security 'panic'; print_log "$remark"; } else { my $remark = "[C] Event: UNHANDLED SIGNAL - Security Remote KR10A (22) says $ls, not sure how to handle it"; print_log "$remark"; } } #################################### SIMPLE (logic-free) TIMED EVENTS #################### if (time_now "4:30 PM") { set $christmas_lights 'on'; print_log "[C] ProgrammedEvent-DailyEvening: turning Christmas_lights on"; } #################################### Logic-defined WorkDay EVENTS #################### if (($Date_Now =~ /Mon/) || ($Date_Now =~ /Tue/) || ($Date_Now =~ /Wed/) || ($Date_Now =~ /Thu/) || ($Date_Now =~ /Fri/)) { if (time_now "5:30 AM") { set $jimmies_nightstand 'on'; print_log "[C] ProgrammedEvent-WeekDayMorning: turning jimmies_nightstand on"; } if (time_now "6:20 AM") { set $jimmies_nightstand 'off'; print_log "[C] ProgrammedEvent-WeekDayMorning: turning jimmies_nightstand off"; } } Here is a list of the standard code files, simple example code files, and some examples of user code files Here are some examples of speech output:Turning furnace heat off after 20 minutes at 69.1 degrees Good Morning. The sun is bright today at 32 percent. It is cold outside, 24 degrees. I will open the curtains at 8:07 AM The van is traveling north at 58 mph 0.8 miles west of Walmart. The car is parked at Friedell School. Email account nick has 1 new email message from accountmanager. Notice, Nick has been on the computer for 2.1 hours today. The front door has been left open. Phone call from Charlie Brown in California. Notice, there were 668 web hits from 74 clients in the last day, including 24 recognized attack vectors. MiserHouse can control almost anything capable of being remotely controlled or monitored by a computer. It may already exist or you may have to write it yourslef, but it can probably be handled by MisterHouse. Here are some of the existing interface possibilities, with installation details included for green items:
Preparing the server for MisterHouse
MH is written primarily in PERL and provides a lot of different tools and functions. You'll need all the PERL functions below to make it run at its best. To install (meaning download and compile) those PERL modules you're going to need to add a few libraries and tools to the default CentOS/RHEL installation. CentOS already provides PERL by default, but let's go ahead and make sure everything is in place and up to date.[user@localhost ~]$ sudo yum update [user@localhost ~]$ sudo yum install perl perl-devel gcc curl perl-YAML perl-CGI [user@localhost ~]$ sudo yum install gd gd-devel php-gd [user@localhost ~]$ sudo yum install perl-BerkeleyDB perl-DBD-MySQL perl-DB_Fileecho -n "Starting MisterHouse... " # go to default RPM misterhouse directory cd /var/mh/bin # setting to stop memory leak problem in RH 8 and 9 export mh_parms=/var/mh/mh.carnation.ini export LANG=C Now use the PERL cpan eshell to build the PERL modules needed by MH [user@localhost ~]# sudo perl -MCPAN -eshell cpan> install CPAN cpan> reload CPAN cpan> install LWP cpan> install URI cpan> install HTML cpan> install Switch cpan> install Tk cpan> install Tk::JPEG cpan> install Tk::CursorControl cpan> install DB_File # will likely fail due to the lack of a db.h include file. Working on it cpan> install Term::ReadKey cpan> install Time::HiRes cpan> install Audio::Mixer #if on Linux) cpan> install GD cpan> install Text::LevenshteinXS cpan> install DBI #if you want to interface to a database server cpan> install DBD::mysql #if you want to interface with a mysql server cpan> exit [root@localhost ~]#The first time you run the CPAN code, it creates a configuration file. The defaults (press enter a bunch of times) usually is good for all questions except the one that ones you to pick which site to download from. You may need to type "export FTP_PASSIVE=1" before "perl -MCPAN -eshell". This is because by default the CPAN installer will generally try to use active ftp sessions which may fail if you are behind some firewalls and/or if your ISP caches ftp sessions. By exporting the FTP_PASSIVE variable prior to running the CPAN installer session, passive connections will be used instead. If you see errors during the builds, the perl install files contain README files which explain their dependencies. It's perfectly safe to re-run the commands. If it worked, CPAN will tell you it is up to date and do no more. Installing the MisterHouse Components
httpd, php, php-fpm
|
|
||||||||||||||||||||||||||||||||||||||||||||||
all original content ©1994-2025 Yes, that means 30+ years on the web An exercise in truly free free-speech. No license required, no training wheels available. "When words lose their meaning, people will lose their liberty." -- Confucius vincit omnia veritas |