From f9563aa289f89cccc7cc14da5701adb2244a8e8b Mon Sep 17 00:00:00 2001 From: grompo Date: Tue, 22 Mar 2016 18:25:27 +0000 Subject: [PATCH] PROPLANTA: "given" replaced git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@11113 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/59_PROPLANTA.pm | 45 +++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/fhem/FHEM/59_PROPLANTA.pm b/fhem/FHEM/59_PROPLANTA.pm index e170575fe..1ff6f9c05 100644 --- a/fhem/FHEM/59_PROPLANTA.pm +++ b/fhem/FHEM/59_PROPLANTA.pm @@ -3,7 +3,8 @@ # # 59_PROPLANTA.pm # -# (c) 2014 Torsten Poitzsch < torsten . poitzsch at gmx . de > +# (c) 2014 Torsten Poitzsch +# (c) 2014-2016 tupol http://forum.fhem.de/index.php?action=profile;u=5432 # # Weather forecast values for 12 days are captured from www.proplanta.de # inspired by 23_KOSTALPIKO.pm @@ -487,31 +488,23 @@ sub PROPLANTA_Undef($$) ##################################### sub PROPLANTA_Set($@) { - my ( $hash, @a ) = @_; - my $name = $hash->{NAME}; - my $reUINT = '^([\\+]?\\d+)$'; - my $usage = "Unknown argument $a[1], choose one of update:noArg "; + my ($hash, $name, $cmd, @val) = @_; + # my $reUINT = '^([\\+]?\\d+)$'; + my $usage = "Unknown argument $cmd, choose one of update:noArg "; - return $usage if ( @a < 2 ); + return $usage unless defined $cmd; - my $cmd = lc( $a[1] ); - given ($cmd) - { - when ("?") - { - return $usage; - } - when ("update") - { - PROPLANTA_Log $hash, 3, "set command: " . $a[1]; - $hash->{fhem}{LOCAL} = 1; - PROPLANTA_Start($hash); - $hash->{fhem}{LOCAL} = 0; - } - default - { - return $usage; - } + if ( $cmd eq "?" ) { + return $usage; + } + elsif ( $cmd eq "update" ) { + Log3 $name, 3, "PROPLANTA: set $name $cmd ".join(" ", @val); + $hash->{fhem}{LOCAL} = 1; + PROPLANTA_Start($hash); + $hash->{fhem}{LOCAL} = 0; + } + else { + return $usage; } return; } @@ -797,7 +790,7 @@ PROPLANTA_Html($)

PROPLANTA

-
+
    The module extracts weather data from www.proplanta.de.
    @@ -903,7 +896,7 @@ PROPLANTA_Html($)

    PROPLANTA

    -
    +