mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
38_netatmo: fixed blocking connection check on dns error
git-svn-id: https://svn.fhem.de/fhem/trunk@14411 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1d64f75c71
commit
c677303aa6
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 38_netatmo: fixed blocking connection check on dns error
|
||||||
- change: 02_RSS: height/width for rect layout directive
|
- change: 02_RSS: height/width for rect layout directive
|
||||||
- change: 34_ESPEasy: performance tuning, some fixes
|
- change: 34_ESPEasy: performance tuning, some fixes
|
||||||
- feature: 74_Unifi.pm: added get poeMode and set poeState commands
|
- feature: 74_Unifi.pm: added get poeMode and set poeState commands
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# Release 11 / 2017-04-14
|
# Release 12 / 2017-05-29
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
@ -850,6 +850,25 @@ netatmo_parseConnection($$$)
|
|||||||
|
|
||||||
if( $err ) {
|
if( $err ) {
|
||||||
Log3 $name, 1, "$name: connection check failed: $err";
|
Log3 $name, 1, "$name: connection check failed: $err";
|
||||||
|
|
||||||
|
if($err =~ /refused/ ){
|
||||||
|
RemoveInternalTimer($hash);
|
||||||
|
$hash->{status} = "banned";
|
||||||
|
$hash->{network} = "banned";
|
||||||
|
}
|
||||||
|
elsif($err =~ /Bad hostname/ || $err =~ /gethostbyname/){
|
||||||
|
$hash->{status} = "timeout";
|
||||||
|
$hash->{network} = "dns";
|
||||||
|
}
|
||||||
|
elsif($err =~ /timed out/){
|
||||||
|
$hash->{status} = "timeout";
|
||||||
|
$hash->{network} = "timeout";
|
||||||
|
}
|
||||||
|
elsif($err =~ /Can't connect/){
|
||||||
|
$hash->{status} = "timeout";
|
||||||
|
$hash->{network} = "disconnected";
|
||||||
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
} elsif( $data ) {
|
} elsif( $data ) {
|
||||||
$data =~ s/\n//g;
|
$data =~ s/\n//g;
|
||||||
@ -2226,14 +2245,14 @@ netatmo_poll($)
|
|||||||
|
|
||||||
if( $hash->{SUBTYPE} eq "ACCOUNT" && defined($hash->{network}) && $hash->{network} eq "timeout" ) {
|
if( $hash->{SUBTYPE} eq "ACCOUNT" && defined($hash->{network}) && $hash->{network} eq "timeout" ) {
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer(gettimeofday()+120, "netatmo_poll", $hash);
|
InternalTimer(gettimeofday()+300, "netatmo_poll", $hash);
|
||||||
$hash->{status} = "recovering timeout";
|
$hash->{status} = "recovering timeout";
|
||||||
netatmo_checkConnection($hash);
|
netatmo_checkConnection($hash);
|
||||||
readingsSingleUpdate( $hash, "active", $hash->{status}, 1 ) if($hash->{status} ne "no data");
|
readingsSingleUpdate( $hash, "active", $hash->{status}, 1 ) if($hash->{status} ne "no data");
|
||||||
return undef;
|
return undef;
|
||||||
} elsif( $hash->{SUBTYPE} eq "ACCOUNT" && defined($hash->{network}) && $hash->{network} ne "ok" ) {
|
} elsif( $hash->{SUBTYPE} eq "ACCOUNT" && defined($hash->{network}) && $hash->{network} ne "ok" ) {
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer(gettimeofday()+120, "netatmo_poll", $hash);
|
InternalTimer(gettimeofday()+600, "netatmo_poll", $hash);
|
||||||
$hash->{status} = "recovering network";
|
$hash->{status} = "recovering network";
|
||||||
netatmo_checkConnection($hash);
|
netatmo_checkConnection($hash);
|
||||||
readingsSingleUpdate( $hash, "active", $hash->{status}, 1 ) if($hash->{status} ne "no data");
|
readingsSingleUpdate( $hash, "active", $hash->{status}, 1 ) if($hash->{status} ne "no data");
|
||||||
@ -2241,9 +2260,9 @@ netatmo_poll($)
|
|||||||
return undef;
|
return undef;
|
||||||
} elsif( $hash->{SUBTYPE} ne "ACCOUNT" && defined($hash->{IODev}->{network}) && $hash->{IODev}->{network} ne "ok" ) {
|
} elsif( $hash->{SUBTYPE} ne "ACCOUNT" && defined($hash->{IODev}->{network}) && $hash->{IODev}->{network} ne "ok" ) {
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer(gettimeofday()+120, "netatmo_poll", $hash);
|
InternalTimer(gettimeofday()+150, "netatmo_poll", $hash);
|
||||||
$hash->{status} = "delayed update";
|
$hash->{status} = "delayed update";
|
||||||
netatmo_checkConnection($hash->{IODev});
|
#netatmo_checkConnection($hash->{IODev});
|
||||||
readingsSingleUpdate( $hash, "active", $hash->{status}, 1 ) if($hash->{status} ne "no data");
|
readingsSingleUpdate( $hash, "active", $hash->{status}, 1 ) if($hash->{status} ne "no data");
|
||||||
Log3 $name, 5, "$name: DEVICE network error: ".$hash->{IODev}->{network};
|
Log3 $name, 5, "$name: DEVICE network error: ".$hash->{IODev}->{network};
|
||||||
return undef;
|
return undef;
|
||||||
@ -2323,9 +2342,9 @@ netatmo_dispatch($$$)
|
|||||||
$hash->{expires_at} = int(gettimeofday()) if($hash->{SUBTYPE} eq "ACCOUNT");
|
$hash->{expires_at} = int(gettimeofday()) if($hash->{SUBTYPE} eq "ACCOUNT");
|
||||||
$hash->{IODev}->{expires_at} = int(gettimeofday()) if($hash->{SUBTYPE} ne "ACCOUNT");
|
$hash->{IODev}->{expires_at} = int(gettimeofday()) if($hash->{SUBTYPE} ne "ACCOUNT");
|
||||||
}
|
}
|
||||||
elsif($err =~ /Bad hostname/){
|
elsif($err =~ /Bad hostname/ || $err =~ /gethostbyname/){
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer(gettimeofday()+300, "netatmo_poll", $hash);
|
InternalTimer(gettimeofday()+600, "netatmo_poll", $hash);
|
||||||
$hash->{status} = "timeout";
|
$hash->{status} = "timeout";
|
||||||
$hash->{network} = "dns" if($hash->{SUBTYPE} eq "ACCOUNT");
|
$hash->{network} = "dns" if($hash->{SUBTYPE} eq "ACCOUNT");
|
||||||
}
|
}
|
||||||
@ -3093,10 +3112,9 @@ netatmo_parseReadings($$;$)
|
|||||||
Log3 $name, 3, "$name: next extended dynamic update ($requested) at ".FmtDateTime($nextdata);
|
Log3 $name, 3, "$name: next extended dynamic update ($requested) at ".FmtDateTime($nextdata);
|
||||||
} else {
|
} else {
|
||||||
Log3 $name, 2, "$name: invalid time for dynamic update ($requested): ".FmtDateTime($nextdata);
|
Log3 $name, 2, "$name: invalid time for dynamic update ($requested): ".FmtDateTime($nextdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user