From a96d03d4e388c6f7e3bec76d18df58a457583575 Mon Sep 17 00:00:00 2001 From: tpoitzsch Date: Thu, 18 Dec 2014 06:24:55 +0000 Subject: [PATCH] statistics: new attribute "ignoreDefaultAssignments" git-svn-id: https://svn.fhem.de/fhem/trunk@7251 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_statistics.pm | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/98_statistics.pm b/fhem/FHEM/98_statistics.pm index 1847400b9..ca6c3c0b7 100644 --- a/fhem/FHEM/98_statistics.pm +++ b/fhem/FHEM/98_statistics.pm @@ -130,6 +130,7 @@ statistics_Initialize($) ."deltaReadings " ."durationReadings " ."excludedReadings " + ."ignoreDefaultAssignments:0,1 " ."minAvgMaxReadings " ."periodChangePreset " ."specialDeltaPeriodHours " @@ -380,9 +381,11 @@ sub statistics_DoStatistics($$$) my $devName = $dev->{NAME}; my $devType = $dev->{TYPE}; my $statisticDone = 0; + my %statReadings = (); return if( AttrVal($hashName, "disable", 0 ) == 1 ); + my $ignoreDefAssign = AttrVal($hashName, "ignoreDefaultAssignments", 0); my $exclReadings = AttrVal($hashName, "excludedReadings", ""); my $regExp = '^'.$devName.'$|^'.$devName.',|,'.$devName.'$|,'.$devName.','; @@ -405,7 +408,8 @@ sub statistics_DoStatistics($$$) } # Build up Statistic-Reading-Hash, add readings defined in attributes to Statistic-Reading-Hash - my %statReadings = %knownReadings; + %statReadings = %knownReadings + unless $ignoreDefAssign == 1; while (my ($aName, $statType) = each (%addedReadingsAttr) ) { my @addedReadings = split /,/, AttrVal($hashName, $aName, ""); @@ -435,7 +439,7 @@ sub statistics_DoStatistics($$$) } # If no statistic-reading has been found, do a duration stat for the device-state - if ($statisticDone != 1) + if ($statisticDone != 1 && $ignoreDefAssign != 1) { if ( exists ($dev->{READINGS}{state}) && $dev->{READINGS}{state}{VAL} ne "defined" ) { statistics_doStatisticDuration $hash, $dev, "state", $periodSwitch; @@ -1108,6 +1112,14 @@ sub statistics_UpdateDevReading($$$$) The reading have to be entered in the form deviceName:readingName. E.g. FritzDect:current|Sensor_.*:humidity

+ +
  • ignoreDefaultAssignments <1 | 0> +
    + Ignores the default assignments of readings to a statistic type (see above).
    + So, only the readings that are listed in the specific attributes are evaluated. +
    +

  • +
  • minAvgMaxReadings <readings>
    Comma separated list of reading names for which a min/average/max statistic shall be calculated. @@ -1231,6 +1243,14 @@ sub statistics_UpdateDevReading($$$$) z.B. FritzDect:current|Sensor_.*:humidity

  • + +
  • ignoreDefaultAssignments <1 | 0> +
    + Ignoriert die oben beschriebene Standardzuordnung von Gerätewerten zu Statistiktypen..
    + D.h., nur die Gerätewerte, die über Attribute den Statistiktypen zugeordnet sind, werden ausgewertet. +
    +

  • +
  • hideAllSummaryReadings <0 | 1>
    noch nicht implementiert - Es werden keine gesammelten Statistiken angezeigt, sondern nur die unter "singularReadings" definierten Einzelwerte