Difference between revisions of "Misterhouse"

From LinuxMCE
Jump to: navigation, search
Line 1: Line 1:
 
<table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table>[http://www.misterhouse.com Misterhouse] is a great integrated Home automation program and much more.
 
<table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table>[http://www.misterhouse.com Misterhouse] is a great integrated Home automation program and much more.
  
Here's a dirty code snippet for Pluto's listener script under Misterhouse. Be careful since it intercepts all messages and that could become quite greedy...  
+
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...
 
Before using this script you have to add listener as device under LinuxMCE as explained in LinuxMCE's docs...

Revision as of 09:21, 16 March 2007

This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.
Misterhouse is a great integrated Home automation program and much more.

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=Pluto
#
#@ Connection with Pluto 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";
}