diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 657ebe0d2..3443923ff 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -131,7 +131,6 @@ FHEMWEB_Initialize($) $hash->{AttrFn} = "FW_Attr"; $hash->{DefFn} = "FW_Define"; $hash->{UndefFn} = "FW_Undef"; - $hash->{NotifyFn}= "FW_Notify"; $hash->{NotifyFn}= ($init_done ? "FW_Notify" : "FW_SecurityCheck"); $hash->{AsyncOutputFn} = "FW_AsyncOutput"; $hash->{ActivateInformFn} = "FW_ActivateInform"; @@ -2860,8 +2859,17 @@ FW_Notify($$) my $max = int(@{$events}); my $dt = $dev->{TYPE}; for(my $i = 0; $i < $max; $i++) { - my $line = ("$tn $dt $dn ".$events->[$i]."
"); - eval { push @data,$line if($line =~ m/$h->{filter}/) } + my $line = "$tn $dt $dn ".$events->[$i]."
"; + eval { + my $ok; + if($h->{filterType} && $h->{filterType} eq "notify") { + $ok = ($dn =~ m/^$h->{filter}$/ || + "$dn:$events->[$i]" =~ m/^$h->{filter}$/) ; + } else { + $ok = ($line =~ m/$h->{filter}/) ; + } + push @data,$line if($ok); + } } } } diff --git a/fhem/www/pgm2/console.js b/fhem/www/pgm2/console.js index d278197e1..91d1b0f7b 100644 --- a/fhem/www/pgm2/console.js +++ b/fhem/www/pgm2/console.js @@ -3,7 +3,7 @@ FW_version["console.js"] = "$Id$"; var consConn; -var consFilter, oldFilter; +var consFilter, oldFilter, consFType=""; var consLastIndex = 0; var withLog = 0; var mustScroll = 1; @@ -76,7 +76,7 @@ consFill() FW_closeConn(); var query = "?XHR=1"+ - "&inform=type=raw;withLog="+withLog+";filter="+consFilter+ + "&inform=type=raw;withLog="+withLog+";filter="+consFilter+consFType+ "×tamp="+new Date().getTime(); query = addcsrf(query); @@ -130,11 +130,16 @@ consStart() $("#eventFilter").click(function(evt){ // Event-Filter Dialog $('body').append( '
'+ - '
Filter:

'+ - '
'+ + '
Filter (Regexp):

'+ + '

'+ + '
'+ + ' Match the whole line
'+ + ' Notify-Type: deviceName:event'+ + '
'+ '
'); + $("#evtfilterdlg input#"+(consFType=="" ? "f" : "n")).prop("checked",true); - $('#evtfilterdlg').dialog({ modal:true, + $('#evtfilterdlg').dialog({ modal:true, width:'auto', position:{ my: "left top", at: "right bottom", of: this, collision: "flipfit" }, close:function(){$('#evtfilterdlg').remove();}, @@ -148,6 +153,8 @@ consStart() return FW_okDialog(e); } consFilter = val ? val : ".*"; + consFType= ($("#evtfilterdlg input#n").is(":checked")) ? + ";filterType=notify" : ""; $(this).dialog('close'); $("a#eventFilter").html(consFilter); consFill();