Loading...
 

misterhouse


Installation on Windows

My main installation of Misterhouse is on Debian, however I run a windows copy for development and for verifying my modifications on Windows. I've made a couple of notes here regarding Windows, however this information is just a few notes.

Perl

Install ActiveState perl V5.8
Use the following to add the trouchelle repository and a minimum set of required packages:
ppm rep add trouchelle.com http://trouchelle.com/ppm/
ppm install DB_File
ppm install Win32-Setupsup

I don't run the TK inteface.


Installation on Debian

There is at least one person maintaining a DEB for Misterhouse, but I found that it was not updated much, if at all. Given the hackery nature of the Misterhouse development process I felt it necessary to install Misterhouse so that I could apply patches as needed, possibly with local Subversion control.


Install dependencies:

perl (>= 5.6.0-16)
perl-tk (>= 800.024-1)
libterm-readkey-perl (>= 2.21-1)
libdbi-perl (>= 1.35-1)
libhtml-parser-perl (>= 3.35-1)

Recommends: librrds-perl (>= 1.0.35-1)
tk8.4 (>= 8.4.5-1)
libtime-hires-perl (>= 1.20-4) Part of perl 5.8
libgd-gd2-perl
libdbd-mysql-perl (>= 1.2216-2) Could not find
libmime-base64-perl (>= 2.12-4) Could not find

libaudio-mixer-perl
flite
alsa

Add a mh user

su -
groupadd -g 106 mh
useradd -c "Mister House User" -d /var/local/misterhouse \
-g mh -G dialout,tty -m -s /bin/bash -u 105 mh
passwd mh


Extract the mh package as the mh user

#The useradd command above will create
#the /var/local/misterhouse home directory
mkdir /usr/local/misterhouse
chown mh:mh /usr/local/misterhouse
passwd mh
su - mh
cd /usr/local/misterhouse
tar xf /home/michael/misterhouse-2.105.tar
ln -s misterhouse-2.105 mh
cd ~/
mkdir code
mkdir data
cp -Rp /usr/local/misterhouse/mh/data /var/local/misterhouse
cp /usr/local/misterhouse/mh/bin/mh.example.ini \
/var/local/misterhouse/mh.private.ini

chgrp mh /dev/ttyS1
chmod g+rw /dev/ttyS1

vi ~/.bashrc
#Add these lines to the top of the file
export mh_parms=/var/local/misterhouse/mh.private.ini
export MHBASE="/usr/local/misterhouse/mh"
export PATH="$PATH:$MHBASE/bin"
alias cdbase="cd $MHBASE"
alias cdcode="cd $MHBASE/code"


Generate local html documentation for the MH web server

This can be accessed under the "MrHouse Home" / "Local Documents" buttons
cd /usr/local/misterhouse/mh/docs
for i in *.pod; do pod2html $i > ${i/.pod/}.html; done

Add a startup process

I tried using daemontools but this has one serious limitation. For security reasons the author of daemontools intentionally does not inherit any group permissions for the running user. This makes it difficult to manage permissions for devices (e.g. /dev/audio). I gave up on daemontools and currently use "nohup mh&" to manually start mh. This works ok since the server is on UPS and is rarely if ever restarted. I hope to use one of the included start scripts in mh/bin at some point.

Starting and Stoping


Manually

  • Headless / without X-Windows / TK
su - mh
cd data/logs
nohup mh -tk 0 &


  • Using X-Windows / TK
su - mh
cd data/logs
export DISPLAY=x.x.x.x:0.0
mh

NOTE: I highly recommend using X-windows for cygwin if youre OS is MSWin

Configuration

Reference

Getting To Know MH
MH man page

Customize the initialization file

  • Edit the configuraiton file:
su - mh
vi ~/mh.private.ini

  • Add the following entries:
code_dir=/var/local/misterhouse/code
data_dir=/var/local/misterhouse/data
organizer_dir=$config_parms{data_dir}/organizer
html_alias_comics=$config_parms{data_dir}/web/comics
sound_program=/usr/local/misterhouse/mh/bin/play

#Turn off the photo screen saver unless you upload some photos
web_refresh=
#Earthquake defaults are too chatty
Earthquake_Magnitudes=99999 8.0 3000 6.0 100 0
webmute=0
speak_volume=100
voice_text=flite
voice_text_flite=/usr/bin/flite
cm11_port=/dev/ttyS1

cell_phone=yourphone@yourprovider
cell_phone_number=yourphone
latitude= your latitude
longitude= your longitude
city= your city
state= your state
zip_code= your zip
tv_provider=75709
tv_provider_name=Comcast - Plano - Cable B
tv_label=CABLE
comics=dilbert doonesbury
aws_id=PLNRM


Create the items file (*.hmt)

cp /usr/local/misterhouse/mh/code/test/test.mht ~/code/items.mht

  • Navigate to the items editor:
MrHouse Home / Setup MrHouse / Edit Items
  • Pick the items.hmt file to edit.
  • Delete entries you don't need. (Leave at least one group)
  • Create new groups by using the "copy" link on another group.
  • Edit and create new X10 items.
When editing make sure to press enter before leaving a row to save your changes


Create triggers

  • Navigate to the items editor:
MrHouse Home / Setup MrHouse / Edit Triggers
  • Create the following triggers:
living_on_evening time_now $Time_Sunset set $living_light1 ON
living_off_evening1 time_cron '00 21 * * 0-4' set $living_light1 OFF
living_off_evening2 time_cron '59 23 * * 5-6' set $living_light1 OFF
den_on_evening time_now $Time_Sunset set $den_light1 ON
den_off_evening1 time_cron '08 23 * * 0-4' set $den_light1 OFF
den_off_evening2 time_cron '59 23 * * 0-4' set $den_light1 OFF
living_on_morning time_cron '20 06 * * 1-5' set $living_light1 ON
den_on_morning time_cron '20 06 * * 1-5' set $den_light1 ON
charger_off time_now 3:10pm set $Charger OFF

  • Set them all to "NoExpire" except charger which should be "Disabled"

Enable Speech

  • load package flite
  • Add the following to mh.private.ini
webmute = 0
voice_text=flite
voice_text_flite=/usr/bin/flite


Updating MH

My MH installation uses two directories where /var contains the mh home directory, user code, and data; /usr contains the mh application. The directories are owned by the mh user. The procedures below assume that the code directory mh is a logical link to the actual MH application directory.
/var/local/misterhouse
/usr/local/misterhouse

Starting from a tar file

As the mh user:
cd /usr/local/misterhouse
wget http://prdownloads.sourceforge.net/misterhouse/misterhouse-2.103.tar.gz
tar zxf misterhouse-2.103.tar.gz

Starting from SVN

Need to update this once I install subversion and give it a whirl
As the mh user, create a new Misterhouse directory:

To update to the latest changes in the same branch:
cd /usr/local/misterhouse
cd v2-102
svn update
svn status

Don't forget to check the output of the status command to ensure that svn didn't have problems merging any of your own changes to MH

Generate local html documentation for the MH web server

This can be accessed under the "MrHouse Home" / "Local Documents" buttons
cd /usr/local/misterhouse/mh/docs
for i in *.pod; do pod2html $i > ${i/.pod/}.html; done

Shut down and restart MH

Your method may be different:
As the root user:
pkill mh
su - mh
cd /usr/local/misterhouse
rm mh
ln -s [new direcotry name] mh
cd /var/local/misterhouse/data/logs
nohup mh&
exit

Updating the Local data Directory

Unfortunately new additions to this directory can not be guaranteed to occur in the MH or user modules. Some modules will look in the program directory first some don't. I use the procedure below to update the directory manually. This might not be necessary in cases where the associated modules manage the contents; manually copying the files might even cause a module to fail it that module expects to maintain those files.

cat > diff_exclude.txt
tv
cache
logs
.svn
.password
mh_temp*

diff -qr -X diff_exclude.txt data /usr/local/misterhouse/mh/data

Manually copied:
data/phone/phone.area_codes.list
data/shopping_list.txt
data/event_sounds.txt
data/holidays.ca_ab
data/remarks/full_moon.txt
data/infrared/devicelib/*
data/mpd/*
data/alpha/*

Ignored these plus a few more:
data/code_select*
data/tv_*
data/web/comics
data/web/earthquakes.gif
data/web/PLNRM.html
data/web/earchquakes.txt
data/web/top10_list.html
data/web/top10_list.txt

Debugging

Debug Variable List

Stargate485:./lib/Stargate485.pm==4
Stargate485Keypad:./lib/Stargate485.pm==1
UIRT2:./lib/UIRT2.pm==8
ajax:./lib/ajax.pm==7
alsaplayer:./lib/AlsaPlayer.pm==35
analogsensor:./lib/AnalogSensor_Item.pm==14
bsc:./lib/BSC.pm==23
button:./web/bin/button_toggle.pl==1
caddx:./lib/caddx.pm==10
chime:./code/common/speak_chime.pl==1
cid_server:./lib/CID_Server.pm==4
cm11:./lib/Serial_Item.pm==6
compool:./lib/Compool.pm==27
concept:./lib/Concept.pm==5
display:./lib/Display.pm==8
dsc:./lib/DSC_Alarm.pm==3
ebay:./code/common/eBay.pl==18
file:./lib/File_Item.pm==3
froggyrita:./lib/FroggyRita.pm==11
group:./docs/updates.pod==1
group:./lib/Group.pm==19
http2:./lib/http_server.pl==1
http3:./lib/http_server.pl==1
http:./lib/handy_net_utilities.pl==1
http:./lib/http_server.pl==28
ibutton:./lib/iButton.pm==1
im:./code/common/internet_im.pl==2
im:./lib/handy_net_utilities.pl==2
insteon:./lib/Insteon_Device.pm==26
insteon:./lib/Insteon_Irrigation.pm==4
insteon:./lib/Insteon_Link.pm==2
insteon:./lib/Insteon_PLM.pm==28
insteon:./lib/Insteon_Thermostat.pm==4
iplcs:./lib/X10_iplcs.pm==3
iplcs:./lib/iplcs.pm==4
ir:./lib/IR_Item.pm==1
irc:./code/common/internet_irc.pl==24
irrigation:./lib/xPL_Irrigation.pm==17
k8055:./lib/K8055.pm==1
light_item:./lib/Light_Item.pm==6
lirc:./lib/lirc_mh.pm==4
lynx10plc:./lib/Lynx10PLC.pm==9
marrick:./lib/Marrick.pm==14
mp3Rip:./code/common/mp3Rip_code.pl==21
mp3_mpd:./code/common/mp3_mpd.pl==1
mr26:./lib/X10_MR26.pm==2
musica:./lib/Musica.pm==29
net:./lib/handy_net_utilities.pl==6
occupancy:./lib/Base_Item.pm==2
occupancy:./lib/Door_Item.pm==2
occupancy:./lib/Light_Item.pm==4
occupancy:./lib/Light_Restriction_Item.pm==5
occupancy:./lib/Light_Switch_Item.pm==3
occupancy:./lib/Motion_Item.pm==2
occupancy:./lib/Occupancy_Monitor.pm==32
occupancy:./lib/Photocell_Item.pm==2
occupancy:./lib/UPBPIM.pm==1
owfs:./lib/Owfs_Item.pm==19
oww_text:./code/common/weather_iB_OWW_txt_client.pl==1
pa:./lib/PAobj.pm==32
phone:./lib/Acid.pm==2
phone:./lib/CID_Announce.pm==1
phone:./lib/Telephony_Identifier.pm==5
phone:./lib/Telephony_Interface.pm==3
ping:./lib/handy_net_utilities.pl==2
pocketsphinx:./lib/PocketSphinx.pm==16
process:./lib/PocketSphinx.pm==1
process:./lib/Process_Item.pm==9
proxy:./lib/Lynx10PLC.pm==1
rcs:./lib/RCS_Item.pm==2
redrat:./lib/RedRat.pm==1
rf:./lib/RF_Item.pm==1
scene:./lib/Scene.pm==12
serial:./lib/Insteon_Item.pm==2
serial:./lib/Lynx10PLC.pm==4
serial:./lib/Serial_Item.pm==4
serial:./lib/Stargate485.pm==1
soap:./web/bin/soapcgi.pl==2
socket:./bin/mh==1
socket:./lib/Socket_Item.pm==4
socket:./lib/handy_net_utilities.pl==4
stargate:./lib/Stargate.pm==20
sysdiag:./lib/SysDiag_xAP.pm==5
ted:./lib/TED.pm==3
ti103:./lib/Serial_Item.pm==1
timer:./lib/Timer.pm==3
ultimeter:./lib/Ultimeter.pm==6
upbd:./lib/UPB_Device.pm==6
upbt:./lib/UPB_Thermostat.pm==12
utilimeter:./lib/Ultimeter.pm==1
vocp:./code/common/phone_vcop.pl==3
voice:./code/common/speech_clash.pl==4
voice:./lib/PocketSphinx.pm==1
voice:./lib/Voice_Cmd.pm==6
voice:./lib/Voice_Text.pm==19
w800:./lib/X10_W800.pm==2
weather:./lib/Weather_wmr968.pm==1
weather:./lib/Weather_wx200.pm==1
weather:./lib/Weather_wx200d.pm==1
weather_graph:./code/common/weather_rrd_update.pl==1
weather_graph:./web/bin/weather_graph_zoom.pl==1
x10:./lib/Insteon_Item.pm==2
x10:./lib/Serial_Item.pm==1
x10:./lib/TI103.pm==6
x10:./lib/X10_Items.pm==16
x10:./lib/X10_Wish.pm==2
x10:./lib/site/ControlX10/CM11.pm==6
x10:./lib/site/ControlX10/CM11.pm.old==8
x10_scene:./lib/X10_Scene.pm==14
x10_sensor:./lib/X10_Items.pm==2
xantech:./lib/Xantech.pm==3
xAP:./lib/xAP_Items.pm==18
xap_echo:./code/common/xAP_send.pl==1
xpl:./lib/xPL_Items.pm==20
xpl_light:./lib/xPL_Lighting.pm==9
xpl_plugwise:./lib/xPL_Plugwise.pm==4
xpl_security:./lib/xPL_Security.pm==13
zone_minder:./lib/ZoneMinder_xAP.pm==9


Generation Code
perl -an -e 'if(/\$main::Debug\{\s*(\S+)\s*\}/){ \
$H{$1.":".$ARGV}++;} \
END{foreach $h (sort(keys(%H))){ \
print( $h."==".$H{$h}."\n");}}' `find .`


Get a stack trace on failure

Insert this at the top of the mh perl file
use Carp;
$SIG{ __DIE__ } = sub { Carp::confess( @_ ) };



Contributors to this page: michael .
Page last modified on Saturday 08 of December, 2012 11:44:00 CST by michael.