ARCHIVE
LinuxMCE Forums
May 19, 2013, 02:40:39 am GMT-1 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Rule #1 - Be Patient - Rule #2 - Don't ask when, if you don't contribute - Rule #3 - You have coding skills - LinuxMCE's small brother is available: http://www.agocontrol.com
 
   Home   Help Search Chat Login Register  
Pages: [1]
  Print  
Author Topic: Misterhouse as Pluto parent device....  (Read 1469 times)
archived
Hello, I'm new here

Posts: 0


View Profile
« on: October 23, 2005, 11:44:13 pm »

Hi,

based on code for Misterhouse as message interceptor :

http://plutohome.com/support/phpbb2/viewtopic.php?t=389

I've created further step. Now Misterhouse registers as normal Pluto devices and plays role of being parent device for his few internal devices. In this manner, MH devices can be controlled from Pluto (in below example this is not yet functional - need to parse incoming messages from Pluto) - that also displays their status (sensors, etc..)....

for this to work, you need to create Misterhouse device and add few generic non DCE devices as its children. Then you customize example below and put it in MH code directory (code is not pretty, but I hope understandable)....

HTH,

regards,

Rob.



pluto_parent_device.pl :

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

##############################################################################
$pluto_device_event_receiver = new  Socket_Item(undef, undef, IP:PORT','device_event_receiver','tcp','record');

$pluto_device_command_sender = new  Socket_Item(undef, undef, 'IP:PORT','device_command_sender','tcp','record');

my $motion=0;

if ($Startup) {
# 6779 is ID of Misterhouse parent device

start $pluto_device_event_receiver;
        set $pluto_device_event_receiver "COMMAND 6779";
       
start $pluto_device_command_sender;
set $pluto_device_command_sender "EVENT 6779";
set $pluto_device_command_sender "PLAIN_TEXT";

}
     

if (my $msg = said $pluto_device_event_receiver) {
        print_log "Pluto Device Message received: $msg\n";
        print      "Pluto Device Message received: $msg\n";
}


if (new_second 20) {
# 6780=Detector ID, 2=event, 9=event ID (tripped), 25=tripped value, 1=value (tripped ON)
my $message = "6780 -1000 2 9 25 1";
set $pluto_device_command_sender "MESSAGET " . length ($message);
set $pluto_device_command_sender $message;
}


if (new_second 7) {
# 6780=Detector ID, 2=event, 9=event ID (tripped), 25=tripped value, 0=value (tripped OFF)
my $message = "6780 -1000 2 9 25 0";
set $pluto_device_command_sender "MESSAGET " . length ($message);
set $pluto_device_command_sender $message;
}


if (new_second 30) {
my $random_number = rand(32.0);
# 6783=temp sensor ID, 2=event, 25=event ID (temp changed), 30=value, temperature (string)
my $message = sprintf("6783 -1000 2 25 30 %d.2",$random_number);
set $pluto_device_command_sender "MESSAGET " . length ($message);
set $pluto_device_command_sender $message;

}

if (new_second 30) {
my $random_number = rand(100.0);
# 6784=brightness sensor ID, 2=event, 25=event ID (temp changed), 30=value, brightness  (string)
my $message = sprintf("6784 -1000 2 25 30 \"%d.2%\"",$random_number);
set $pluto_device_command_sender "MESSAGET " . length ($message);
set $pluto_device_command_sender $message;

}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Pluto provided a snapshot of their forums with approximately 5,000 posts in February, 2007 when LinuxMCE branched off. Browse those forum posts in the Archive section. Those posts have been included in the search engine and can be found with keyword searches.