From 9e7840d6b80783e69fe43a96ef0e7c5094977188 Mon Sep 17 00:00:00 2001 From: jamesgo <> Date: Wed, 16 Sep 2015 06:19:01 +0000 Subject: [PATCH] 98_GAEBUS.pm: perl warnings entfernt wenn wert von Attribut leer ist git-svn-id: https://svn.fhem.de/fhem/trunk@9260 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/98_GAEBUS.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/fhem/contrib/98_GAEBUS.pm b/fhem/contrib/98_GAEBUS.pm index 4b373d16e..3452d4ac7 100644 --- a/fhem/contrib/98_GAEBUS.pm +++ b/fhem/contrib/98_GAEBUS.pm @@ -13,6 +13,7 @@ # 13.09.2015 : A.Goebel : increase timeout for reads from ebusd from 1.8 to 5.0 # 14.09.2015 : A.Goebel : use utf-8 coding to display values from ".csv" files # 14.09.2015 : A.Goebel : add optional parameter [FIELD[.N]] of read from ebusd to reading name +# 15.09.2015 : A.Goebel : get rid of perl warnings when attribute value is empty package main; @@ -325,9 +326,12 @@ GAEBUS_Get($@) my ($readingnameX, $cmdaddon) = split (" ", $attr{$name}{$oneattr}, 2); $cmdaddon = "" unless (defined ($cmdaddon)); + next unless defined ($readingnameX); + next if ($readingnameX =~ /^\s*$/); + next if ($readingnameX eq "1"); + my ($readingname, $doCntNo) = split (":", $readingnameX, 2); # split name from cycle number $doCntNo = 1 unless (defined ($doCntNo)); -Log3 ($name, 2, "$name <$readingnameX>"); #my $readingname = $attr{$name}{$oneattr}; my $readingcmdname = $oneattr; @@ -337,13 +341,10 @@ Log3 ($name, 2, "$name <$readingnameX>"); # only for "r" commands if ($oneattr =~ /^r.*$delimiter.*$delimiter.*$delimiter.*$/) { - unless ($readingname =~ /^\s*$/ or $readingname eq "1") - { - $readings{$readingname} = $readingcmdname; - $readingsCmdaddon{$readingname} = $cmdaddon; + $readings{$readingname} = $readingcmdname; + $readingsCmdaddon{$readingname} = $cmdaddon; - #Log3 ($name, 2, "$name GetParams $readingname"); - } + #Log3 ($name, 2, "$name GetParams $readingname"); } #Log3 ($name, 4, "$name Get attr name $readingname"); @@ -869,14 +870,15 @@ GAEBUS_GetUpdates($) my ($readingnameX, $cmdaddon) = split (" ", $attr{$name}{$oneattr}, 2); $cmdaddon = "" unless (defined ($cmdaddon)); + next unless defined ($readingnameX); + next if ($readingnameX =~ /^\s*$/); + next if ($readingnameX eq "1"); + my ($readingname, $doCntNo) = split (":", $readingnameX, 2); # split name from cycle number $doCntNo = 1 unless (defined ($doCntNo)); Log3 ($name, 5, "$name GetUpdates: $readingname:$doCntNo"); - next if ($readingname =~ /^\s*$/); - next if ($readingname eq "1"); - #Log3 ($name, 2, "$name check modulo ".$hash->{UpdateCnt}." mod $doCntNo -> ".($hash->{UpdateCnt} % $doCntNo)); if (($hash->{UpdateCnt} % $doCntNo) == 0) {