73_km200: bugfix - Forward declaration made obsolete
git-svn-id: https://svn.fhem.de/fhem/trunk@26723 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -51,9 +51,6 @@ use strict;
|
||||
use warnings;
|
||||
use constant false => 0;
|
||||
use constant true => 1;
|
||||
sub km200_Define($$);
|
||||
sub km200_Undefine($$);
|
||||
sub km200_GetErrorMessage($$$$);
|
||||
|
||||
###START###### Initialize module ##############################################################################START####
|
||||
sub km200_Initialize($) {
|
||||
@@ -280,10 +277,6 @@ sub km200_Define($$) {
|
||||
@{$hash->{Secret}{KM200DONOTPOLL}} = ();
|
||||
####END####### Writing values to global hash ################################################################END#####
|
||||
|
||||
###START###### Reset fullResponse error message ############################################################START####
|
||||
readingsSingleUpdate( $hash, "fullResponse", "OK", 1);
|
||||
####END####### Reset fullResponse error message #############################################################END#####
|
||||
|
||||
###START###### For Debugging purpose only ##################################################################START####
|
||||
Log3 $name, 4, $name. " : km200 - Define H : " .$hash;
|
||||
Log3 $name, 4, $name. " : km200 - Define D : " .$def;
|
||||
@@ -292,6 +285,23 @@ sub km200_Define($$) {
|
||||
Log3 $name, 4, $name. " : km200 - Define Adr : " .$url;
|
||||
####END####### For Debugging purpose only ###################################################################END#####
|
||||
|
||||
### Proceed with km200 Initialization as soon fhem is initialized
|
||||
# https://forum.fhem.de/index.php/topic,130351.msg1246281.html#msg1246281
|
||||
# Die InternalTimer Eintraege werden erst abgearbeitet, wenn $init_done = 1 ist.
|
||||
InternalTimer(0, \&km200_FirstInit, $hash );
|
||||
|
||||
return
|
||||
}
|
||||
####END####### Activate module after module has been used via fhem command "define" ############################END#####
|
||||
|
||||
###START###### Initialize km200 after fhem Initialization is done #############################################START####
|
||||
sub km200_FirstInit($) {
|
||||
my $hash = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
###START###### Reset fullResponse error message ############################################################START####
|
||||
readingsSingleUpdate( $hash, "fullResponse", "OK", 1);
|
||||
####END####### Reset fullResponse error message #############################################################END#####
|
||||
|
||||
###START###### Check whether communication to the physical unit is possible ################################START####
|
||||
my $Km200Info ="";
|
||||
@@ -324,7 +334,7 @@ sub km200_Define($$) {
|
||||
|
||||
return undef;
|
||||
}
|
||||
####END####### Activate module after module has been used via fhem command "define" ############################END#####
|
||||
####END####### Initialize km200 after fhem Initialization is done ##############################################END#####
|
||||
|
||||
|
||||
###START###### To bind unit of value to DbLog entries #########################################################START####
|
||||
@@ -444,9 +454,8 @@ sub km200_Attr(@) {
|
||||
}
|
||||
####END#### Check whether timeout is not too short
|
||||
}
|
||||
### Check whether DoNotPoll attribute have been provided
|
||||
elsif($a[2] eq "DoNotPoll") {
|
||||
my @KM200_DONOTPOLL = ();
|
||||
elsif($a[2] eq 'DoNotPoll') {
|
||||
#my @KM200_DONOTPOLL = ();
|
||||
my @temp = @a;
|
||||
|
||||
### Stop the current timer
|
||||
@@ -460,12 +469,12 @@ sub km200_Attr(@) {
|
||||
push @temp, "";
|
||||
|
||||
### Transform string entries seperated by blank into array
|
||||
@KM200_DONOTPOLL = split(/\s+/, $temp[0]);
|
||||
my @KM200_DONOTPOLL = split m/\s+/, $temp[0] // ();
|
||||
|
||||
### Remove trailing slash of each item if available
|
||||
|
||||
### For each item found in this empty parent directory
|
||||
foreach my $item (@KM200_DONOTPOLL) {
|
||||
for my $item (@KM200_DONOTPOLL) {
|
||||
### Delete trailing slash
|
||||
$item =~ s/\/$//;
|
||||
}
|
||||
@@ -477,7 +486,8 @@ sub km200_Attr(@) {
|
||||
@{$hash->{Secret}{KM200ALLSERVICES}} = @{$hash->{Secret}{KM200ALLSERVICESBACKUP}};
|
||||
|
||||
### For every blacklisted service
|
||||
foreach my $SearchWord(@KM200_DONOTPOLL) {
|
||||
for my $SearchWord(@KM200_DONOTPOLL) {
|
||||
last if @{$hash->{Secret}{KM200ALLSERVICES}}|| ref @{$hash->{Secret}{KM200ALLSERVICES}} ne 'ARRAY';
|
||||
### Filter all blocked root services out of services to be polled
|
||||
my $FoundPosition = first_index{ $_ eq $SearchWord }@{$hash->{Secret}{KM200ALLSERVICES}};
|
||||
if ($FoundPosition >= 0) {
|
||||
@@ -2570,6 +2580,7 @@ sub km200_GetDynService($) {
|
||||
++$ServiceCounterDyn;
|
||||
$hash->{temp}{ServiceCounterDyn} = $ServiceCounterDyn;
|
||||
km200_GetDynService($hash);
|
||||
# $init_done ? km200_GetDynService($hash) : InternalTimer(gettimeofday()+30, \&km200_GetDynService, $hash, 1);
|
||||
}
|
||||
else {
|
||||
### Log entries for debugging purposes
|
||||
|
||||
Reference in New Issue
Block a user