mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
00_Schellenberg.pm: timer improved
git-svn-id: https://svn.fhem.de/fhem/trunk@22716 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
61ec7d243d
commit
a2eae603f8
@ -129,6 +129,8 @@ sub Schellenberg_Init {
|
|||||||
|
|
||||||
sub Schellenberg_Undef {
|
sub Schellenberg_Undef {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
|
RemoveInternalTimer($hash, \&SSchellenberg_ResetPairTimer);
|
||||||
DevIo_CloseDev($hash);
|
DevIo_CloseDev($hash);
|
||||||
return undef;
|
return undef;
|
||||||
};
|
};
|
||||||
@ -143,21 +145,24 @@ sub Schellenberg_Set {
|
|||||||
} elsif ($cmd eq 'pair') {
|
} elsif ($cmd eq 'pair') {
|
||||||
my $t = $args[0] || 60;
|
my $t = $args[0] || 60;
|
||||||
return 'missing time (seconds)' if ($t !~ m/[0-9]+/);
|
return 'missing time (seconds)' if ($t !~ m/[0-9]+/);
|
||||||
|
|
||||||
my sub resetPairTimer {
|
|
||||||
delete $hash->{'PAIRING'};
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
$hash->{'PAIRING'} = 1;
|
$hash->{'PAIRING'} = 1;
|
||||||
InternalTimer(Time::HiRes::time() + $t, \&resetPairTimer, {});
|
InternalTimer(Time::HiRes::time() + $t, \&Schellenberg_ResetPairTimer, $hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sub Schellenberg_ResetPairTimer {
|
||||||
|
my ($hash) = @_;
|
||||||
|
|
||||||
|
delete $hash->{'PAIRING'};
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
sub Schellenberg_Ready {
|
sub Schellenberg_Ready {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
return DevIo_OpenDev($hash, 1, "Schellenberg_Init");
|
|
||||||
|
return DevIo_OpenDev($hash, 1, "Schellenberg_Init");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user