mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
39_alexa.pm: better UndefineFn, termiante imediataly in ShutdownFn
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18235 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c5abc97bfc
commit
be057e2f4f
@ -28,7 +28,7 @@ alexa_Initialize($)
|
|||||||
$hash->{DefFn} = "alexa_Define";
|
$hash->{DefFn} = "alexa_Define";
|
||||||
$hash->{NotifyFn} = "alexa_Notify";
|
$hash->{NotifyFn} = "alexa_Notify";
|
||||||
$hash->{UndefFn} = "alexa_Undefine";
|
$hash->{UndefFn} = "alexa_Undefine";
|
||||||
$hash->{ShutdownFn} = "alexa_Undefine";
|
$hash->{ShutdownFn} = "alexa_Shutdown";
|
||||||
$hash->{SetFn} = "alexa_Set";
|
$hash->{SetFn} = "alexa_Set";
|
||||||
$hash->{GetFn} = "alexa_Get";
|
$hash->{GetFn} = "alexa_Get";
|
||||||
$hash->{AttrFn} = "alexa_Attr";
|
$hash->{AttrFn} = "alexa_Attr";
|
||||||
@ -162,9 +162,26 @@ sub
|
|||||||
alexa_Undefine($$)
|
alexa_Undefine($$)
|
||||||
{
|
{
|
||||||
my ($hash, $arg) = @_;
|
my ($hash, $arg) = @_;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
if( $hash->{PID} ) {
|
||||||
|
$hash->{undefine} = 1;
|
||||||
alexa_stopAlexaFHEM($hash);
|
alexa_stopAlexaFHEM($hash);
|
||||||
|
|
||||||
|
return "$name will be deleted after alexa-fhem has stopped or after 5 seconds. whatever comes first.";
|
||||||
|
}
|
||||||
|
|
||||||
|
delete $modules{$hash->{TYPE}}{defptr};
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
sub
|
||||||
|
alexa_Shutdown($$)
|
||||||
|
{
|
||||||
|
my ($hash, $arg) = @_;
|
||||||
|
|
||||||
|
alexa_stoppedAlexaFHEM($hash);
|
||||||
|
|
||||||
delete $modules{$hash->{TYPE}}{defptr};
|
delete $modules{$hash->{TYPE}}{defptr};
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
@ -651,7 +668,12 @@ alexa_stoppedAlexaFHEM($)
|
|||||||
$hash->{LAST_STOP} = FmtDateTime( gettimeofday() );
|
$hash->{LAST_STOP} = FmtDateTime( gettimeofday() );
|
||||||
readingsSingleUpdate($hash, 'alexaFHEM', 'stopped', 1 );
|
readingsSingleUpdate($hash, 'alexaFHEM', 'stopped', 1 );
|
||||||
|
|
||||||
if( $hash->{start} ) {
|
if( $hash->{undefine} ) {
|
||||||
|
delete $hash->{undefine};
|
||||||
|
CommandDelete(undef, $name);
|
||||||
|
Log3 $name, 3, "$name: alexaFHEM deleted";
|
||||||
|
|
||||||
|
} elsif( $hash->{start} ) {
|
||||||
alexa_startAlexaFHEM($hash)
|
alexa_startAlexaFHEM($hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user