mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
fhem.pl: rework global attribute regexp checking, add devStateIcon (Forum #71897)
git-svn-id: https://svn.fhem.de/fhem/trunk@14284 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2b4e41b23f
commit
0c30050586
@ -3419,7 +3419,7 @@ FW_widgetOverride($$)
|
||||
</ul>
|
||||
Second form:<br>
|
||||
<ul>
|
||||
Perl regexp enclosed in {}. If the code returns undef, then the default
|
||||
Perl code enclosed in {}. If the code returns undef, then the default
|
||||
icon is used, if it retuns a string enclosed in <>, then it is
|
||||
interpreted as an html string. Else the string is interpreted as a
|
||||
devStateIcon of the first fom, see above.
|
||||
|
15
fhem/fhem.pl
15
fhem/fhem.pl
@ -2721,15 +2721,16 @@ CommandAttr($$)
|
||||
}
|
||||
}
|
||||
|
||||
my %ra = ("suppressReading" => 1,
|
||||
"event-on-update-reading" => 1,
|
||||
"event-on-change-reading" => 2,
|
||||
"timestamp-on-change-reading"=> 1,
|
||||
"event-min-interval" => 2);
|
||||
my %ra = ("suppressReading" => { s=>"\n" },
|
||||
"event-on-update-reading" => { s=>"," },
|
||||
"event-on-change-reading" => { s=>",", r=>":.*" },
|
||||
"timestamp-on-change-reading"=> { s=>"," },
|
||||
"event-min-interval" => { s=>",", r=>";.*" },
|
||||
"devStateIcon" => { s=>" ", r=>":.*" } );
|
||||
if(defined($a[2]) && $ra{$attrName}) {
|
||||
my $lval = $a[2];
|
||||
$lval =~ s/:.*// if($ra{$attrName} == 2);
|
||||
for my $v (split(",", $lval)) {
|
||||
for my $v (split($ra{$attrName}{s}, $lval)) {
|
||||
$v =~ s/$ra{$attrName}{r}// if($ra{$attrName}{r});
|
||||
my $err = "Argument $v for attr $sdev $a[1] is not a valid regexp";
|
||||
return "$err: use .* instead of *" if($v =~ /^\*/); # no err in eval!?
|
||||
eval { "Hallo" =~ m/^$v$/ };
|
||||
|
Loading…
x
Reference in New Issue
Block a user