mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
59_HCS: Complete module initialization also after a REREADCFG signaled.
git-svn-id: https://svn.fhem.de/fhem/trunk@15777 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
214a0debca
commit
5131482231
@ -123,6 +123,7 @@ HCS_Define($$) {
|
|||||||
|
|
||||||
$hash->{DEVICE} = $a[2];
|
$hash->{DEVICE} = $a[2];
|
||||||
$hash->{STATE} = "Defined";
|
$hash->{STATE} = "Defined";
|
||||||
|
$hash->{NOTIFYDEV} = "global"; # NotifyFn nur aufrufen wenn global events (INITIALIZED)
|
||||||
|
|
||||||
HCS_DoInit($hash);
|
HCS_DoInit($hash);
|
||||||
|
|
||||||
@ -147,13 +148,8 @@ HCS_Notify($$) {
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $type = $hash->{TYPE};
|
my $type = $hash->{TYPE};
|
||||||
|
|
||||||
return if($dev->{NAME} ne "global" ||
|
return if(!grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}) && !grep(m/^REREADCFG$/, @{$dev->{CHANGED}}));
|
||||||
!grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}));
|
return if(AttrVal($name,"disable",""));
|
||||||
|
|
||||||
return if($attr{$name} && $attr{$name}{disable});
|
|
||||||
|
|
||||||
delete $modules{HCS}{NotifyFn};
|
|
||||||
delete $hash->{NTFY_ORDER} if($hash->{NTFY_ORDER});
|
|
||||||
|
|
||||||
HCS_DoInit($hash);
|
HCS_DoInit($hash);
|
||||||
|
|
||||||
@ -190,16 +186,20 @@ HCS_DoInit($) {
|
|||||||
|
|
||||||
$hash->{STATE} = "Initialized";
|
$hash->{STATE} = "Initialized";
|
||||||
|
|
||||||
if($init_done) {
|
if($init_done || defined($hash->{READINGS}{state})) {
|
||||||
my $ret = HCS_getValues($hash,0);
|
my $ret = HCS_getValues($hash,0);
|
||||||
HCS_setState($hash,$ret);
|
HCS_setState($hash,$ret);
|
||||||
|
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
if(ReadingsVal($name,"state","off") ne "off") {
|
if(ReadingsVal($name,"state","off") ne "off") {
|
||||||
|
Log3 $name, 4, "$type $name start interval timer.";
|
||||||
my $timer = gettimeofday()+($attr{$name}{interval}*60);
|
my $timer = gettimeofday()+($attr{$name}{interval}*60);
|
||||||
InternalTimer($timer, "HCS_checkState", $hash, 0);
|
InternalTimer($timer, "HCS_checkState", $hash, 0);
|
||||||
$hash->{NEXTCHECK} = FmtTime($timer);
|
$hash->{NEXTCHECK} = FmtTime($timer);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
readingsSingleUpdate($hash, "state", "off",0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user