mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
fhem.pl: Optimize notify (Forum #64078)
git-svn-id: https://svn.fhem.de/fhem/trunk@12966 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1f0bb8bd62
commit
0d6e8c0054
14
fhem/fhem.pl
14
fhem/fhem.pl
@ -4463,7 +4463,9 @@ sub
|
|||||||
createNtfyHash()
|
createNtfyHash()
|
||||||
{
|
{
|
||||||
my @ntfyList = sort { $defs{$a}{NTFY_ORDER} cmp $defs{$b}{NTFY_ORDER} }
|
my @ntfyList = sort { $defs{$a}{NTFY_ORDER} cmp $defs{$b}{NTFY_ORDER} }
|
||||||
grep { $defs{$_}{NTFY_ORDER} } keys %defs;
|
grep { $defs{$_}{NTFY_ORDER} &&
|
||||||
|
$defs{$_}{TYPE} &&
|
||||||
|
$modules{$defs{$_}{TYPE}}{NotifyFn} } keys %defs;
|
||||||
foreach my $d (@ntfyList) {
|
foreach my $d (@ntfyList) {
|
||||||
if($defs{$d}{NOTIFYDEV}) {
|
if($defs{$d}{NOTIFYDEV}) {
|
||||||
foreach my $nd (devspec2array($defs{$d}{NOTIFYDEV})) {
|
foreach my $nd (devspec2array($defs{$d}{NOTIFYDEV})) {
|
||||||
@ -4492,16 +4494,16 @@ notifyRegexpChanged($$)
|
|||||||
my ($hash, $re) = @_;
|
my ($hash, $re) = @_;
|
||||||
|
|
||||||
my $dev;
|
my $dev;
|
||||||
$dev = $1 if($re =~ m/^([^:]*)$/ || $re =~ m/^([^:]*):(.*)$/);
|
$dev = $1 if($re =~ m/^\(?([^:]*)\)?$/ || $re =~ m/^\(?([^:]*):(.*)\)?$/);
|
||||||
|
|
||||||
if($dev && defined($defs{$dev}) && $re !~ m/\|/) { # Forum #36663
|
if($dev && defined($defs{$dev}) && $re !~ m/\|/) { # Forum #36663
|
||||||
$hash->{NOTIFYDEV} = $dev;
|
$hash->{NOTIFYDEV} = $dev;
|
||||||
|
|
||||||
} elsif($re =~ m/\|/ && $re =~ /^\(?([^().+*?\[\]\\]+)\)?$/) { # Regexp Wizard
|
} elsif($re =~ m/\|/) { # Regexp Wizard
|
||||||
my @list2 = split(/\|/, $1); # Forum #54536
|
my @list2 = split(/\|/, $re); # Forum #54536
|
||||||
my @list = grep { m/./ } # Forum #62369
|
my @list = grep { m/./ } # Forum #62369
|
||||||
map { (m/^([^:]*)(?::.*)?$/ && $defs{$1}) ? $1 : "" } @list2;
|
map { (m/^\(?([^:]*)(?::.*)?\)?$/ && $defs{$1}) ? $1:""} @list2;
|
||||||
if(@list && @list <= 5 && int(@list) == int(@list2)) {
|
if(@list && @list <= 10 && int(@list) == int(@list2)) {
|
||||||
$hash->{NOTIFYDEV} = join(",", @list);
|
$hash->{NOTIFYDEV} = join(",", @list);
|
||||||
} else {
|
} else {
|
||||||
delete($hash->{NOTIFYDEV});
|
delete($hash->{NOTIFYDEV});
|
||||||
|
Loading…
Reference in New Issue
Block a user