diff --git a/fhem/CHANGED b/fhem/CHANGED
index 5390e989b..578b47669 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,11 +1,15 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- - feature: 50_Telegrambot: multiple contacts for send etc/removed depreacted messageTo,sendImageTo,sendPhotoTo/allowunknowncontacts
+ - feature: FHEMWEB/Event Monitor: optional FHEM Log monitor.
+ - feature: 50_Telegrambot: multiple contacts for send etc/removed depreacted
+ messageTo,sendImageTo,sendPhotoTo/allowunknowncontacts
- bugfix: 70_PushNotifier: remove messages fron FHEM-logfile
- feature: 49_SSCam: function "snap" for taking snapshots added,
- bugfix: 49_SSCam: fixed a bug that functions may impact each other
- - feature: 31_MilightDevice: Add restoreAtStart attribute so group devices (slot 'A') do not restore state by default at startup
- - bugfix: 30_MilightBridge/31_MilightDevice: Fix startup restore. Fix crash on invalid hostname.
+ - feature: 31_MilightDevice: Add restoreAtStart attribute so group devices
+ (slot 'A') do not restore state by default at startup
+ - bugfix: 30_MilightBridge/31_MilightDevice: Fix startup restore. Fix crash
+ on invalid hostname.
- feature: YAMAHA_NP: Direct FM frequency setting.
- feature: 30_pilight_xyz: possibility to change IO-Device (IODEV)
- bugfix: YAMAHA_AVR: fixing not correctly volume smoothing
diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm
index 8cf407f86..d597454b3 100755
--- a/fhem/FHEM/01_FHEMWEB.pm
+++ b/fhem/FHEM/01_FHEMWEB.pm
@@ -258,7 +258,10 @@ FW_Undef($$)
{
my ($hash, $arg) = @_;
my $ret = TcpServer_Close($hash);
- %FW_visibleDeviceHash = FW_visibleDevices() if($hash->{inform});
+ if($hash->{inform}) {
+ %FW_visibleDeviceHash = FW_visibleDevices();
+ delete($logInform{$hash->{NAME}});
+ }
return $ret;
}
@@ -527,6 +530,7 @@ FW_closeConn($)
delete($defs{$hash->{NAME}});
}
}
+
POSIX::exit(0) if($hash->{isChild});
FW_Read($hash, 1) if($hash->{BUF});
}
@@ -685,6 +689,11 @@ FW_answerCall($)
delete $defs{$FW_wname}{asyncOutput}{$FW_id};
}
}
+ if($me->{inform}{withLog}) {
+ $logInform{$me->{NAME}} = "FW_logInform";
+ } else {
+ delete($logInform{$me->{NAME}});
+ }
return -1;
}
@@ -1993,8 +2002,10 @@ FW_style($$)
"";
FW_pO "
";
my $filter = ($a[2] && $a[2] ne "1") ? $a[2] : ".*";
- FW_pO "Events (Filter:
$filter)".
- "
[Reset]:
\n";
+ FW_pO "Events (Filter:
$filter) ".
+ "
FHEM log ".
+ "".
+ "
\n";
FW_pO "
";
FW_pO "
";
@@ -2449,6 +2460,23 @@ FW_roomStatesForInform($$)
return $data;
}
+sub
+FW_logInform($$)
+{
+ my ($me, $msg) = @_; # _NO_ Log3 here!
+
+ my $ntfy = $defs{$me};
+ if(!$ntfy) {
+ delete $logInform{$me};
+ return;
+ }
+ if(!addToWritebuffer($ntfy, "$msg
") ){
+ TcpServer_Close($ntfy);
+ delete $logInform{$me};
+ delete $defs{$me};
+ }
+}
+
sub
FW_Notify($$)
{
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index 7e30a6a17..c78d7184c 100755
--- a/fhem/fhem.pl
+++ b/fhem/fhem.pl
@@ -212,6 +212,7 @@ use vars qw(%data); # Hash for user data
use vars qw(%defaultattr); # Default attributes, used by FHEM2FHEM
use vars qw(%defs); # FHEM device/button definitions
use vars qw(%inform); # Used by telnet_ActivateInform
+use vars qw(%logInform); # Used by FHEMWEB/Event-Monitor
use vars qw(%intAt); # Internal at timer hash, global for benchmark
use vars qw(%modules); # List of loaded modules (device/log/etc)
use vars qw(%ntfyHash); # hash of devices needed to be notified.
@@ -833,6 +834,13 @@ Log3($$$)
} else {
print "$tim $loglevel: $text\n";
}
+
+ no strict "refs";
+ foreach my $li (keys %logInform) {
+ &{$logInform{$li}}($li, "$tim $loglevel : $text");
+ }
+ use strict "refs";
+
return undef;
}
diff --git a/fhem/www/pgm2/console.js b/fhem/www/pgm2/console.js
index cedb09103..93acad6ee 100644
--- a/fhem/www/pgm2/console.js
+++ b/fhem/www/pgm2/console.js
@@ -2,6 +2,7 @@ var consConn;
var consFilter, oldFilter;
var consLastIndex = 0;
+var withLog = 0;
log("Console is opening");
function
@@ -24,8 +25,10 @@ consUpdate()
consLastIndex = len;
log("Console Rcvd: "+new_content);
+ if(new_content.indexOf('<') != 0)
+ new_content = new_content.replace(/ /g, " ");
$("#console")
- .append(new_content.replace(/ /g, " "))
+ .append(new_content)
.scrollTop($("#console")[0].scrollHeight);
}
@@ -40,7 +43,7 @@ consFill()
}
consConn = new XMLHttpRequest();
var query = document.location.pathname+"?XHR=1"+
- "&inform=type=raw;filter="+consFilter+
+ "&inform=type=raw;withLog="+withLog+";filter="+consFilter+
"×tamp="+new Date().getTime();
query = addcsrf(query);
consConn.open("GET", query, true);
@@ -62,14 +65,14 @@ consStart()
if(consFilter == undefined)
consFilter = ".*";
oldFilter = consFilter;
- setTimeout("consFill()", 1000);
+ setTimeout(consFill, 1000);
- $("a#eventReset").click(function(evt){ // Event Monitor Reset
+ $("#eventReset").click(function(evt){ // Event Monitor Reset
log("Console resetted by user");
$("#console").html("");
});
- $("a#eventFilter").click(function(evt){ // Event-Filter Dialog
+ $("#eventFilter").click(function(evt){ // Event-Filter Dialog
$('body').append(
''+
'
Filter:
'+
@@ -96,6 +99,11 @@ consStart()
}}]
});
});
+
+ $("#eventWithLog").change(function(evt){ // Event-Filter Dialog
+ withLog = ($("#eventWithLog").is(':checked') ? 1 : 0);
+ consFill();
+ });
}
window.onload = consStart;