Misterhouse

From LinuxMCE
Revision as of 04:41, 1 December 2008 by Rwilson131 (Talk | contribs)

Jump to: navigation, search

Misterhouse is a great integrated Home automation program and much more.

Installation

Template

It seems that template for Misterhouse is already in LMCE - I only needed to add Computers to "controlled by category", so it can be added as child of Core or MD...

In template, there is an "/usr/local/misterhouse/start.sh" entry in Command line data- that means that LMCE will start this script and therefore also misterhouse. Installation should be made regarding this fact.

HowTo

Currently there are no Ubuntu packages for MH, so it has to be installed from scratch. An detailed guide can be found on Misterhouse's site, I also have found isntructions for ubuntu and MH MisterhouseOnUbuntu

Integration with LMCE

Here's a dirty code snippet for LinuxMCE's listener script under Misterhouse. Be careful since it intercepts all messages and that could become quite greedy...

Before using this script you have to add listener as device under LinuxMCE as explained in LinuxMCE's docs... You have to follow first few steps from LinuxMCE's text message intercepting tutorial (create logic handler device) and then add this script to your Misterhouse setup :


# Category=LinuxMCE
#
#@ Connection with LinuxMCE DCE Router via TCP port localhost:3450 (mh.ini -> pluto_DCE_router). 
#
use strict;

############################################################################## 
$pluto_event_receiver = new  Socket_Item(undef, undef, '193.77.90.224:3450','event_receiver','tcp','record');

$pluto_command_sender = new  Socket_Item(undef, undef, '193.77.90.224:3450','command_sender','tcp','record');

if ($Startup) {
	start $pluto_event_receiver;
        set $pluto_event_receiver "COMMAND 6778";
        	
	start $pluto_command_sender;
	set $pluto_command_sender "EVENT 6778";
	set $pluto_command_sender "PLAIN_TEXT";
# purge other interceptors on same device ID
#	set $pluto_command_sender "MESSAGET 13";
#	set $pluto_command_sender "6778 -1000 13";
	send_command_to_pluto("6778 -1000 13");

# intercepts all messages, I guess it's better to be selective here !!!!	
#	set $pluto_command_sender "MESSAGET 22";
#	set $pluto_command_sender "6778 -1000 8 0 0 0 0 0";
	send_command_to_pluto("6778 -1000 8 0 0 0 0 0");

} 
     
sub send_command_to_pluto {
 my ($message) = @_;
	set $pluto_command_sender "MESSAGET " . length ($message);
	set $pluto_command_sender $message;
        print_log "Sending Command to Pluto DCE : $message\n";
        print     "Sending Command to Pluto DCE : $message\n";
}

if (my $msg = said $pluto_event_receiver) {
        print_log "Pluto Event received: $msg\n";
        print      "Pluto Event received: $msg\n";
}

Some additional work on this matter is described on forum threads here : [1] [2] [3]