2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +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") if(AttrVal($name, "create-readings", "0") eq "1")
{ {
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate($hash, "numberOfCalls", 0, 1); readingsBulkUpdate($hash, "numberOfCalls", 0, 1);
for my $reading (keys %{$hash->{READINGS}}) for my $reading (grep { /^\d+-/ } keys %{$hash->{READINGS}})
{ {
readingsBulkUpdate($hash, $reading, ""); readingsBulkUpdate($hash, $reading, "");
readingsDelete($hash, $reading);
} }
readingsEndUpdate($hash, 1); readingsEndUpdate($hash, 1);
CommandDeleteReading($hash->{CL}, $name.' \d+-.*');
} }
# Inform all FHEMWEB clients # Inform all FHEMWEB clients
@ -989,13 +989,11 @@ sub FB_CALLLIST_createReadings($)
for my $reading (grep { /^(\d+)-/ and ($1 > @item_list) } keys %{$hash->{READINGS}}) for my $reading (grep { /^(\d+)-/ and ($1 > @item_list) } keys %{$hash->{READINGS}})
{ {
readingsBulkUpdate($hash, $reading, ""); readingsBulkUpdate($hash, $reading, "");
push @delete_readings, $reading; readingsDelete($hash, $_) ;
} }
readingsEndUpdate($hash, 1); readingsEndUpdate($hash, 1);
map { CommandDeleteReading(undef, "$name $_") } @delete_readings;
return undef; return undef;
} }