73_km200.pm: Bugfix and DoNotPoll hierarchy
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7589 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# $Id: 73_km200.pm 0037 2015-01-14 16:00:00Z Matthias_Deeke $
|
# $Id: 73_km200.pm 0038 2015-01-16 19:30:00Z Matthias_Deeke $
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
#
|
#
|
||||||
# 73_km200.pm
|
# 73_km200.pm
|
||||||
@@ -132,9 +132,13 @@
|
|||||||
# 0036 13.01.2015 Sailor km200_GetDynService Preparing DbLog Split
|
# 0036 13.01.2015 Sailor km200_GetDynService Preparing DbLog Split
|
||||||
# 0036 13.01.2015 Sailor km200_GetStatService Preparing DbLog Split
|
# 0036 13.01.2015 Sailor km200_GetStatService Preparing DbLog Split
|
||||||
# 0036 13.01.2015 Sailor =pod Correction of errors and German description added
|
# 0036 13.01.2015 Sailor =pod Correction of errors and German description added
|
||||||
# 0037 14.01.2015 Sailor km200_DbLog_splitFn Try-out DbLog Split
|
# 0037 14.01.2015 Sailor km200_DbLog_splitFn Try-out DbLog Split (Failed... no name of device handed over in event)
|
||||||
# 0037 14.01.2015 Sailor =pod Correction of errors
|
# 0037 14.01.2015 Sailor =pod Correction of errors
|
||||||
# 0037 14.01.2015 Sailor km200_Attr Readings are being deleted if set not to be polled by attribute
|
# 0037 14.01.2015 Sailor km200_Attr Readings are being deleted if set not to be polled by attribute
|
||||||
|
# 0038 16.01.2015 Sailor km200_Attr Implementing hierarchy top-down in DoNotPoll
|
||||||
|
# 0038 16.01.2015 Sailor km200_ParseHttpResponseInit Implementing hierarchy top-down in DoNotPoll
|
||||||
|
# 0038 16.01.2015 Sailor =pod Implementing hierarchy top-down in DoNotPoll
|
||||||
|
# 0038 16.01.2015 Sailor del_double Adding a helper to delete double entries in arrays
|
||||||
########################################################################################################################
|
########################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
@@ -203,7 +207,7 @@ sub km200_Define($$)
|
|||||||
my $url = $a[2];
|
my $url = $a[2];
|
||||||
my $km200_gateway_password = $a[3];
|
my $km200_gateway_password = $a[3];
|
||||||
my $km200_private_password = $a[4];
|
my $km200_private_password = $a[4];
|
||||||
my $ModuleVersion = "0037";
|
my $ModuleVersion = "0038";
|
||||||
|
|
||||||
$hash->{NAME} = $name;
|
$hash->{NAME} = $name;
|
||||||
$hash->{STATE} = "define";
|
$hash->{STATE} = "define";
|
||||||
@@ -558,18 +562,17 @@ sub km200_Define($$)
|
|||||||
if ($Km200Info eq "ERROR")
|
if ($Km200Info eq "ERROR")
|
||||||
{
|
{
|
||||||
## Communication with Gateway WRONG !! ##
|
## Communication with Gateway WRONG !! ##
|
||||||
|
|
||||||
$hash->{STATE}="Error - No Communication";
|
$hash->{STATE}="Error - No Communication";
|
||||||
return ($name .": km200 - ERROR - The communication between fhem and the Buderus KM200 failed! \n".
|
return ($name .": km200 - ERROR - The communication between fhem and the Buderus KM200 failed! \n".
|
||||||
" Please check physical connection, IP-address and passwords! \n");
|
" Please check physical connection, IP-address and passwords! \n");
|
||||||
}
|
}
|
||||||
elsif ($Km200Info eq "SERVICE NOT AVAILABLE")
|
elsif ($Km200Info eq "SERVICE NOT AVAILABLE") ## Communication OK but service not available ##
|
||||||
{
|
{
|
||||||
Log3 $name, 5, $name. " : km200 - /gateway/DateTime : NOT AVAILABLE"; ## Communication OK but service not available ##
|
Log3 $name, 5, $name. " : km200 - /gateway/DateTime : NOT AVAILABLE";
|
||||||
}
|
}
|
||||||
else
|
else ## Communication OK and service is available ##
|
||||||
{
|
{
|
||||||
Log3 $name, 5, $name. " : km200 - /gateway/DateTime : " .$Km200Info->{value}; ## Communication OK and service is available ##
|
Log3 $name, 5, $name. " : km200 - /gateway/DateTime : AVAILABLE";
|
||||||
}
|
}
|
||||||
####END####### Check whether communication to the physical unit is possible ################################END#####
|
####END####### Check whether communication to the physical unit is possible ################################END#####
|
||||||
|
|
||||||
@@ -752,7 +755,21 @@ sub km200_Attr(@)
|
|||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
####END#### Stop the current timer
|
####END#### Stop the current timer
|
||||||
|
|
||||||
###START###### Filter all services not to be polled out of known services = AllServices (new) #############START####
|
|
||||||
|
###START###### Filter all services not to be polled out of known services = AllServices (new) #########START####
|
||||||
|
|
||||||
|
### Search for all Services in @KM200_AllServices which containing the Service(hierarchy) not to be polled
|
||||||
|
my @KM200_DONOTPOLLTEMP = @KM200_DONOTPOLL;
|
||||||
|
foreach my $SearchWord(@KM200_DONOTPOLLTEMP)
|
||||||
|
{
|
||||||
|
my @DONOTPOLLGREP = grep {/^$SearchWord/}@KM200_AllServices;
|
||||||
|
@KM200_DONOTPOLL = (@KM200_DONOTPOLL, @DONOTPOLLGREP);
|
||||||
|
}
|
||||||
|
|
||||||
|
### Delete double entries in array
|
||||||
|
@KM200_DONOTPOLL = &del_double(@KM200_DONOTPOLL);
|
||||||
|
|
||||||
|
### For each Service not to be polled: Delete the Service from @KM200_AllServices and delete the reading in fhem
|
||||||
foreach my $SearchWord(@KM200_DONOTPOLL)
|
foreach my $SearchWord(@KM200_DONOTPOLL)
|
||||||
{
|
{
|
||||||
my $FoundPosition = first_index{ $_ eq $SearchWord }@KM200_AllServices;
|
my $FoundPosition = first_index{ $_ eq $SearchWord }@KM200_AllServices;
|
||||||
@@ -765,15 +782,18 @@ sub km200_Attr(@)
|
|||||||
fhem( "deletereading $name $SearchWord" );
|
fhem( "deletereading $name $SearchWord" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Save list of services to be polled to hash
|
||||||
@{$hash->{Secret}{KM200ALLSERVICES}} = @KM200_AllServices;
|
@{$hash->{Secret}{KM200ALLSERVICES}} = @KM200_AllServices;
|
||||||
####END####### Filter all services not to be polled out of known services = AllServices (new) ##############END#####
|
|
||||||
|
####END####### Filter all services not to be polled out of known services = AllServices (new) ##########END#####
|
||||||
|
|
||||||
Log3 $name, 5, $name. " : km200 - The following services will not be polled: ". @KM200_DONOTPOLL;
|
Log3 $name, 5, $name. " : km200 - The following services will not be polled: ". @KM200_DONOTPOLL;
|
||||||
|
|
||||||
###START###### Initiate the timer for first time polling of values from KM200 but wait 5s ################START####
|
###START###### Initiate the timer for first time polling of values from KM200 but wait 5s ############START####
|
||||||
InternalTimer(gettimeofday()+5, "km200_GetInitService", $hash, 0);
|
InternalTimer(gettimeofday()+5, "km200_GetInitService", $hash, 0);
|
||||||
Log3 $name, 5, $name. " : km200 - Internal timer for Init of services restarted after services set by attribute not to be polled.";
|
Log3 $name, 5, $name. " : km200 - Internal timer for Init of services restarted after services set by attribute not to be polled.";
|
||||||
####END####### Initiate the timer for first time polling of values from KM200 but wait 60s ################END#####
|
####END####### Initiate the timer for first time polling of values from KM200 but wait 60s ############END#####
|
||||||
}
|
}
|
||||||
### If no attributes of the above known ones have been selected
|
### If no attributes of the above known ones have been selected
|
||||||
else
|
else
|
||||||
@@ -901,6 +921,16 @@ sub str_repeat($$)
|
|||||||
####END######## Repeats "string" for "count" times #############################################################END#####
|
####END######## Repeats "string" for "count" times #############################################################END#####
|
||||||
|
|
||||||
|
|
||||||
|
###START####### Removes double entries in arrays ##############################################################START####
|
||||||
|
sub del_double
|
||||||
|
{
|
||||||
|
my %all;
|
||||||
|
$all{$_}=0 for @_;
|
||||||
|
return (keys %all);
|
||||||
|
}
|
||||||
|
####END######## Removes double entries in arrays ###############################################################END#####
|
||||||
|
|
||||||
|
|
||||||
###START###### Subroutine Encrypt Data ########################################################################START####
|
###START###### Subroutine Encrypt Data ########################################################################START####
|
||||||
sub km200_Encrypt($)
|
sub km200_Encrypt($)
|
||||||
{
|
{
|
||||||
@@ -1308,10 +1338,25 @@ sub km200_ParseHttpResponseInit($)
|
|||||||
}
|
}
|
||||||
####END####### Filter all static services out of responsive services = responsive dynamic services #########END#####
|
####END####### Filter all static services out of responsive services = responsive dynamic services #########END#####
|
||||||
|
|
||||||
|
###START###### Filter all responsive services out of known static services = responsive static services ###START####
|
||||||
|
my @KM200_StatServices = ();
|
||||||
|
|
||||||
|
foreach my $SearchWord(@KM200_RespondingServices)
|
||||||
|
{
|
||||||
|
my $FoundPosition = first_index{ $_ eq $SearchWord }@{$hash->{Secret}{KM200STATSERVICES}};
|
||||||
|
if ($FoundPosition >= 0)
|
||||||
|
{
|
||||||
|
push (@KM200_StatServices, $SearchWord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
####END####### Filter all responsive services out of known static services = responsive static services ####END#####
|
||||||
|
|
||||||
|
|
||||||
### Save arrays of services in hash
|
### Save arrays of services in hash
|
||||||
@{$hash->{Secret}{KM200RESPONDINGSERVICES}} = @KM200_RespondingServices;
|
@{$hash->{Secret}{KM200RESPONDINGSERVICES}} = @KM200_RespondingServices;
|
||||||
@{$hash->{Secret}{KM200WRITEABLESERVICES}} = @KM200_WriteableServices;
|
@{$hash->{Secret}{KM200WRITEABLESERVICES}} = @KM200_WriteableServices;
|
||||||
@{$hash->{Secret}{KM200DYNSERVICES}} = @KM200_DynServices;
|
@{$hash->{Secret}{KM200DYNSERVICES}} = @KM200_DynServices;
|
||||||
|
@{$hash->{Secret}{KM200STATSERVICES}} = @KM200_StatServices;
|
||||||
### Save arrays of services in hash
|
### Save arrays of services in hash
|
||||||
|
|
||||||
$hash->{status}{FlagInitRequest} = false;
|
$hash->{status}{FlagInitRequest} = false;
|
||||||
@@ -1793,6 +1838,7 @@ sub km200_ParseHttpResponseStat($)
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<tr><td align="right" valign="top"><li><code>DoNotPoll</code> : </li></td><td align="left" valign="top">A list of services separated by blanks which shall not be downloaded due to repeatable crashes or irrelevant values.<BR>
|
<tr><td align="right" valign="top"><li><code>DoNotPoll</code> : </li></td><td align="left" valign="top">A list of services separated by blanks which shall not be downloaded due to repeatable crashes or irrelevant values.<BR>
|
||||||
|
The list can be filled with the name of the top - hierarchy service, which means everything below that service will also be ignored.<BR>
|
||||||
The default value (empty) therefore nothing will be ignored.<BR>
|
The default value (empty) therefore nothing will be ignored.<BR>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</td>
|
</td>
|
||||||
@@ -1958,6 +2004,7 @@ sub km200_ParseHttpResponseStat($)
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<tr><td align="right" valign="top"><li><code>DoNotPoll</code> : </li></td><td align="left" valign="top">Eine durch Leerzeichen (Blank) getrennte Liste von Services welche von der Abfrage aufgrund irrelevanter Werte oder fhem - Abstürzen ausgenommen werden sollen.<BR>
|
<tr><td align="right" valign="top"><li><code>DoNotPoll</code> : </li></td><td align="left" valign="top">Eine durch Leerzeichen (Blank) getrennte Liste von Services welche von der Abfrage aufgrund irrelevanter Werte oder fhem - Abstürzen ausgenommen werden sollen.<BR>
|
||||||
|
Die Liste kann auch Hierarchien von services enthalten. Dies bedeutet, das alle Services unterhalb dieses Services ebenfalls gelöscht werden.<BR>
|
||||||
Der Default Wert ist (empty) somit werden alle bekannten Services abgefragt.<BR>
|
Der Default Wert ist (empty) somit werden alle bekannten Services abgefragt.<BR>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user