voice command causes an MH restart - how to identify cause?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

voice command causes an MH restart - how to identify cause?

Jon Whitear
Hi guys,

I have the code below. When I run the voice command “cbus monitor stop” from a telnet session, MisterHouse restarts. I would be grateful for any pointers on identifying the cause of the restart.

Cheers,

Jon

The monitor_check() method belongs to a Clipsal_CBus::CGate object. The new() method of that object includes this:-

    # Add hooks to the main loop to check the monitor and talker sockets for data on each pass.
    &::MainLoop_pre_add_hook( sub { $self->monitor_check(); }, 'persistent' );

The voice command $::CBus_Monitor_v, is declared like so:

    package main;

    

    <SNIP>


    use vars '$CBus_Monitor_v';
    $CBus_Monitor_v = new Voice_Cmd("cbus monitor [Start,Stop,Status]");
    &main::register_object_by_name('$CBus_Monitor_v',$CBus_Monitor_v);
    $CBus_Monitor_v->{category} = "Clipsal CBus";
    $CBus_Monitor_v->{filename} = "Clipsal_CBus_commands";
    $CBus_Monitor_v->{object_name} = '$CBus_Monitor_v';

    

    package Clipsal_CBus;

Here’s the code:-

sub monitor_stop {
    my ($self) = @_;

    

    # Stop the CBus listener (monitor)

    

    if (not $Clipsal_CBus::Monitor->active() ) {
        $self->debug("Monitor isn't active, skipping stop", $notice);
    }
    else {
        #$$self{monitor_retry} = 0;
        if ( $Clipsal_CBus::Monitor->stop() ) {
            $self->debug("Monitor stopped", $notice);
        }
        else {
            $self->debug("Monitor failed to stop", $warn);
        }
    }
}

sub monitor_check {
    my ($self) = @_;

    

    # Monitor Voice Command / Menu processing
    if ( my $data = $::CBus_Monitor_v->said() ) {
        if ( $data eq 'Start' ) {
            $self->monitor_start();

            

        }
        elsif ( $data eq 'Stop' ) {
            $self->monitor_stop();

            

        }
        elsif ( $data eq 'Status' ) {
            $self->monitor_status();

        }
        else {
            $self->debug("Monitor: command $data is not implemented", $warn);
        }
    }

  <SNIP>
}

And here’s what I see in print.log:—

03/31/16 10:32:45 AM Telnet: connection from [hidden email] (IO::Socket::INET=GLOB(0x2545f90))
03/31/16 10:32:54 AM Telnet: port data (IO::Socket::INET=GLOB(0x2545f90)): cbus monitor stop
03/31/16 10:32:54 AM Running: cbus monitor Stop
03/31/16 10:32:54 AM Ran telnet command: cbus monitor stop
03/31/16 10:33:16 AM ---------- Restart ————— 




------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users