2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-08 05:15:10 +00:00

39_alexa.pm: support DelayedShutdownFn

git-svn-id: https://svn.fhem.de/fhem/trunk@18254 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2019-01-14 15:31:05 +00:00
parent 39cbcf2692
commit 15f02ba214

View File

@ -28,6 +28,7 @@ alexa_Initialize($)
$hash->{DefFn} = "alexa_Define";
$hash->{NotifyFn} = "alexa_Notify";
$hash->{UndefFn} = "alexa_Undefine";
$hash->{DelayedShutdownFn} = "alexa_DelayedShutdownFn";
$hash->{ShutdownFn} = "alexa_Shutdown";
$hash->{SetFn} = "alexa_Set";
$hash->{GetFn} = "alexa_Get";
@ -178,6 +179,20 @@ alexa_Undefine($$)
return undef;
}
sub
alexa_DelayedShutdownFn($)
{
my ($hash) = @_;
if( $hash->{PID} ) {
$hash->{shutdown} = 1;
alexa_stopAlexaFHEM($hash);
return 1;
}
return undef;
}
sub
alexa_Shutdown($)
{
my ($hash) = @_;
@ -698,8 +713,13 @@ alexa_stoppedAlexaFHEM($)
CommandDelete(undef, $name);
Log3 $name, 2, "$name: alexaFHEM deleted";
} elsif( $hash->{start} ) {
} elsif( $hash->{shutdown} ) {
delete $hash->{shutdown};
CancelDelayedShutdown($name);
} elsif( $hash->{start} ) {
alexa_startAlexaFHEM($hash)
}
}