mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-19 18:56:03 +00:00
fhem.pl: avoid TimeNow calls in DoTrigger
98_structure.pm: do not generate events for 2 LastDevice readings 91_notify.pm: fix the Wizard in the detail view 92_FileLog.pm: delete unused variable git-svn-id: https://svn.fhem.de/fhem/trunk@7854 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
04ce019252
commit
a156828e5b
@ -201,25 +201,16 @@ notify_fhemwebFn($$$$)
|
|||||||
$dh{$a[0]}{".*"} = 1;
|
$dh{$a[0]}{".*"} = 1;
|
||||||
$dh{$a[0]}{$a[1].".*"} = 1;
|
$dh{$a[0]}{$a[1].".*"} = 1;
|
||||||
}
|
}
|
||||||
my $list = ""; my @al;
|
my $list = "";
|
||||||
foreach my $dev (sort keys %dh) {
|
foreach my $dev (sort keys %dh) {
|
||||||
$list .= " $dev:" . join(",", sort keys %{$dh{$dev}});
|
$list .= " $dev:" . join(",", sort keys %{$dh{$dev}});
|
||||||
push @al, $dev;
|
|
||||||
}
|
}
|
||||||
$ret .= "<tr class=\"".(($row++&1)?"odd":"even")."\">";
|
|
||||||
$ret .= "<td colspan=\"2\"><form autocomplete=\"off\">";
|
|
||||||
$ret .= FW_hidden("detail", $d);
|
|
||||||
$ret .= FW_hidden("dev.$d", "$d addRegexpPart");
|
|
||||||
$ret .= FW_submit("cmd.$d", "set", "set");
|
|
||||||
$ret .= "<div class=\"set downText\"> $d addRegexpPart </div>";
|
|
||||||
$list =~ s/(['"])/./g;
|
$list =~ s/(['"])/./g;
|
||||||
$ret .= FW_select("","arg.$d",\@al, undef, "set",
|
|
||||||
"FW_selChange(this.options[selectedIndex].text,'$list','val.$d')");
|
$ret .= "<tr class=\"".(($row++&1)?"odd":"even")."\">";
|
||||||
$ret .= FW_textfield("val.$d", 30, "set");
|
$ret .= '<td colspan="2">';
|
||||||
my $al0 = (@al ? $al[0] : "");
|
$ret .= FW_detailSelect($d, "set", $list, "addRegexpPart");
|
||||||
$ret .= "<script type=\"text/javascript\">" .
|
$ret .= "</td></tr>";
|
||||||
"FW_selChange('$al0','$list','val.$d')</script>";
|
|
||||||
$ret .= "</form></td></tr>";
|
|
||||||
}
|
}
|
||||||
$ret .= "</table>";
|
$ret .= "</table>";
|
||||||
|
|
||||||
|
@ -361,10 +361,9 @@ FileLog_fhemwebFn($$$$)
|
|||||||
$dh{$a[0]}{".*"} = 1;
|
$dh{$a[0]}{".*"} = 1;
|
||||||
$dh{$a[0]}{$a[1].".*"} = 1;
|
$dh{$a[0]}{$a[1].".*"} = 1;
|
||||||
}
|
}
|
||||||
my $list = ""; my @al;
|
my $list = "";
|
||||||
foreach my $dev (sort keys %dh) {
|
foreach my $dev (sort keys %dh) {
|
||||||
$list .= " $dev:" . join(",", sort keys %{$dh{$dev}});
|
$list .= " $dev:" . join(",", sort keys %{$dh{$dev}});
|
||||||
push @al, $dev;
|
|
||||||
}
|
}
|
||||||
$list =~ s/(['"])/./g;
|
$list =~ s/(['"])/./g;
|
||||||
|
|
||||||
|
@ -277,9 +277,9 @@ sub structure_Notify($$)
|
|||||||
Log3 $me, 5, "Update structure '$me' to $newState" .
|
Log3 $me, 5, "Update structure '$me' to $newState" .
|
||||||
" because device $dev->{NAME} has changed";
|
" because device $dev->{NAME} has changed";
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate($hash, "LastDevice", $dev->{NAME});
|
readingsBulkUpdate($hash, "LastDevice", $dev->{NAME}, 0);
|
||||||
readingsBulkUpdate($hash, "LastDevice_Abs",
|
readingsBulkUpdate($hash, "LastDevice_Abs",
|
||||||
structure_getChangedDevice($dev->{NAME}));
|
structure_getChangedDevice($dev->{NAME}), 0);
|
||||||
readingsBulkUpdate($hash, "state", $newState);
|
readingsBulkUpdate($hash, "state", $newState);
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
|
@ -2871,6 +2871,7 @@ DoTrigger($$@)
|
|||||||
my $max = int(@{$hash->{CHANGED}});
|
my $max = int(@{$hash->{CHANGED}});
|
||||||
Log 5, "Triggering $dev ($max changes)";
|
Log 5, "Triggering $dev ($max changes)";
|
||||||
return "" if(defined($attr{$dev}) && defined($attr{$dev}{do_not_notify}));
|
return "" if(defined($attr{$dev}) && defined($attr{$dev}{do_not_notify}));
|
||||||
|
my $now = TimeNow();
|
||||||
|
|
||||||
################
|
################
|
||||||
# Log/notify modules
|
# Log/notify modules
|
||||||
@ -2880,7 +2881,7 @@ DoTrigger($$@)
|
|||||||
$hash->{INTRIGGER}=1;
|
$hash->{INTRIGGER}=1;
|
||||||
Log 5, "Notify loop for $dev $hash->{CHANGED}->[0]";
|
Log 5, "Notify loop for $dev $hash->{CHANGED}->[0]";
|
||||||
createNtfyHash() if(!%ntfyHash);
|
createNtfyHash() if(!%ntfyHash);
|
||||||
$hash->{NTFY_TRIGGERTIME} = TimeNow(); # Optimize FileLog
|
$hash->{NTFY_TRIGGERTIME} = $now; # Optimize FileLog
|
||||||
my $ntfyLst = (defined($ntfyHash{$dev}) ? $ntfyHash{$dev} : $ntfyHash{"*"});
|
my $ntfyLst = (defined($ntfyHash{$dev}) ? $ntfyHash{$dev} : $ntfyHash{"*"});
|
||||||
foreach my $n (@{$ntfyLst}) {
|
foreach my $n (@{$ntfyLst}) {
|
||||||
next if(!defined($defs{$n})); # Was deleted in a previous notify
|
next if(!defined($defs{$n})); # Was deleted in a previous notify
|
||||||
@ -2900,7 +2901,7 @@ DoTrigger($$@)
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
next if($inform{$c}{type} eq "raw");
|
next if($inform{$c}{type} eq "raw");
|
||||||
my $tn = TimeNow();
|
my $tn = $now;
|
||||||
if($attr{global}{mseclog}) {
|
if($attr{global}{mseclog}) {
|
||||||
my ($seconds, $microseconds) = gettimeofday();
|
my ($seconds, $microseconds) = gettimeofday();
|
||||||
$tn .= sprintf(".%03d", $microseconds/1000);
|
$tn .= sprintf(".%03d", $microseconds/1000);
|
||||||
@ -2922,7 +2923,7 @@ DoTrigger($$@)
|
|||||||
####################
|
####################
|
||||||
# Used by triggered perl programs to check the old value
|
# Used by triggered perl programs to check the old value
|
||||||
# Not suited for multi-valued devices (KS300, etc)
|
# Not suited for multi-valued devices (KS300, etc)
|
||||||
$oldvalue{$dev}{TIME} = TimeNow();
|
$oldvalue{$dev}{TIME} = $now;
|
||||||
$oldvalue{$dev}{VAL} = $hash->{STATE};
|
$oldvalue{$dev}{VAL} = $hash->{STATE};
|
||||||
|
|
||||||
if(!defined($hash->{INTRIGGER})) {
|
if(!defined($hash->{INTRIGGER})) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user