mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
38_netatmo: fix uninitialized log variables
git-svn-id: https://svn.fhem.de/fhem/trunk@16304 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8bbdb933f4
commit
abf2d6c119
@ -38,7 +38,6 @@ my %health_index = ( 0 => "healthy",
|
|||||||
4 => "unhealthy",
|
4 => "unhealthy",
|
||||||
5 => "unknown", );
|
5 => "unknown", );
|
||||||
|
|
||||||
|
|
||||||
sub
|
sub
|
||||||
netatmo_Initialize($)
|
netatmo_Initialize($)
|
||||||
{
|
{
|
||||||
@ -441,7 +440,6 @@ netatmo_Define($$)
|
|||||||
|
|
||||||
$hash->{NOTIFYDEV} = "global";
|
$hash->{NOTIFYDEV} = "global";
|
||||||
|
|
||||||
|
|
||||||
if( $init_done ) {
|
if( $init_done ) {
|
||||||
netatmo_connect($hash) if( $hash->{SUBTYPE} eq "ACCOUNT" );
|
netatmo_connect($hash) if( $hash->{SUBTYPE} eq "ACCOUNT" );
|
||||||
netatmo_initDevice($hash) if( $hash->{SUBTYPE} eq "DEVICE" );
|
netatmo_initDevice($hash) if( $hash->{SUBTYPE} eq "DEVICE" );
|
||||||
@ -1655,7 +1653,7 @@ netatmo_requestDeviceReadings($@)
|
|||||||
|
|
||||||
return undef if( !defined($hash->{IODev}) );
|
return undef if( !defined($hash->{IODev}) );
|
||||||
|
|
||||||
Log3 $name, 5, "$name: requestDeviceReadings start ($id $type $module)";
|
Log3 $name, 5, "$name: requestDeviceReadings ($id ".(!$type?"-":$type)." ".(!$module?"-":$module).")";
|
||||||
|
|
||||||
my $iohash = $hash->{IODev};
|
my $iohash = $hash->{IODev};
|
||||||
$type = $hash->{dataTypes} if( !$type );
|
$type = $hash->{dataTypes} if( !$type );
|
||||||
@ -3327,7 +3325,7 @@ netatmo_parseReadings($$;$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( $json ) {
|
if( $json ) {
|
||||||
$hash->{status} = $json->{status};
|
$hash->{status} = $json->{status} if($json->{status});
|
||||||
$hash->{status} = $json->{error}{message} if( $json->{error} );
|
$hash->{status} = $json->{error}{message} if( $json->{error} );
|
||||||
|
|
||||||
my $lastupdate = ReadingsVal( $name, ".lastupdate", 0 );
|
my $lastupdate = ReadingsVal( $name, ".lastupdate", 0 );
|
||||||
@ -3369,21 +3367,21 @@ netatmo_parseReadings($$;$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(($rname eq "noise" && int($reading) > 150) || ($rname eq "temperature" && int($reading) > 60) || ($rname eq "humidity" && int($reading) > 100) || ($rname eq "pressure" && int($reading) < 500))
|
if($reading ne "undefined" && (($rname eq "noise" && int($reading) > 150) || ($rname eq "temperature" && int($reading) > 60) || ($rname eq "humidity" && int($reading) > 100) || ($rname eq "pressure" && int($reading) < 500)))
|
||||||
{
|
{
|
||||||
Log3 $name, 1, "$name netatmo - invalid reading: $rname: ".Dumper($reading)." \n ".Dumper($reading_names);
|
Log3 $name, 1, "$name netatmo - invalid reading: $rname: ".Dumper($reading)." \n ".Dumper($reading_names);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rname eq "health_idx"){
|
if($reading ne "undefined" && $rname eq "health_idx"){
|
||||||
$reading = $health_index{$reading};
|
$reading = $health_index{$reading};
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rname =~ /temperature/){
|
if($reading ne "undefined" && $rname =~ /temperature/){
|
||||||
$reading = sprintf( "%.1f", $reading);
|
$reading = sprintf( "%.1f", $reading);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rname eq "rain" && $reading > 0)
|
if($reading ne "undefined" && $rname eq "rain" && $reading > 0)
|
||||||
{
|
{
|
||||||
my $rain_sum = ReadingsVal($name,"rain_sum",0);
|
my $rain_sum = ReadingsVal($name,"rain_sum",0);
|
||||||
$rain_sum += $reading;
|
$rain_sum += $reading;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user