mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
24_TPLinkHS110: Added eval around decode_json
git-svn-id: https://svn.fhem.de/fhem/trunk@13514 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
83a85a9903
commit
44be045253
@ -105,7 +105,13 @@ sub TPLinkHS110_Get($$)
|
|||||||
$socket->close();
|
$socket->close();
|
||||||
unless( defined $retval) { return undef; }
|
unless( defined $retval) { return undef; }
|
||||||
$data = decrypt(substr($data,4));
|
$data = decrypt(substr($data,4));
|
||||||
my $json = decode_json($data);
|
my $json;
|
||||||
|
eval {
|
||||||
|
$json = decode_json($data);
|
||||||
|
} or do {
|
||||||
|
Log3 $hash, 2, "TPLinkHS110: $name json-decoding failed. Problem decoding getting statistical data";
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
Log3 $hash, 3, "TPLinkHS110: $name Get called. Relay state: $json->{'system'}->{'get_sysinfo'}->{'relay_state'}, RSSI: $json->{'system'}->{'get_sysinfo'}->{'rssi'}";
|
Log3 $hash, 3, "TPLinkHS110: $name Get called. Relay state: $json->{'system'}->{'get_sysinfo'}->{'relay_state'}, RSSI: $json->{'system'}->{'get_sysinfo'}->{'rssi'}";
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
@ -220,7 +226,14 @@ sub TPLinkHS110_Set($$)
|
|||||||
$socket->close();
|
$socket->close();
|
||||||
unless( defined $retval) { return undef; }
|
unless( defined $retval) { return undef; }
|
||||||
$data = decrypt(substr($data,4));
|
$data = decrypt(substr($data,4));
|
||||||
my $json = decode_json($data);
|
my $json;
|
||||||
|
eval {
|
||||||
|
$json = decode_json($data);
|
||||||
|
} or do {
|
||||||
|
Log3 $hash, 2, "TPLinkHS110: $name json-decoding failed. Problem decoding getting statistical data";
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
if ($json->{'system'}->{'set_relay_state'}->{'err_code'} eq "0") {
|
if ($json->{'system'}->{'set_relay_state'}->{'err_code'} eq "0") {
|
||||||
TPLinkHS110_Get($hash,"");
|
TPLinkHS110_Get($hash,"");
|
||||||
|
|
||||||
@ -302,9 +315,14 @@ sub TPLinkHS110_Attr {
|
|||||||
$socket->close();
|
$socket->close();
|
||||||
unless( defined $retval) { return undef; }
|
unless( defined $retval) { return undef; }
|
||||||
$data = decrypt(substr($data,4));
|
$data = decrypt(substr($data,4));
|
||||||
my $json = decode_json($data);
|
my $json;
|
||||||
|
eval {
|
||||||
|
$json = decode_json($data);
|
||||||
|
} or do {
|
||||||
|
Log3 $hash, 2, "TPLinkHS110: $name json-decoding failed. Problem decoding getting statistical data";
|
||||||
|
return;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user