From 44b2fe98983feb9b4dd210134744928c6d459084 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Tue, 6 Nov 2018 19:06:32 +0000 Subject: [PATCH] 93_DbRep: contrib 8.8.0 git-svn-id: https://svn.fhem.de/fhem/trunk@17695 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/93_DbRep.pm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fhem/contrib/DS_Starter/93_DbRep.pm b/fhem/contrib/DS_Starter/93_DbRep.pm index d09c17676..eefa8751c 100644 --- a/fhem/contrib/DS_Starter/93_DbRep.pm +++ b/fhem/contrib/DS_Starter/93_DbRep.pm @@ -386,11 +386,11 @@ sub DbRep_Define($@) { Log3 ($name, 4, "DbRep $name - history sql commandlist read from file ".$attr{global}{modpath}."/FHEM/FhemUtils/cacheDbRep"); } - RemoveInternalTimer($hash); - InternalTimer(gettimeofday()+int(rand(45)), 'DbRep_firstconnect', "$name||onBoot|", 0); - Log3 ($name, 4, "DbRep $name - initialized"); ReadingsSingleUpdateValue ($hash, 'state', 'initialized', 1); + + RemoveInternalTimer($hash); + InternalTimer(gettimeofday()+int(rand(45)), 'DbRep_firstconnect', "$name||onBoot|", 0); return undef; } @@ -1052,8 +1052,8 @@ sub DbRep_Attr($$$$) { my $val = ($do == 1 ? "disabled" : "initialized"); ReadingsSingleUpdateValue ($hash, "state", $val, 1); if ($do == 0) { - RemoveInternalTimer($hash); - InternalTimer(time+5, 'DbRep_firstconnect', "$name|||", 0); + #RemoveInternalTimer($hash); + #InternalTimer(time+5, 'DbRep_firstconnect', "$name|||", 0); } else { my $dbh = $hash->{DBH}; $dbh->disconnect() if($dbh); @@ -1362,13 +1362,12 @@ sub DbRep_firstconnect(@) { RemoveInternalTimer($hash, "DbRep_firstconnect"); return if(IsDisabled($name)); - - if (AttrVal($name, "fastStart", 0) && $prop eq "onBoot" ) { - $hash->{LASTCMD} = "init database connect stopped due to attribute fastStart"; - return; - } - + if ($init_done == 1) { + if (AttrVal($name, "fastStart", 0) && $prop eq "onBoot" ) { + $hash->{LASTCMD} = "init database connect stopped due to attribute fastStart"; + return; + } # DB Struktur aus DbLog Instanz übernehmen $hash->{HELPER}{DBREPCOL}{COLSET} = $dbloghash->{HELPER}{COLSET}; $hash->{HELPER}{DBREPCOL}{DEVICECOL} = $dbloghash->{HELPER}{DEVICECOL};