mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
39_alexa.pm: better parsing of alexa-fhem output
git-svn-id: https://svn.fhem.de/fhem/trunk@18863 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f35520e083
commit
04dbe9f793
@ -238,7 +238,7 @@ alexa_detailFn($$$$)
|
||||
my $ret;
|
||||
|
||||
my $logfile = AttrVal($name, 'alexaFHEM-log', 'FHEM' );
|
||||
if( $logfile ne 'FHEM' ) {
|
||||
if( $logfile && $logfile ne 'FHEM' ) {
|
||||
my $name = 'alexaFHEMlog';
|
||||
$ret .= "<a href=\"$FW_ME?detail=$name\">". AttrVal($name, "alias", "Logfile") ."</a><br>";
|
||||
}
|
||||
@ -255,21 +255,32 @@ alexa_Read($)
|
||||
my $buf = CoProcess::readFn($hash);
|
||||
return undef if( !$buf );
|
||||
|
||||
if( $buf =~ m/^\*\*\* ([^\s]+) (.+)/ ) {
|
||||
my $service = $1;
|
||||
my $message = $2;
|
||||
my $data = $hash->{helper}{PARTIAL};
|
||||
$data .= $buf;
|
||||
|
||||
if( $service eq 'FHEM:' ) {
|
||||
if( $message =~ m/^connection failed(: (.*))?/ ) {
|
||||
my $reason = $2;
|
||||
while($data =~ m/\n/) {
|
||||
($buf,$data) = split("\n", $data, 2);
|
||||
|
||||
$hash->{reason} = 'failed to connect to fhem';
|
||||
$hash->{reason} .= ": $reason" if( $reason );
|
||||
CoProcess::stop($hash);
|
||||
Log3 $name, 5, "$name: read: $buf";
|
||||
|
||||
if( $buf =~ m/^\*\*\* ([^\s]+) (.+)/ ) {
|
||||
my $service = $1;
|
||||
my $message = $2;
|
||||
|
||||
if( $service eq 'FHEM:' ) {
|
||||
if( $message =~ m/^connection failed(: (.*))?/ ) {
|
||||
my $reason = $2;
|
||||
|
||||
$hash->{reason} = 'failed to connect to fhem';
|
||||
$hash->{reason} .= ": $reason" if( $reason );
|
||||
CoProcess::stop($hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$hash->{PARTIAL} = $data;
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user