2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

33_readingsGroup.pm: allow devspec :FILTER= expressions in device selection

git-svn-id: https://svn.fhem.de/fhem/trunk@7478 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2015-01-09 11:56:01 +00:00
parent 5a880767cf
commit 0d75b6b4e3
2 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: readingsGroup: allow devspec :FILTER= expressions in device selection
- added: 73_km200.pm for the Buderus KM200 heating controller (Sailor)
- feature: 70_XBMC: added command 'connect' to connect instantly
- change: FB_CALLMONITOR: use standard file read/write function to support use of configDb

View File

@ -96,7 +96,19 @@ readingsGroup_updateDevices($;$)
} else {
my @device = split(":", $param);
if($device[0] =~ m/(.*)=(.*)/) {
if( $device[1] =~ m/^FILTER=/ ) {
my $devspec = shift(@device);
while( @device && $device[0] =~ m/^FILTER=/ ) {
$devspec .= ":";
$devspec .= shift(@device)
}
my $regex = $device[0];
foreach my $d (devspec2array($devspec)) {
$list{$d} = 1;
push @devices, [$d,$regex];
}
} elsif($device[0] =~ m/(.*)=(.*)/) {
my ($lattr,$re) = ($1, $2);
foreach my $d (sort keys %defs) {
next if( IsIgnored($d) );
@ -105,6 +117,7 @@ readingsGroup_updateDevices($;$)
$list{$d} = 1;
push @devices, [$d,$device[1]];
}
} elsif($device[0] =~ m/(.*)&(.*)/) {
my ($lattr,$re) = ($1, $2);
foreach my $d (sort keys %attr) {
@ -114,11 +127,14 @@ readingsGroup_updateDevices($;$)
$list{$d} = 1;
push @devices, [$d,$device[1]];
}
} elsif($device[0] =~ m/^<.*>$/) {
push @devices, [$device[0]];
} elsif( defined($defs{$device[0]}) ) {
$list{$device[0]} = 1;
push @devices, [@device];
} else {
foreach my $d (sort keys %defs) {
next if( IsIgnored($d) );
@ -966,7 +982,7 @@ readingsGroup_Notify($$)
|| ($regex =~ m/@\{/ && $regex !~ m/}$/) ) #handle , in reading@{...}
&& defined($list[++$i]) ) {
$regex .= ",". $list[$i];
}
}
next if( $reading eq "state" && !$show_state && (!defined($regex) || $regex ne "state") );
my $modifier = "";
if( $regex && $regex =~ m/^([+?!]*)(.*)/ ) {
@ -1217,6 +1233,7 @@ readingsGroup_Attr($$$;$)
<li>&lt;device&gt; can be of the form ATTRIBUTE&VALUE where ATTRIBUTE is the name of an attribute and VALUE is a regex.</li>
<li>&lt;device&gt; can be of the form &lt;STRING&gt; or &lt;{perl}&gt; where STRING or the string returned by perl is
inserted as a line in the readings list. skipped if STRING is undef.</li>
<li>&lt;device&gt; can be a devspec (see <a href="#devspec">devspec</a>) with at least one FILTER expression.</li>
<li>If regex is a comma separatet list the reading values will be shown on a single line.</li>
<li>If regex starts with a '+' it will be matched against the internal values of the device instead of the readings.</li>
<li>If regex starts with a '?' it will be matched against the attributes of the device instead of the readings.</li>