2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

38_netatmo: fixed changed values and deprecated API calls

git-svn-id: https://svn.fhem.de/fhem/trunk@17375 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
moises 2018-09-19 22:19:51 +00:00
parent 605c030623
commit f33ddf2581
2 changed files with 14 additions and 4 deletions

View File

@ -1,5 +1,6 @@
# 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.
- bugfix: 38_netatmo: fixed changed values and deprecated API calls
- bugfix: 93_DbLog: 3.12.1, crash if SVG called (forum:#91285)
- change: 32_withings: API endpoint changed back to Withings servers
- bugfix: 93_DbLog: 3.12.0, SVG-select corrected

View File

@ -894,11 +894,15 @@ netatmo_checkConnection($)
Log3 $name, 3, "$name: refreshing connection information";
my $json = '{"limit":2,"divider":3,"zoom":18,"lat_ne":0.1,"lon_ne":-0.1,"lat_sw":0.1,"lon_sw":-0.1,"date_end":"last","quality":1}';
HttpUtils_NonblockingGet({
url => "https://".$hash->{helper}{apiserver}."/api/readtimeline",
url => "https://".$hash->{helper}{apiserver}."/api/getpublicmeasures",
method => "POST",
timeout => 5,
header => "Content-Type: application/json\r\nAuthorization: Bearer ".$hash->{access_token},
hash => $hash,
data => $json,
callback => \&netatmo_parseConnection,
});
return undef;
@ -945,7 +949,12 @@ netatmo_parseConnection($$$)
Log3 $name, 2, "$name: invalid json evaluation on connection check ".$@;
return undef;
}
$hash->{network} = "ok" if($json->{status} eq "ok");
if(!defined($json->{status})) {
Log3 $name, 2, "$name: invalid json data on connection check: \n".$data;
} else {
Log3 $name, 4, "$name: connection check: \n".$data;
$hash->{network} = "ok" if($json->{status} eq "ok");
}
}
return undef;
}
@ -3105,7 +3114,7 @@ netatmo_autocreatehomecoach($;$)
if($cmdret) {
Log3 $name, 1, "$name: Autocreate: An error occurred while creating device for id '$id': $cmdret";
} else {
$cmdret= CommandAttr(undef,"$devname alias ".encode_utf8($device->{name})) if( defined($device->{name}) );
$cmdret= CommandAttr(undef,"$devname alias ".encode_utf8($device->{station_name})) if( defined($device->{station_name}) );
$cmdret= CommandAttr(undef,"$devname room netatmo");
$cmdret= CommandAttr(undef,"$devname IODev $name");
$cmdret= CommandAttr(undef,"$devname devStateIcon .*:no-icon");
@ -5824,7 +5833,7 @@ netatmo_Get($$@)
my $ret;
foreach my $homecoach (@{$homecoachs}) {
$ret .= "\n" if( $ret );
$ret .= "$homecoach->{_id}\t$homecoach->{firmware}\t$homecoach->{type}\t$homecoach->{name}";
$ret .= "$homecoach->{_id}\t$homecoach->{firmware}\t$homecoach->{type}\t$homecoach->{station_name}";
}
$ret = "id\t\t\tfw\ttype\t name\n" . $ret if( $ret );