Compare commits

2 Commits

Author SHA1 Message Date
8f5f50385b -fix: error handling
-fix: error handling malformed JSON
2019-07-16 07:21:05 +02:00
430adca511 -fix: error handling
-fix: error handling malformed JSON
2019-07-09 07:46:13 +02:00

View File

@@ -48,7 +48,7 @@ use SetExtensions;
sub XiaomiSmartHome_updateSingleReading($$);
my $iv="\x17\x99\x6d\x09\x3d\x28\xdd\xb3\xba\x69\x5a\x2e\x6f\x58\x56\x2e";
my $version = "1.41";
my $version = "1.43";
my %XiaomiSmartHome_gets = (
"getDevices" => ["get_id_list", '^.+get_id_list_ack' ],
@@ -132,16 +132,16 @@ sub XiaomiSmartHome_Read($) {
InternalTimer(gettimeofday() + 2, "XiaomiSmartHome_connect", $hash, 0);
return;
}
my $json = $hash->{helper}{JSON}->incr_parse($buf);
my $decoded = eval{decode_json($buf)};
if ($@) {
Log3 $name, 1, "$name: Read> Error while request: $@";
Log3 $name, 1, "$name: Read> Error while request: $@ " . $buf;
return;
}
if ( ! $decoded ) {
Log3 $name, 5, "$name: Read> Error no JSON Data " . $buf;
return;
}
my $json = $hash->{helper}{JSON}->incr_parse($buf);
if ($json)
{
Log3 $name, 5, "$name: Read> [PLAIN] " . $buf;