2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 12:58:13 +00:00

16_STACKABLE_CC.pm: reconnect patches (Forum #37494)

git-svn-id: https://svn.fhem.de/fhem/trunk@8666 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-05-30 18:05:25 +00:00
parent 2283bc9a87
commit 096b87fbd3

View File

@ -15,6 +15,7 @@ STACKABLE_CC_Initialize($)
$hash->{DefFn} = "STACKABLE_CC_Define";
$hash->{UndefFn} = "STACKABLE_CC_Undef";
$hash->{ParseFn} = "STACKABLE_CC_Parse";
$hash->{NotifyFn} = "STACKABLE_CC_Notify";
$hash->{AttrFn} = "CUL_Attr";
$hash->{AttrList} = "IODev ignore:0,1 ".$modules{CUL}{AttrList};
@ -54,11 +55,43 @@ STACKABLE_CC_Define($$)
$hash->{StackLevel} = $io->{StackLevel} ? $io->{StackLevel}+1 : 1;
$hash->{STATE} = "Defined";
notifyRegexpChanged($hash, $a[2]);
CUL_DoInit($hash);
return undef;
}
sub
STACKABLE_CC_DoNotify($)
{
my ($ntfy) = @_;
DoTrigger($ntfy->{NAME}, $ntfy->{TriggerText});
delete $ntfy->{TriggerText};
}
sub
STACKABLE_CC_Notify($$)
{
my ($ntfy, $dev) = @_;
my $events = deviceEvents($dev, 0);
for(my $i = 0; $i < @{$events}; $i++) {
if($events->[$i] eq "DISCONNECTED") {
$ntfy->{STATE} = "disconnected";
setReadingsVal($ntfy, "state", "disconnected", TimeNow());
$ntfy->{TriggerText} = $events->[$i];
InternalTimer(gettimeofday()+0.1, "STACKABLE_CC_DoNotify", $ntfy, 0);
} elsif($events->[$i] eq "CONNECTED") {
CUL_DoInit($ntfy);
$ntfy->{TriggerText} = $events->[$i];
InternalTimer(gettimeofday()+0.001, "STACKABLE_CC_DoNotify", $ntfy, 0);
}
}
}
#####################################
sub
STACKABLE_CC_Write($$)