2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 04:36:36 +00:00

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 b559132396
commit d8e7e74aac

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;
}