98_MaxScanner.pm :fix: minor changes in Sub FIND

git-svn-id: https://svn.fhem.de/fhem/trunk@10492 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
john99sr 2016-01-13 23:22:34 +00:00
parent d6c408cf25
commit dcf1245cde

View File

@ -1,4 +1,4 @@
# $Id: 98_MaxScanner.pm 10453 2016-01-11 00:00:00Z john $ # $Id$
#################################################################################################### ####################################################################################################
# #
# 98_MaxScanner.pm # 98_MaxScanner.pm
@ -42,7 +42,8 @@
# * change. scanTemp substitues scnEnabled # * change. scanTemp substitues scnEnabled
# 11.01.16 - 1.0.0.0 # 11.01.16 - 1.0.0.0
# * change: limit logging, when window open detected # * change: limit logging, when window open detected
# # 13.01.16 - 1.0.0.1
# * change: FIND, minor changes
#################################################################################################### ####################################################################################################
package main; package main;
use strict; use strict;
@ -52,7 +53,7 @@ use vars qw(%defs);
use vars qw($readingFnAttributes); use vars qw($readingFnAttributes);
use vars qw(%attr); use vars qw(%attr);
use vars qw(%modules); use vars qw(%modules);
my $MaxScanner_Version = "1.0.0.1 - 11.01.2016"; my $MaxScanner_Version = "1.0.0.1 - 13.01.2016";
my $MaxScanner_ModulName = "MaxScanner"; my $MaxScanner_ModulName = "MaxScanner";
# minimal poll-rate for thermostat in minutes given by firmware # minimal poll-rate for thermostat in minutes given by firmware
@ -424,24 +425,32 @@ sub MaxScanner_Find($)
foreach my $aaa ( sort keys %{ $modules{MAX}{defptr} } ) foreach my $aaa ( sort keys %{ $modules{MAX}{defptr} } )
{ {
my $hash = $modules{MAX}{defptr}{$aaa}; my $hash = $modules{MAX}{defptr}{$aaa};
# type must exist
# it seems, that maxlan environment holds some foreign entries
# see http://forum.fhem.de/index.php/topic,11624.msg390975.html#msg390975
if ( !defined( $hash->{type} ) )
{
MaxScanner_Log $modHash, 5, 'missing property type for device: ' . $aaa;
next;
}
# exit if it is not a HeatingThermostat
next if $hash->{type} !~ m/^HeatingThermostat.*/;
# basic properties are reqired # basic properties are reqired
if ( !defined( $hash->{IODev} ) if ( !defined( $hash->{IODev} )
|| !defined( $hash->{NAME} ) || !defined( $hash->{NAME} ) )
|| !defined( $hash->{type} ) )
{ {
MaxScanner_Log $modHash, 1, 'missing basic property for device: ' . $aaa; MaxScanner_Log $modHash, 1, 'missing property IODEV or NAME for device: ' . $aaa;
next; next;
} }
#. #.
# name of the max device # name of the max device
my $name = $hash->{NAME}; my $name = $hash->{NAME};
MaxScanner_Log $modHash, 5, "$name has type " . $hash->{type};
# exit if it is not a HeatingThermostat # MaxScanner_Log $modHash, 5, $name . " is HeatingThermostat";
next if $hash->{type} !~ m/^HeatingThermostat.*/;
MaxScanner_Log $modHash, 5, $name . " is HeatingThermostat";
# thermostat must be enabled for the scanner # thermostat must be enabled for the scanner
if ( AttrVal( $name, $MaxScanner_AttrEnabled, '?' ) ne '1' ) if ( AttrVal( $name, $MaxScanner_AttrEnabled, '?' ) ne '1' )
@ -451,7 +460,7 @@ sub MaxScanner_Find($)
next; next;
} }
MaxScanner_Log $modHash, 5, $name . ' is enabled for scanner'; # MaxScanner_Log $modHash, 5, $name . ' is enabled for scanner';
# check special user attributes, if not exists, create them # check special user attributes, if not exists, create them
my $xattr = AttrVal( $name, 'userattr', '' ); my $xattr = AttrVal( $name, 'userattr', '' );