59_HCS: Query $init_done only in DefFn.

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15782 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
hjr 2018-01-05 10:04:16 +00:00
parent 397bb60ae3
commit df9b44b3d1

View File

@ -30,7 +30,7 @@ sub HCS_Initialize($$);
sub HCS_Define($$);
sub HCS_Undef($$);
sub HCS_Notify($$);
sub HCS_DoInit($);
sub HCS_DoInit($$);
sub HCS_checkState($);
sub HCS_Get($@);
sub HCS_Set($@);
@ -117,7 +117,7 @@ HCS_Define($$) {
if(!defined($defs{$a[2]})) {
my $ret = "Device $a[2] not defined. Please add this device first!";
Log 1, "$type $name $ret";
Log3 $name, 1, "$type $name $ret";
return $ret;
}
@ -125,7 +125,7 @@ HCS_Define($$) {
$hash->{STATE} = "Defined";
$hash->{NOTIFYDEV} = "global"; # NotifyFn nur aufrufen wenn global events (INITIALIZED)
HCS_DoInit($hash);
HCS_DoInit($hash,$init_done);
return undef;
}
@ -151,15 +151,15 @@ HCS_Notify($$) {
return if(!grep(m/^INITIALIZED$/, @{$dev->{CHANGED}}) && !grep(m/^REREADCFG$/, @{$dev->{CHANGED}}));
return if(AttrVal($name,"disable",""));
HCS_DoInit($hash);
HCS_DoInit($hash,1);
return undef;
}
#####################################
sub
HCS_DoInit($) {
my ($hash) = @_;
HCS_DoInit($$) {
my ($hash,$complete_init) = @_;
my $name = $hash->{NAME};
my $type = $hash->{TYPE};
@ -186,7 +186,7 @@ HCS_DoInit($) {
$hash->{STATE} = "Initialized";
if($init_done || defined($hash->{READINGS}{state})) {
if($complete_init) {
my $ret = HCS_getValues($hash,0);
HCS_setState($hash,$ret);