From f686d3f810b741e81aa98622e126a8210f023566 Mon Sep 17 00:00:00 2001 From: pahenning Date: Fri, 5 Apr 2013 10:35:02 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@3035 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/21_OWCOUNT.pm | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/21_OWCOUNT.pm b/fhem/FHEM/21_OWCOUNT.pm index 4247b2063..f08dfc3aa 100644 --- a/fhem/FHEM/21_OWCOUNT.pm +++ b/fhem/FHEM/21_OWCOUNT.pm @@ -37,6 +37,7 @@ # Additional attributes are defined in fhem.cfg, in some cases per channel, where =A,B # # attr LogM = device name (not file name) of monthly log file +# attr LogY = device name (not file name) of yearly log file # attr Name | = name for the channel | a type description for the measured value # attr Unit | = unit of measurement for this channel | its abbreviation # attr Rate | = name for the channel ratw | a type description for the measured value @@ -136,7 +137,7 @@ sub OWCOUNT_Initialize ($) { $hash->{SetFn} = "OWCOUNT_Set"; #-- see header for attributes - my $attlist = "IODev do_not_notify:0,1 showtime:0,1 model:DS2423 loglevel:0,1,2,3,4,5 LogM ". + my $attlist = "IODev do_not_notify:0,1 showtime:0,1 model:DS2423 loglevel:0,1,2,3,4,5 LogM LogY ". $readingFnAttributes; for( my $i=0;$i[1]; - my $total1 = @monthv[1]->[1]; + #-- error check + if( int(@monthv) == 2 ){ + $total0 = @monthv[0]->[1]; + $total1 = @monthv[1]->[1]; + }else{ + Log 1,"OWCOUNT: no monthly summary possible, ".@monthv[0]; + $total0 = ""; + $total1 = ""; + }; + #-- todo: put current monthly value also in day-end logging $dvalue = sprintf("D%02d ",$day).$dvalue; readingsBulkUpdate($hash,"day",$dvalue); if( $monthbreak == 1){ @@ -586,8 +595,8 @@ sub OWCOUNT_Get($@) { $value="$name.month =>\n"; my @month2 = OWCOUNT_GetMonth($hash); #-- error case - if( int(@month2) == 1 ){ - return $month2[0]; + if( int(@month2) != 2 ){ + return $value." no monthly summary possible, ".$month2[0]; } #-- 3 entries for each day for(my $i=0;$iattr <name> LogM <string>|
device name (not file name) of monthly log file. +
  • attr <name> LogY + <string>| +
    device name (not file name) of yearly log file.
  • For each of the following attributes, the channel identification A,B may be used.