diff --git a/CHANGED b/CHANGED index ce63fe53c..4058b48c4 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 98_weekprofile: add reading topics - a list of topic names - change: 57_Calendar: new attribute, cutoffLaterThan; events without DURATION and DTEND last 1 day; several fixes (see https://forum.fhem.de/index.php/topic,104587.msg985270.html); diff --git a/FHEM/98_weekprofile.pm b/FHEM/98_weekprofile.pm index 5d13c3250..2e115b5aa 100644 --- a/FHEM/98_weekprofile.pm +++ b/FHEM/98_weekprofile.pm @@ -595,12 +595,23 @@ sub weekprofile_updateReadings($) #$idx++; #} + my $topic_list=""; splice(@{$hash->{TOPICS}}); foreach my $prf (@{$hash->{PROFILES}}) { if ( !grep( /^$prf->{TOPIC}$/, @{$hash->{TOPICS}}) ) { - push @{$hash->{TOPICS}}, $prf->{TOPIC}; + push @{$hash->{TOPICS}}, $prf->{TOPIC}; + if (length($topic_list) > 0){ + $topic_list = $topic_list . ':' . $prf->{TOPIC}; + } else { + $topic_list = $prf->{TOPIC}; + } } } + + my $useTopics = AttrVal($hash->{NAME},"useTopics",0); + if ($useTopics) { + readingsBulkUpdate($hash,"topics",$topic_list); + } readingsEndUpdate($hash, 1); } ############################################## @@ -1558,6 +1569,9 @@ sub weekprofile_getEditLNK_MasterDev($$)