From b05d0b70386eb6d604ee039158b942e2ba3bcb71 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 14 Dec 2013 09:11:03 +0000 Subject: [PATCH] structure: *_map attribute is now a regexp git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4379 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/98_structure.pm | 194 +++++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 88 deletions(-) diff --git a/FHEM/98_structure.pm b/FHEM/98_structure.pm index 8678f0138..9f6dac21e 100755 --- a/FHEM/98_structure.pm +++ b/FHEM/98_structure.pm @@ -191,19 +191,19 @@ sub structure_Notify($$) my @value; for (my $i=0; $i<@gruppe; $i++) { @value = split(":", $gruppe[$i]); - if(@value == 1) { # Reading + if(@value == 1) { # value[0]:.* -> .* $devstate = ReadingsVal($d, $value[0], undef); - } elsif(@value == 2) { # bsp: on:An + } elsif(@value == 2) { # state:value[0] -> value[1] $devstate = ReadingsVal($d, "state", undef); - if(defined($devstate) && $devstate eq $value[0]){ + if(defined($devstate) && $devstate =~ m/^$value[0]/){ $devstate = $value[1]; $i=99999; # RKO: ?? } - } elsif(@value == 3) { # Reading:OriginalStatus:NeuerStatus + } elsif(@value == 3) { # value[0]:value[1] -> value[2] $devstate = ReadingsVal($d, $value[0], undef); - if(defined($devstate) && $devstate eq $value[1]){ + if(defined($devstate) && $devstate =~ m/^$value[1]/){ $devstate = $value[2]; } } @@ -494,15 +494,24 @@ structure_Attr($@) In this example the status of kitchen is either on or off. The status of house is either Any_on or All_off. -
- To group more devices from different types of devices you can define - a clientstate redefining on each device with the attribute <struct_type>_map. - For example the reading "A" of device door is "open" or "closed" - and the state of device lamp1 should redefine from "on" to "An" and "off" to "Aus". - A special case is a device with more than 1 input port (eg. OWSWITCH). The last - example shows the attribute only with a value of "A". The propagated - value of the device depends only on port A with an unmodified state. -
Example:
+ +
  • <struct_type>_map
    + With this attribute, which has to specified for the structure- + member, you can redefine the value reported by a specific + structure-member for the structure value. The attribute has three + variants: + + Example: