FB_CALLLIST: use readingsDelete() to delete readings

git-svn-id: https://svn.fhem.de/fhem/trunk@15965 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch
2018-01-23 09:05:40 +00:00
parent e39d67287a
commit 53a431f56a

View File

@@ -232,16 +232,16 @@ sub FB_CALLLIST_Set($@)
if(AttrVal($name, "create-readings", "0") eq "1")
{
readingsBeginUpdate($hash);
readingsBulkUpdate($hash, "numberOfCalls", 0, 1);
for my $reading (keys %{$hash->{READINGS}})
for my $reading (grep { /^\d+-/ } keys %{$hash->{READINGS}})
{
readingsBulkUpdate($hash, $reading, "");
readingsDelete($hash, $reading);
}
readingsEndUpdate($hash, 1);
CommandDeleteReading($hash->{CL}, $name.' \d+-.*');
}
# Inform all FHEMWEB clients
@@ -989,13 +989,11 @@ sub FB_CALLLIST_createReadings($)
for my $reading (grep { /^(\d+)-/ and ($1 > @item_list) } keys %{$hash->{READINGS}})
{
readingsBulkUpdate($hash, $reading, "");
push @delete_readings, $reading;
readingsDelete($hash, $_) ;
}
readingsEndUpdate($hash, 1);
map { CommandDeleteReading(undef, "$name $_") } @delete_readings;
return undef;
}