2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

HMInfo: update init procedure

git-svn-id: https://svn.fhem.de/fhem/trunk@23643 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2021-01-30 16:21:19 +00:00
parent 0aa1c1bbbc
commit 5c30778d25

View File

@ -68,7 +68,8 @@ sub HMinfo_Initialize($$) {####################################################
."verbCULHM:multiple,none,allSet,allGet,allSetVerb,allGetVerb " ."verbCULHM:multiple,none,allSet,allGet,allSetVerb,allGetVerb "
.$readingFnAttributes; .$readingFnAttributes;
$hash->{NOTIFYDEV} = "global"; $hash->{NOTIFYDEV} = "global";
InternalTimer(gettimeofday()+5,"HMinfo_init", "HMinfo_init", 0); $modules{HMinfo}{helper}{initDone} = 0;
HMinfo_init();
} }
sub HMinfo_Define($$){######################################################### sub HMinfo_Define($$){#########################################################
my ($hash, $def) = @_; my ($hash, $def) = @_;
@ -96,6 +97,8 @@ sub HMinfo_Define($$){#########################################################
.",cover:closed" .",cover:closed"
; ;
$hash->{nb}{cnt} = 0; $hash->{nb}{cnt} = 0;
$modules{HMinfo}{helper}{initDone} = 0;
HMinfo_init();
return; return;
} }
sub HMinfo_Undef($$){########################################################## sub HMinfo_Undef($$){##########################################################
@ -251,6 +254,7 @@ sub HMinfo_Notify(@){##########################################################
HMinfo_archConfig($hash,$name,"","") if(AttrVal($name,"autoArchive",undef)); HMinfo_archConfig($hash,$name,"","") if(AttrVal($name,"autoArchive",undef));
} }
if (grep /INITIALIZED/,@{$events}){ if (grep /INITIALIZED/,@{$events}){
$modules{HMinfo}{helper}{initDone} = 0;
HMinfo_init(); HMinfo_init();
} }
return undef; return undef;
@ -258,10 +262,11 @@ sub HMinfo_Notify(@){##########################################################
sub HMinfo_init(){############################################################# sub HMinfo_init(){#############################################################
RemoveInternalTimer("HMinfo_init");# just to be secure... RemoveInternalTimer("HMinfo_init");# just to be secure...
if ($init_done){ if ($init_done){
if (!defined $modules{HMinfo}{helper}{initDone} || !$modules{HMinfo}{helper}{initDone}){ # && !$modules{HMinfo}{helper}{initDone}){ if (!$modules{HMinfo}{helper}{initDone}){ # && !$modules{HMinfo}{helper}{initDone}){
my ($hm) = devspec2array("TYPE=HMinfo"); my ($hm) = devspec2array("TYPE=HMinfo");
if (substr(AttrVal($hm, "autoLoadArchive", 0),0,1) ne 0){ if (substr(AttrVal($hm, "autoLoadArchive", 0),0,1) ne 0){
HMinfo_SetFn($defs{$hm},$hm,"loadConfig"); HMinfo_SetFn($defs{$hm},$hm,"loadConfig");
InternalTimer(gettimeofday()+5,"HMinfo_init", "HMinfo_init", 0);
} }
else{ else{
$modules{HMinfo}{helper}{initDone} = 1; $modules{HMinfo}{helper}{initDone} = 1;