2
0
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:
tpoitzsch 2015-01-10 18:25:23 +00:00
parent 2b8bb3881a
commit d0cfe4cbba

View File

@ -872,7 +872,10 @@ sub FRITZBOX_Readout_Aborted($)
{ {
my ($hash) = @_; my ($hash) = @_;
delete($hash->{helper}{READOUT_RUNNING_PID}); 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,7 +1794,10 @@ sub FRITZBOX_Open_Connection($)
$telnet = undef; $telnet = undef;
return $msg; return $msg;
} }
$telnet->prompt('/<xFHEMx> $/');
$telnet->cmd("PS1='<xFHEMx> '");
$telnet->buffer_empty;
return undef; return undef;
} # end FRITZBOX_Open_Connection } # end FRITZBOX_Open_Connection
@ -1872,15 +1878,13 @@ FRITZBOX_Exec_Remote($$)
foreach (@{$cmd}) foreach (@{$cmd})
{ {
FRITZBOX_Log $hash, 5, "Execute '".$_."'"; FRITZBOX_Log $hash, 5, "Execute '$_'";
unless ($_ =~ /^sleep/) unless ($_ =~ /^sleep/)
{ {
@output=$telnet->cmd($_.";echo ' |#|'"); @output=$telnet->cmd($_);
$result = $output[0]; $result = $output[0] || "";
chomp $result; chomp $result;
$result = "" if $result eq " |#|"; my $log = join "", @output;
my $log = join " ", @output;
$log =~ s/\s*\|#\|\n//;
chomp $log; chomp $log;
FRITZBOX_Log $hash, 5, "Result '$log'"; FRITZBOX_Log $hash, 5, "Result '$log'";
} }