24_TPLinkHS110.pm: Fixed bug getting realtime data

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@17468 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vk 2018-10-06 16:32:28 +00:00
parent 361a289e3e
commit e83e4d351f

View File

@ -155,7 +155,6 @@ sub TPLinkHS110_Get($$)
Timeout => $hash->{TIMEOUT} )
or return "Couldn't connect to $remote_host:$remote_port: $@\n";
$socket->write($rc);
$socket->write($c);
IO::Socket::Timeout->enable_timeouts_on($socket);
$socket->read_timeout(.5);
my $rdata;
@ -172,7 +171,7 @@ sub TPLinkHS110_Get($$)
readingsEndUpdate($hash, 1);
return;
} else {
Log3 $hash, 1, "TPLinkHS110: $name Realtime data updated";
Log3 $hash, 2, "TPLinkHS110: $name Realtime data updated";
}
my %emeterReadings = ();
@ -239,7 +238,7 @@ sub TPLinkHS110_Get($$)
$count = @{$json->{'emeter'}->{'get_daystat'}->{'day_list'}};
readingsBulkUpdate($hash, "monthly_total", $total);
if ($count) { readingsBulkUpdate($hash, "daily_average", $total/$count)};
Log3 $hash, 1, "TPLinkHS110: $name Daystat updated";
Log3 $hash, 2, "TPLinkHS110: $name Daystat updated";
} else {
Log3 $hash, 1, "TPLinkHS110: $name Error updating daystat. Success: " . $success . ", json: " . $json;
Log3 $hash, 3, "TPLinkHS110: $name Updating readings";