mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
39_alexa.pm: possible fix for 0 byte log files with the default name if alexaFHEM-log is used
git-svn-id: https://svn.fhem.de/fhem/trunk@21651 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
74c3993e7d
commit
09b64d5e8d
@ -54,7 +54,7 @@ alexa_Initialize($)
|
||||
#"alexaFHEM-filter ".
|
||||
"alexaFHEM-host alexaFHEM-sshUser ".
|
||||
"nrarchive ".
|
||||
"disable:1 disabledForIntervals ".
|
||||
"disable:1,0 disabledForIntervals ".
|
||||
$readingFnAttributes;
|
||||
|
||||
$hash->{FW_detailFn} = "alexa_detailFn";
|
||||
@ -116,6 +116,16 @@ alexa_AttrDefaults($)
|
||||
|
||||
}
|
||||
|
||||
sub
|
||||
alexa_InitLog($) {
|
||||
my $name = shift;
|
||||
if( $attr{global}{logdir} ) {
|
||||
CommandAttr(undef, "$name alexaFHEM-log %L/alexa-%Y-%m-%d.log") if( !AttrVal($name, 'alexaFHEM-log', undef ) );
|
||||
} else {
|
||||
CommandAttr(undef, "$name alexaFHEM-log ./log/alexa-%Y-%m-%d.log") if( !AttrVal($name, 'alexaFHEM-log', undef ) );
|
||||
}
|
||||
}
|
||||
|
||||
sub
|
||||
alexa_Define($$)
|
||||
{
|
||||
@ -144,12 +154,6 @@ alexa_Define($$)
|
||||
|
||||
$hash->{NOTIFYDEV} = "global,global:npmjs.*alexa-fhem.*";
|
||||
|
||||
if( $attr{global}{logdir} ) {
|
||||
CommandAttr(undef, "$name alexaFHEM-log %L/alexa-%Y-%m-%d.log") if( !AttrVal($name, 'alexaFHEM-log', undef ) );
|
||||
} else {
|
||||
CommandAttr(undef, "$name alexaFHEM-log ./log/alexa-%Y-%m-%d.log") if( !AttrVal($name, 'alexaFHEM-log', undef ) );
|
||||
}
|
||||
|
||||
#CommandAttr(undef, "$name alexaFHEM-filter alexaName=..*") if( !AttrVal($name, 'alexaFHEM-filter', undef ) );
|
||||
|
||||
if( !AttrVal($name, 'devStateIcon', undef ) ) {
|
||||
@ -162,6 +166,7 @@ alexa_Define($$)
|
||||
};
|
||||
|
||||
if( $init_done ) {
|
||||
alexa_InitLog($name);
|
||||
CoProcess::start($hash);
|
||||
} else {
|
||||
$hash->{STATE} = 'active';
|
||||
@ -186,6 +191,7 @@ alexa_Notify($$)
|
||||
return undef;
|
||||
|
||||
} elsif( grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}) ) {
|
||||
alexa_InitLog($hash->{NAME});
|
||||
CoProcess::start($hash);
|
||||
return undef;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user