mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
FRITZBOX: now with specific telnet prompt
git-svn-id: https://svn.fhem.de/fhem/trunk@7500 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2b8bb3881a
commit
d0cfe4cbba
@ -872,7 +872,10 @@ sub FRITZBOX_Readout_Aborted($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
delete($hash->{helper}{READOUT_RUNNING_PID});
|
||||
FRITZBOX_Log $hash, 1, "Timeout when reading Fritz!Box data.";
|
||||
my $msg = "Error: Timeout when reading Fritz!Box data.";
|
||||
readingsSingleUpdate($hash, "lastReadout", $msg, 1);
|
||||
readingsSingleUpdate($hash, "state", $msg, 1);
|
||||
FRITZBOX_Log $hash, 1, $msg;
|
||||
}
|
||||
|
||||
##########################################
|
||||
@ -1791,6 +1794,9 @@ sub FRITZBOX_Open_Connection($)
|
||||
$telnet = undef;
|
||||
return $msg;
|
||||
}
|
||||
$telnet->prompt('/<xFHEMx> $/');
|
||||
$telnet->cmd("PS1='<xFHEMx> '");
|
||||
$telnet->buffer_empty;
|
||||
|
||||
return undef;
|
||||
} # end FRITZBOX_Open_Connection
|
||||
@ -1872,15 +1878,13 @@ FRITZBOX_Exec_Remote($$)
|
||||
|
||||
foreach (@{$cmd})
|
||||
{
|
||||
FRITZBOX_Log $hash, 5, "Execute '".$_."'";
|
||||
FRITZBOX_Log $hash, 5, "Execute '$_'";
|
||||
unless ($_ =~ /^sleep/)
|
||||
{
|
||||
@output=$telnet->cmd($_.";echo ' |#|'");
|
||||
$result = $output[0];
|
||||
@output=$telnet->cmd($_);
|
||||
$result = $output[0] || "";
|
||||
chomp $result;
|
||||
$result = "" if $result eq " |#|";
|
||||
my $log = join " ", @output;
|
||||
$log =~ s/\s*\|#\|\n//;
|
||||
my $log = join "", @output;
|
||||
chomp $log;
|
||||
FRITZBOX_Log $hash, 5, "Result '$log'";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user