38_netatmo.pm: fixed error crash

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13495 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
moises 2017-02-23 18:52:00 +00:00
parent c6d2f6f991
commit 4f097573fd
2 changed files with 6 additions and 5 deletions

View File

@ -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.pm: fixed error crash
- update: 32_withings.pm: added unknown values for body scale - update: 32_withings.pm: added unknown values for body scale
- update: 98_DOIFtools: add CSRF-Token, add DOIFtoolsLogDir - update: 98_DOIFtools: add CSRF-Token, add DOIFtoolsLogDir
- bugfix: 38_netatmo.pm: fixed login crash, updated webhooks - bugfix: 38_netatmo.pm: fixed login crash, updated webhooks

View File

@ -2017,14 +2017,14 @@ netatmo_dispatch($$$)
Log3 $name, 6, Dumper($json); Log3 $name, 6, Dumper($json);
if( $json->{error} ) { if( $json->{error} ) {
if($json->{error} =~ /invalid_grant/) if(ref($json->{error}) ne "HASH") {
{ $hash->{STATE} = "LOGIN FAILED" if($hash->{SUBTYPE} eq "ACCOUNT");
$hash->{status} = "invalid grant"; $hash->{status} = $json->{error};
$hash->{STATE} = "LOGIN FAILED"; Log3 $name, 2, "$name: message error: ".$json->{error};
return undef; return undef;
} }
$hash->{status} = $json->{error}{message}; $hash->{status} = $json->{error}{message} if(defined($json->{error}{message}));
InternalTimer(gettimeofday()+1800, "netatmo_poll", $hash, 0) if($hash->{status} =~ /usage/); InternalTimer(gettimeofday()+1800, "netatmo_poll", $hash, 0) if($hash->{status} =~ /usage/);
return undef if($hash->{status} =~ /usage/); return undef if($hash->{status} =~ /usage/);