2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

98_fronius.pm: V0.3: check for init_done in fronius_StartUp loop instead of define (https://forum.fhem.de/index.php?topic=139206.msg1330774#msg1330774)

git-svn-id: https://svn.fhem.de/fhem/trunk@29529 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
fichtennadel 2025-01-16 16:41:28 +00:00
parent 21e7ee84f0
commit 187505c545

View File

@ -2,6 +2,10 @@
# #
############################################## ##############################################
# #
# 2025.01.16 - DS_Starter / fichtennadel v0.3
# - CHANGE:
# - check for init_done in fronius_StartUp loop instead of define (https://forum.fhem.de/index.php?topic=139206.msg1330774#msg1330774)
#
# 2024.05.27 - fichtennadel v0.2 # 2024.05.27 - fichtennadel v0.2
# - CHANGE: # - CHANGE:
# - set GetActiveDeviceInfo # - set GetActiveDeviceInfo
@ -116,7 +120,7 @@ use Date::Parse;
use Time::Piece; use Time::Piece;
use lib ('./FHEM/lib', './lib'); use lib ('./FHEM/lib', './lib');
my $ModulVersion = "0.2"; my $ModulVersion = "0.3";
############################################################################## ##############################################################################
sub fronius_Initialize($) { sub fronius_Initialize($) {
@ -173,9 +177,7 @@ sub fronius_Define($$$) {
# for WR in StandBy # for WR in StandBy
$hash->{helper}{VARS}{ReInitGetAPIVersionInfo} = 0; $hash->{helper}{VARS}{ReInitGetAPIVersionInfo} = 0;
if ($init_done) {
fronius_StartUp($hash); fronius_StartUp($hash);
}
return undef; return undef;
} }
@ -195,6 +197,14 @@ sub fronius_Undefine($$) {
sub fronius_StartUp($) { sub fronius_StartUp($) {
my ($hash) = @_; my ($hash) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
RemoveInternalTimer ($hash, 'fronius_StartUp');
if (!$init_done) {
InternalTimer (gettimeofday() + 2, 'fronius_StartUp', $hash, 0);
return;
}
my $interval = List::Util::max(AttrVal( $name, "IntervalArchiveData", AttrVal( $name, "IntervalRealtimeData", 300 ) ), 300); my $interval = List::Util::max(AttrVal( $name, "IntervalArchiveData", AttrVal( $name, "IntervalRealtimeData", 300 ) ), 300);
Log3 $name, 4, "[$name] [fronius_StartUp]"; Log3 $name, 4, "[$name] [fronius_StartUp]";