diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index dec57d8d2..7860c0d02 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -689,8 +689,8 @@ FW_answerCall($) FW_pO "\n"; if($FW_activateInform) { + $cmd = "style eventMonitor $FW_activateInform"; $FW_cmdret = $FW_activateInform = ""; - $cmd = "style eventMonitor"; } FW_roomOverview($cmd); @@ -1740,8 +1740,13 @@ FW_style($$) FW_pO ""; FW_pO "
"; - FW_pO "
"; - FW_pO "Events:
\n"; + if($a[2] && $a[2] ne "1") { + FW_pO "
"; + FW_pO "Events ($a[2] only):
\n"; + } else { + FW_pO "
"; + FW_pO "Events:
\n"; + } FW_pO "
"; FW_pO "
"; @@ -2184,7 +2189,11 @@ FW_Notify($$) return undef if(!$h); my $dn = $dev->{NAME}; - return undef if(!$h->{devices}{$dn} && $h->{type} !~ m/raw/); + if($h->{type} eq "raw") { + return undef if($dn !~ m/$h->{filter}/); + } else { # Status + return undef if(!$h->{devices}{$dn}); + } my @data; my %extPage; @@ -2558,9 +2567,10 @@ FW_visibleDevices(;$) } sub -FW_ActivateInform() +FW_ActivateInform($;$) { - $FW_activateInform = 1; + my ($cl, $arg) = @_; + $FW_activateInform = ($arg ? $arg : 1); } sub diff --git a/fhem/FHEM/98_telnet.pm b/fhem/FHEM/98_telnet.pm index 9c8e3d084..eac36d928 100644 --- a/fhem/FHEM/98_telnet.pm +++ b/fhem/FHEM/98_telnet.pm @@ -324,11 +324,12 @@ telnet_Undef($$) } sub -telnet_ActivateInform($) +telnet_ActivateInform($;$) { - my ($cl) = @_; + my ($cl, $arg) = @_; my $name = $cl->{NAME}; - CommandInform($cl, "timer") if(!$inform{$name}); + $arg = "" if(!defined($arg)); + CommandInform($cl, "timer $arg") if(!$inform{$name}); } diff --git a/fhem/FHEM/98_update.pm b/fhem/FHEM/98_update.pm index f47ffd9a8..410e12fc4 100644 --- a/fhem/FHEM/98_update.pm +++ b/fhem/FHEM/98_update.pm @@ -51,7 +51,7 @@ CommandUpdate($$) $updateInBackground = 0 if($arg ne "all"); $updArg = $arg; if($updateInBackground) { - CallFn($cl->{NAME}, "ActivateInformFn", $cl); + CallFn($cl->{NAME}, "ActivateInformFn", $cl, "global"); BlockingCall("doUpdateInBackground", {src=>$src,arg=>$arg}); return "Executing the update the background."; @@ -150,8 +150,7 @@ doUpdate($$) my @excl = split(" ", AttrVal("global", "exclude_from_update", "")); - uLog 1, "List of new / modified files since last update:" - if($arg eq "check"); + my @rl = upd_getChanges($root, $basePath); ########################### # process the remote controlfile my $nChanged = 0; @@ -194,6 +193,8 @@ doUpdate($$) } + uLog 1, "List of new / modified files since last update:" + if($arg eq "check" && $nChanged == 0); uLog 1, "$r[0] $fName"; $nChanged++; next if($arg eq "check"); @@ -222,17 +223,12 @@ doUpdate($$) return; } - if($arg eq "check") { - my @lines = split(/[\r\n]/,upd_getUrl("$basePath/CHANGED")); - my $ret = ""; - foreach my $line (@lines) { - next if($line =~ m/^#/); - last if($line eq ""); - $ret .= $line."\n"; - } - uLog 1, "\nList of last changes:\n".$ret; - return; + if(@rl) { + uLog(1, ""); + uLog 1, "New entries in the CHANGED file:"; + map { uLog 1, $_ } @rl; } + return if($arg eq "check"); if($arg eq "all" || $arg eq "force") { # store the controlfile return if(!upd_writeFile($root, $restoreDir, @@ -272,6 +268,35 @@ upd_mkDir($$$) } } +sub +upd_getChanges($$) +{ + my ($root, $basePath) = @_; + my $lFile = ""; + if(open(FH, "$root/CHANGED")) { + foreach my $l () { # first non-comment line + next if($l =~ m/^#/); + chomp $l; + $lFile = $l; + last; + } + close(FH); + } + my @lines = split(/[\r\n]/,upd_getUrl("$basePath/CHANGED")); + my $maxLines = 25; + my @ret; + foreach my $line (@lines) { + next if($line =~ m/^#/); + last if($line eq "" || $line eq $lFile); + push @ret, $line; + if($maxLines-- < 1) { + push @ret, "... rest of lines skipped."; + last; + } + } + return @ret; +} + sub upd_getUrl($) { diff --git a/fhem/www/pgm2/console.js b/fhem/www/pgm2/console.js index bc057a64d..f344e228d 100644 --- a/fhem/www/pgm2/console.js +++ b/fhem/www/pgm2/console.js @@ -1,6 +1,7 @@ var consConn; var isFF = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1); +var consFilter, consTxt; log("Console is opening"); @@ -18,7 +19,7 @@ consUpdate() var el = document.getElementById("console"); if(el) { - el.innerHTML="Events:
"+consConn.responseText; + el.innerHTML=consTxt+consConn.responseText; el.scrollTop = el.scrollHeight; } } @@ -27,9 +28,10 @@ function consFill() { FW_errmsg(""); + consConn = new XMLHttpRequest(); var query = document.location.pathname+"?XHR=1"+ - "&inform=type=raw;filter=.*"+ + "&inform=type=raw;filter="+consFilter+ "×tamp="+new Date().getTime(); query = addcsrf(query); consConn.open("GET", query, true); @@ -40,6 +42,12 @@ consFill() function consStart() { + var el = document.getElementById("console"); + + consFilter = el.getAttribute("filter"); + if(consFilter == undefined) + consFilter = ".*"; + consTxt = el.innerHTML; setTimeout("consFill()", 1000); }