From 884a5393f56b53cf2c8fada63e6d2e4fea5d02bd Mon Sep 17 00:00:00 2001 From: hotmaz <> Date: Sat, 11 Feb 2012 21:27:55 +0000 Subject: [PATCH] allow groupnr selection for set command git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1252 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/10_EIB.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/FHEM/10_EIB.pm b/FHEM/10_EIB.pm index cbbd68296..bf225a801 100644 --- a/FHEM/10_EIB.pm +++ b/FHEM/10_EIB.pm @@ -160,7 +160,7 @@ EIB_Set($@) my $ret = undef; my $na = int(@a); - return "no set value specified" if($na < 2 || $na > 3); + return "no set value specified" if($na < 2 || $na > 4); return "Readonly value $a[1]" if(defined($readonly{$a[1]})); return "No $a[1] for dummies" if(IsDummy($hash->{NAME})); @@ -169,18 +169,27 @@ EIB_Set($@) return "Unknown argument $a[1], choose one of " . join(" ", sort keys %eib_c2b); } + + # the command can be send to any of the defined groups indexed starting by 1 + my $groupnr = 1; + if($a[1] eq "value" && $na > 3){$groupnr=$a[3]} + elsif ($na>2){$groupnr=$a[2]} + return "groupnr argument $groupnr must be numeric." if( $groupnr !~ m/[0-9]*/i); + return "groupnr $groupnr not known." if(!$hash->{CODE}{$groupnr}); my $v = join(" ", @a); Log GetLogLevel($a[0],2), "EIB set $v"; (undef, $v) = split(" ", $v, 2); # Not interested in the name... - if($a[1] eq "value" && $na == 3) { + if($a[1] eq "value" && $na > 2) { # complex value command. # the additional argument is transfered alone. $c = $a[2]; } - IOWrite($hash, "B", "w" . $hash->{GROUP} . $c); + my $groupcode = $hash->{CODE}{$groupnr}; + + IOWrite($hash, "B", "w" . $groupcode . $c); ########################################### # Delete any timer for on-for_timer