Author Topic: LinuxMCE and Misterhouse  (Read 9973 times)

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #30 on: December 14, 2007, 12:55:05 pm »
The CM11? Or is the insteon device able to send x10 codes?

Sadly we don't have insteon in the UK...


chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #31 on: December 15, 2007, 06:48:58 pm »

Here is the latest version of the MH code which addresses the problem detailed in this post:

http://forum.linuxmce.org/index.php?topic=3474.0

As you can see the code is a total hack in many places and I've been lazy becuase I don't know perl (no case statements, no arrays to map pluto device numbers to x10 codes etc etc). It's ugly but it works!

As I said, it's just to tide me over until the LMCE X10 code is mature, or Z-Wave stuff has become more widely available in the UK, so please don't get mad!

Thanks,

Chris



Code: [Select]
# Category=Pluto
#
#@ Connection with Pluto DCE Router via TCP port localhost:3450 (mh.ini -> pluto_DCE_router).
#
use strict;
$restartTimer = new Timer;



##############################################################################

sub connect_lmce {
        print_log "Configuring sockets";
        $pluto_device_event_receiver = new  Socket_Item(undef, undef, '192.168.1.1:3450','device_event_receiver','tcp','record');
        $pluto_device_command_sender = new  Socket_Item(undef, undef, '192.168.1.1:3450','device_command_sender','tcp','record');

        print_log "Closing sockets if any left open";
        if (active_now $pluto_device_event_receiver) {stop $pluto_device_event_receiver;}
        if (active_now $pluto_device_command_sender) {stop $pluto_device_command_sender;}

        print_log "Open and setup new sockets";

        start $pluto_device_event_receiver;
        set $pluto_device_event_receiver "COMMAND 179";

        start $pluto_device_command_sender;
        set $pluto_device_command_sender "EVENT 179";
        set $pluto_device_command_sender "PLAIN_TEXT";
}

if ($Startup) {
        print_log "Starting connection to LMCE";
        set $restartTimer 10, sub {connect_lmce;};
}

if (inactive_now $pluto_device_event_receiver or inactive_now $pluto_device_command_sender) {
        print_log "Connection to LMCE terminated, restarting";
        set $restartTimer 10, sub {connect_lmce;};
}

if (new_minute 1 and !active $pluto_device_event_receiver or new_minute 1 and !active $pluto_device_command_sender) {
        print_log "Connection to LMCE still terminated, restarting";
        connect_lmce;
}



#my $motion=0;

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

        $msg =~ s/[\"\']//g;    # remove quotes before splitting on whitespace

        if ($msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/ or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/) {
                print_log "DeviceFrom: $1";
                print_log "DeviceTo: $2";
                print_log "MsgType: $3 (1=Command, 2=Event)";
                print_log "MsgId: $4";
                print_log "param1id: $5";
                print_log "param2value: $6";
                if (defined $7) { print_log "param2id: $7";}
                if (defined $8) { print_log "param2value: $8";}

                #############################################################
                # $1    $2      $3      $4      $5      $6      $7      $8
                # from  to      msgtype msgid   p1id    p1val   p2id    p2val
                # Example command from orbiter
                # 69    206     1       192     97      ""      98      ""
                # 69    206     1       193     97      ""
                # 69    205     1       184     76      "100"
                # Example command from admin site
                # 0     204     1       760     10      "C2"    154     "192"
                # 0     204     1       760     10      "C2"    154     "193"
                #############################################################

                my $target;
                my $x10_id;

                if ($2 == '162') { $x10_id = 'A5'; }
                if ($2 == '186') { $x10_id = 'A3'; }
                if ($2 == '187') { $x10_id = 'B1'; }
                if ($2 == '188') { $x10_id = 'A8'; }
                if ($2 == '189') { $x10_id = 'B3'; }
                if ($2 == '190') { $x10_id = 'B4'; }
                if ($2 == '191') { $x10_id = 'A10'; }
                if ($2 == '192') { $x10_id = 'A9'; }
                if ($2 == '218') { $x10_id = 'A6'; }
                if (defined $x10_id) { $target = new X10_Item("$x10_id");}

                if ($4 == '760' ) { $target = new X10_Item("$6");}

                if ($8 == '192' or $4 == '192') {
                  print_log "Turn device $x10_id ON";
                  set $target ON;
                }
                if ($8 == '193' or $4 == '193') {
                  print_log "Turn device $x10_id OFF";
                  set $target OFF;
                }
                if ($4 == '184') {
                  print_log "Setting device $x10_id to $6%";
                  set $target "$6%";
                }
        }
}

sub send_pluto_message {
        my($message) = @_;
        set $pluto_device_command_sender "MESSAGET " . length ($message);
        set $pluto_device_command_sender $message;
}

sub update_temp {
        # Example message@
        # 167=temp sensor ID, 2=event, 25=event ID (temp changed), 30=value, temperature (string)
        # my $message = sprintf("167 -1000 2 25 30 %d.2",$random_number);

        my($sensor, $temp) = @_;
        my $lmce_device;

        ### map iButtons to lmce device numbers - there are better ways of doing this! ###
        if ($sensor == 0) { $lmce_device = 166; }
        if ($sensor == 1) { $lmce_device = 167; }

        my $message = sprintf("$lmce_device -1000 2 25 30 %d.2",$temp);
        send_pluto_message($message);
        print_log "Updating sensor $lmce_device $temp";
}

sub lmce_motion {
        my($device_id) = @_;
        # 6780=Detector ID, 2=event, 9=event ID (tripped), 25=tripped value, 0=value (tripped OFF)
        my $message = "$device_id -1000 2 9 25 0";
        send_pluto_message($message);
}

sub lmce_still {
        my($device_id) = @_;
        # 6780=Detector ID, 2=event, 9=event ID (tripped), 25=tripped value, 1=value (tripped ON)
        my $message = "$device_id -1000 2 9 25 1";
        send_pluto_message($message);
}

if ($state = state_now $Kitchen_Motion) {
  if ($state eq MOTION) {
        lmce_motion(185);
  }
  if ($state eq STILL) {
        lmce_still(185);
  }
}

if ($state = state_now $Landing_Motion) {
  if ($state eq MOTION) {
        lmce_motion(184);
  }
  if ($state eq STILL) {
        lmce_still(184);
  }
}

if ($state = state_now $Hall_Motion) {
  if ($state eq MOTION) {
        lmce_motion(183);
  }
  if ($state eq STILL) {
        lmce_still(183);
  }
}

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #32 on: December 15, 2007, 07:43:40 pm »

Here is the latest version of the MH code which addresses the problem detailed in this post:

http://forum.linuxmce.org/index.php?topic=3474.0

As you can see the code is a total hack in many places and I've been lazy becuase I don't know perl (no case statements, no arrays to map pluto device numbers to x10 codes etc etc). It's ugly but it works!

As I said, it's just to tide me over until the LMCE X10 code is mature, or Z-Wave stuff has become more widely available in the UK, so please don't get mad!

I'm cleaning up your Perl code a little, so it's more maintainable by Perl programmers. But I don't have the MH or other systems set up to debug it, so you'll have to test it and let me know if there's problems.

Also, the code says in a comment
Code: [Select]
#@ Connection with Pluto DCE Router via TCP port localhost:3450 (mh.ini -> pluto_DCE_router).but the code itself says
Code: [Select]
        $pluto_device_event_receiver = new  Socket_Item(undef, undef, '192.168.1.1:3450','device_event_receiver','tcp','record');
        $pluto_device_command_sender = new  Socket_Item(undef, undef, '192.168.1.1:3450','device_command_sender','tcp','record');

Is that a hardwired 192.168.1.1 IP# of your core, that should be localhost? Can I just replace that with 127.0.0.1 or something portable?

And what's the context calling that code, so I can look at the functions/vars that the scope you posted inherits?
« Last Edit: December 15, 2007, 08:04:21 pm by Matthew »

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #33 on: December 15, 2007, 08:48:06 pm »
Cool, thanks!

Yes, I hacked it to 192.168.1.1 because my MH box is separate.

The connect_lmce sub configures the 2 sockets, closes if any are left running (sometimes LMCE only closes one connection), then initialises them. This sub is run by the following set of if statements.

1. If MH has just be started up ($Startup)

2. If the socket connections have just been closed (inactive_now is only true the first time MH goes through the code loop and sees the is no connection, hence the need for point 3)

3. Every minute, if the socket connections are still closed


I think parse any received messages. Sometimes they are made of 6 values, sometimes 8 if both param1 and param2 are used. The table in the comments shows the possible messages from LMCE.

The part which starts "if ($state = state_now $Kitchen_Motion) {" should really have been put elsewhere in the MH code, not in this plugin, and the lmce_motion or lmce_still called from there. Again, I was being lazy...

Thanks,

Chris

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #34 on: December 15, 2007, 10:06:43 pm »
The part which starts "if ($state = state_now $Kitchen_Motion) {" should really have been put elsewhere in the MH code, not in this plugin, and the lmce_motion or lmce_still called from there.

In
Code: [Select]
if ($state eq MOTION)is MOTION a scalar variable name that's set to a value before entering that line, or is it a filehandle, or some other kind of variable? Or is it a string literal? In other words, should that line really read something like
Code: [Select]
if($state eq 'MOTION')or even
Code: [Select]
$inMotion = 'MOTION';
$motionless = 'STILL';
$locationCode = '184';
if($state eq $inMotion)
{
  lmce_motion($locationCode);
}
elsif($state eq $motionless)
{
  lmce_still(locationCode);
}

Can state_now return any value other than MOTION or STILL? If so, is there a message for "other", or just silently ignore it?

And are those identifiers like state_now , active_now , inactive_now , new_minute , active , print_log all function names that should end with () when called on an argument list rather shell-script-style on a single argument, separated with a space (eg. "inactive_now $pluto_device_event_receiver" is equivalent to "inactive_now($pluto_device_event_receiver)"?

Can you parenthesize the logic below to make its operator precedence properly explicit, rather than relying on Perl to sort it out?

Code: [Select]
if(new_minute 1 && !active $pluto_device_event_receiver || new_minute 1 && !active $pluto_device_command_sender)
And finally, does that script not need an initial "#!/usr/local/bin/perl" invocation, because it's imported by some other perl script as a string and eval()'d or something?
« Last Edit: December 15, 2007, 10:20:17 pm by Matthew »

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #35 on: December 15, 2007, 10:19:29 pm »
Hmmm. Not sure. I just created that code after looking at some example misterhouse perl files. They don't seem to use quotes .

This may help:

http://misterhouse.wikispaces.com/MotionDetection


By the way, I've now seen an even shorter message from the DCERouter to switch a light off:

69    218     1       193

This means we now have 3 ways the DCERouter may ask us to switch off a light:

69 218 1 193
69 218 1 193 97 ""
0 204 1 760 10 "C2" 154 "193"

God knows why!

Changes to code:

Code: [Select]
        if ($msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/ or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/
                        or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)/ ) {
                print_log "DeviceFrom: $1";
                print_log "DeviceTo: $2";
                print_log "MsgType: $3 (1=Command, 2=Event)";
                print_log "MsgId: $4";
                if (defined $5) { print_log "param1id: $5";}
                if (defined $6) { print_log "param2value: $6";}
                if (defined $7) { print_log "param2id: $7";}
                if (defined $8) { print_log "param2value: $8";}

                #############################################################
                # $1    $2      $3      $4      $5      $6      $7      $8
                # from  to      msgtype msgid   p1id    p1val   p2id    p2val
                # Example command from orbiter
                # 69    206     1       192     97      ""      98      ""
                # 69    206     1       193     97      ""
                # 69    205     1       184     76      "100"
                # 69    218     1       193
                # Example command from admin site
                # 0     204     1       760     10      "C2"    154     "192"
                # 0     204     1       760     10      "C2"    154     "193"
                #############################################################


Thanks,

Chris

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #36 on: December 15, 2007, 10:56:25 pm »
It occurs to me that we're collaborating on development not only outside SVN, but in a Users forum thread. Will you reply to this post just once more, and I'll reply to that with a link to continuing this thread to a new one in the Developers forum? Thanks (and sorry).


Hmmm. Not sure. I just created that code after looking at some example misterhouse perl files. They don't seem to use quotes .

This may help:

http://misterhouse.wikispaces.com/MotionDetection

Here's the cleaned up code. I'm suspicious that the %motionStates values are reversed from correct (though that's in your original code), which is sent when calling my factored lmce_motion() with the "tripped" value. Note that I reorganized the main scope with executable commands first, then sub() defs appended. As I said, I can't test (though it does seem to compile with (perl -de mh.prl) ), so please test it and let me know.

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


# strict Perl syntax
use strict;


# Use timer.
$restartTimer = new Timer;


if($Startup)
{
        print_log "Starting connection to LMCE";
        set $restartTimer 10, sub {connect_lmce;};
}


if
(
        inactive_now($pluto_device_event_receiver) ||
        inactive_now($pluto_device_command_sender)
)
{
        print_log "Connection to LMCE terminated, restarting";
        set $restartTimer 10, sub {connect_lmce;};
}


# Should parenthesize &&/|| expressions to make precedence explicit
if(new_minute 1 && !active $pluto_device_event_receiver || new_minute 1 && !active $pluto_device_command_sender)
{
        print_log "Connection to LMCE still terminated, restarting";
        connect_lmce();
}


#my $motion=0;

if(my($msg) = said($pluto_device_event_receiver))
{ # Process message.
        print_log "Pluto Device Message received: $msg\n";

        # Remove quotes before splitting on whitespace.
        $msg =~ s/[\"\']//g;

        #############################################################
        # message Parameters as ordered fields
        #############################################################
        # $1    $2      $3      $4      $5      $6      $7      $8
        # from  to      msgtype msgid   p1id    p1val   p2id    p2val
        #############################################################
        # Example command from orbiter
        # 69    206     1       192     97      ""      98      ""
        # 69    206     1       193     97      ""
        # 69    205     1       184     76      "100"
        # Example command from admin site
        # 0     204     1       760     10      "C2"    154     "192"
        # 0     204     1       760     10      "C2"    154     "193"
        #############################################################

        # Decode message into required and optional fields as validation.
        my
        (
                $reqFieldsPat = '(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)\s+(\w+)';
                $optFieldsPat = '\s*(\w*)\s*(\w*)';
        );
        if
        (
                my
                (
                        # required fields
                        $deviceFrom, $deviceTo, $msgType, $msgId,
                        $param1Id, $param1Value,

                        # optional fields
                        $param2Id, $param2Value
                )
                = ($msg =~ /$reqFieldsPat$optFieldsPat/)
        )
        { # Process valid message.
                %msgTypes =
                {
                        '1' => 'Command',
                        '2' => 'Event'
                };
                $msgType .=
                        ': ' . defined($msgTypes{$msgType})?
                                        $msgTypes{$msgType} : 'unknown type';

                # Log required fields.
                print_log <<EOT;
DeviceFrom: $deviceFrom
DeviceTo: $deviceTo
MsgType: $msgType
MsgId: $msgId
param1id: $param1Id
param2value: $param1Val
EOT

                # Log optional fields.
                if(defined($param2Id))
                {
                        print_log "param2id: $$param2Id";
                        print_log 'param2value: ' .
                                (defined($param2Val))? $param2Val : 'undefined';
                }

                # Use X10 ID as target.
                my($target);
                my $x10_id;
                %dev2x10 =
                { # device ID to X10 ID
                        '162' => 'A5',
                        '186' => 'A3',
                        '187' => 'B1',
                        '188' => 'A8',
                        '189' => 'B3',
                        '190' => 'B4',
                        '191' => 'A10',
                        '192' => 'A9',
                        '218' => 'A6'
                }; # dev2x10

                $x10_id = $dev2x10{$deviceTo};
                if(defined($x10_id))
                {
                        $target = new X10_Item($x10_id);
                }

                # Probably can convert arbitrary msgID / setting rules
                #   to %msg2Setting if they're exclusive and regular.
                if($msgId eq '760' )
                { # new item in param1
                        $target = new X10_Item($param1Val);
                }


                # Execute message on target.
                if($msgId eq '192' || $param2Val eq '192')
                { # ON
                  print_log "Turn device $x10_id ON";
                  set $target ON;
                }
                if($msgId eq '193' || $param2Val eq '193')
                { # OFF
                  print_log "Turn device $x10_id OFF";
                  set $target OFF;
                }
                if($msgId eq '184')
                { # in param1
                  print_log "Setting device $x10_id to $param1Val%";
                  set $target "$param1Val%";
                }
        } # Process message.
}


my(%motionStates) =
{
        'MOTION' => '0',
        'STILL' => '1'
};
my(%motionLocation2DeviceId) =
{
        $Hall_Motion => '183',
        $Landing_Motion => '184',
        $Kitchen_Motion => '185'
};
my(@motionLocations) = keys(motionLocation2DeviceId);
foreach my($motionLocation) (@motionLocations)
{
        if($state = state_now($motionLocation)
        {
                lmce_motion($motionStates{$state}, $motionLocation);
        }
}


# subs ########################################################################

sub connect_lmce
{
        print_log "Configuring sockets";
        $pluto_device_event_receiver =
                new  Socket_Item(undef, undef, '192.168.1.1:3450','device_event_receiver','tcp','record');
        $pluto_device_command_sender =
                new  Socket_Item(undef, undef, '192.168.1.1:3450','device_command_sender','tcp','record');


        print_log "Closing sockets if any left open";
        if(active_now($pluto_device_event_receiver))
        {
                stop($pluto_device_event_receiver);
        }
        if(active_now($pluto_device_command_sender))
        {
                stop($pluto_device_command_sender);
        }


        print_log "Open and setup new sockets";
        start($pluto_device_event_receiver);
        set $pluto_device_event_receiver "COMMAND 179";

        start($pluto_device_command_sender);
        set $pluto_device_command_sender "EVENT 179";
        set $pluto_device_command_sender "PLAIN_TEXT";
}


sub send_pluto_message
{
        my($message) = @_;


        set $pluto_device_command_sender "MESSAGET " . length($message);
        set $pluto_device_command_sender $message;
}


sub update_temp
{
        my($sensor, $temp) = @_;


        # Example message@
        # 167=temp sensor ID, 2=event, 25=event ID (temp changed), 30=value, temperature (string)
        # my($message) = "167 -1000 2 25 30 $random_number.2";


        # Map iButtons to lmce device numbers.
        my(%sensorId2LMCEDeviceId) =
        {
                0 => 166,
                1 => 167
        }
        my($lmce_device) = $sensorId2LMCEDeviceId{$sensor};

        my($message) = "$lmce_device -1000 2 25 30 $temp.2";
        send_pluto_message($message);
        print_log "Updating sensor $lmce_device $temp";
}


sub lmce_motion
{
        my($motionState, $device_id) = @_;


        # 6780=Detector ID, 2=event, 9=event ID (tripped), 25=tripped value, 1=value (tripped 0=OFF || 1=ON)
        my($message) = "$device_id -1000 2 9 25 $motionState";
        send_pluto_message($message);
}

By the way, I've now seen an even shorter message from the DCERouter to switch a light off:

69    218     1       193

This means we now have 3 ways the DCERouter may ask us to switch off a light:

69 218 1 193
69 218 1 193 97 ""
0 204 1 760 10 "C2" 154 "193"

God knows why!

Changes to code:

Code: [Select]
        if ($msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/ or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)\s(\w*)/
                        or $msg =~/(\w*)\s(\w*)\s(\w*)\s(\w*)/ ) {
                print_log "DeviceFrom: $1";
                print_log "DeviceTo: $2";
                print_log "MsgType: $3 (1=Command, 2=Event)";
                print_log "MsgId: $4";
                if (defined $5) { print_log "param1id: $5";}
                if (defined $6) { print_log "param2value: $6";}
                if (defined $7) { print_log "param2id: $7";}
                if (defined $8) { print_log "param2value: $8";}

                #############################################################
                # $1    $2      $3      $4      $5      $6      $7      $8
                # from  to      msgtype msgid   p1id    p1val   p2id    p2val
                # Example command from orbiter
                # 69    206     1       192     97      ""      98      ""
                # 69    206     1       193     97      ""
                # 69    205     1       184     76      "100"
                # 69    218     1       193
                # Example command from admin site
                # 0     204     1       760     10      "C2"    154     "192"
                # 0     204     1       760     10      "C2"    154     "193"
                #############################################################

I'd like to just make sure my cleaned up Perl code is working correctly before adding anything to it. The main reason to clean it up is to make it more maintainable for improvements like that one you just reported. When it's tested OK, you can upgrade it, or I'll try to get to it.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #37 on: December 15, 2007, 11:18:39 pm »
I'll test this later when I get home. I've spotted another possible LMCE bug.

I have a device 218 which is configured as a Light switch on/off device. When controlled from the floorplan the device works correctly:

12/15/07 09:48:13 PM Pluto Device Message received: 69 218 1 192 97 "" 98 ""
...
12/15/07 09:48:13 PM Turn device A6 ON


You can see that it is being sent an ON command. However when triggered as part of a scenario where it is set to "on" LMCE tries to set it's brightness to 100%, which of course fails as dim levels are unsupported on this on/off module. Why is LMCE trying to do this? See below:

12/15/07 09:47:02 PM Pluto Device Message received: 69 162 1 184 76 "100"
...
12/15/07 09:47:02 PM Setting device A5 to 100%
CM11 error, invalid cm11 x10 code: +0



I also have a problem trying to figure out how to get MH to report lamp status back to LMCE if they are changed by MH. I'm guessing we need to fire an event but can't seem to find a suitable one in the list on the admin website.

You're right, we should move this to the dev forum. Once I test this code we can start a new post there with the work so far.

Thanks,

Chris


ddamron

  • Alumni
  • wants to work for LinuxMCE
  • *
  • Posts: 962
    • View Profile
    • My LinuxMCE User Page
Re: LinuxMCE and Misterhouse
« Reply #38 on: December 16, 2007, 01:55:19 am »
Chris,

Insteon is backwards compatible with X10.
Insteon controllers can send and receive X10
Insteon devices can be programmed to respond to X10 commands
Insteon devices can be programmed to TRANSMIT X10 (eg. a switch can transmit an X10 command)
Insteon devices do NOT repeat X10 commands

HTH

Dan
The only intuitive interface is the nipple.  After that it's all learned.
My other computer is your windows box.
I'm out of my mind.  Back in 5 minutes.
Q:  What's Red and smells like blue paint?

A:  Red Paint.

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #39 on: December 26, 2007, 06:15:17 pm »
I wish we had insteon in Europe!

Have tested the code. Got this error:

Error in user code file /opt/misterhouse/data/mh_temp.user_code

  12/26/07 04:46:52 PM: Global symbol "%motionLocation2DeviceId" requires explicit package name at (eval 538) line 291.
BEGIN not safe after errors--compilation aborted at (eval 538) line 1134.
Line 286:  {
Line 287:          $Hall_Motion => '183',
Line 288:          $Landing_Motion => '184',
Line 289:          $Kitchen_Motion => '185'
Line 290:  };
Line 291:  my(@motionLocations) = keys(motionLocation2DeviceId);
Line 292:  my $light_states = 'on,brighten,dim,off';
Line 293:  my $state;
Line 294:  $timer_kitchen_movement = new Timer();
Line 295:  my $Kitchen_Motion_state;
Line 296:  my $Kitchen_Motion_state_now;


It might be an idea to install MH. It's all contained within a folder - no real install as such apart from the init script, so it's very quick to get running and non-invasive.

btw did you incorporate my last set of changes into the code?

Merry Christmas by the way!

Cheers,

Chris

Matthew

  • Douchebag
  • Addicted
  • *
  • Posts: 567
    • View Profile
Re: LinuxMCE and Misterhouse
« Reply #40 on: December 26, 2007, 08:54:58 pm »
It occurs to me that we're collaborating on development not only outside SVN, but in a Users forum thread. Will you reply to this post just once more, and I'll reply to that with a link to continuing this thread to a new one in the Developers forum? Thanks (and sorry).

You're right, we should move this to the dev forum. Once I test this code we can start a new post there with the work so far.

I have continued this thread as a new topic "LMCE/MisterHouse Perl Glue" in the Developers forum. Please direct all discussion of this code to that topic.


I'd like to just make sure my cleaned up Perl code is working correctly before adding anything to it. The main reason to clean it up is to make it more maintainable for improvements like that one you just reported. When it's tested OK, you can upgrade it, or I'll try to get to it.