From e92f9383a347d3b38c6bcfbec73e081ccada15cd Mon Sep 17 00:00:00 2001 From: Risiko <> Date: Wed, 30 Oct 2019 17:38:29 +0000 Subject: [PATCH] 98_weekprofile: add reading topics - a list of topic names git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@20427 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 1 + FHEM/98_weekprofile.pm | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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($$)