98_fhemdebug.pm: some little hacks (Forum #123655)
git-svn-id: https://svn.fhem.de/fhem/trunk@25146 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -8,11 +8,13 @@ use B qw(svref_2object);
|
||||
|
||||
my $fhemdebug_enabled;
|
||||
my $main_callfn;
|
||||
my $main_readingsEndUpdate;
|
||||
my $main_setReadingsVal;
|
||||
|
||||
sub
|
||||
fhemdebug_Initialize($){
|
||||
$cmds{"fhemdebug"}{Fn} = "fhemdebug_Fn";
|
||||
$cmds{"fhemdebug"}{Hlp} = "{start|stop|status}";
|
||||
$cmds{"fhemdebug"}{Hlp} = "{enable|disable|status|timerList}";
|
||||
}
|
||||
|
||||
sub
|
||||
@@ -46,10 +48,29 @@ fhemdebug_Fn($$)
|
||||
$addTimerStacktrace = $param;
|
||||
return;
|
||||
|
||||
} elsif($param =~ m/^forceEvents ([0|1])/) { #123655
|
||||
local $SIG{__WARN__} = sub { };
|
||||
if($1) {
|
||||
$main_readingsEndUpdate = \&readingsEndUpdate;
|
||||
$main_setReadingsVal = \&setReadingsVal;
|
||||
*readingsEndUpdate = sub($$){
|
||||
$_[1]=1;
|
||||
&{$main_readingsEndUpdate}(@_);
|
||||
};
|
||||
*setReadingsVal = sub($$$$) {
|
||||
DoTrigger($_[0]->{NAME}, "$_[1] $_[2]") if($_[1] && $_[1] eq "IODev");
|
||||
&{$main_setReadingsVal}(@_);
|
||||
};
|
||||
} else {
|
||||
*readingsEndUpdate = $main_readingsEndUpdate;
|
||||
*setReadingsVal = $main_setReadingsVal;
|
||||
}
|
||||
|
||||
} else {
|
||||
return "Usage: fhemdebug {enable | disable | status | ".
|
||||
"timerList | addTimerStacktrace {0|1} }";
|
||||
"timerList | addTimerStacktrace {0|1} | forceEvents {0|1} }";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub
|
||||
|
||||
Reference in New Issue
Block a user