2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-15 03:59:11 +00:00

OpenWeatherMapAPI: add snow and rain in forecast, 59_Weather: fix double Reading value

git-svn-id: https://svn.fhem.de/fhem/trunk@18267 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2019-01-15 14:14:11 +00:00
parent b18414aade
commit 147112d1e7
3 changed files with 16 additions and 8 deletions

View File

@ -1,5 +1,7 @@
# 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: 59_Weather: fix reading double value
- feature: OpenWeatherMapAPI: add snow and rain in forecast
- new: 98_todoist: initial release
- change: 49_SSCam: generate event of every LastSnapFilename,LastSnapId,
LastSnapTime if snap was called with arguments,

View File

@ -206,9 +206,6 @@ sub Weather_WriteReadings($$) {
readingsBulkUpdate($hash, '.license', $dataRef->{license}->{text});
}
readingsBulkUpdate($hash, "validity", "up-to-date");
### current
if ( defined($dataRef->{current}) and ref( $dataRef->{current} ) eq 'HASH' ) {
while( my ($r,$v) = each %{$dataRef->{current}} ) {

View File

@ -259,7 +259,8 @@ sub _ProcessingRetrieveData($$) {
_ErrorHandling( $self, $data->{cod} . ': ' . $data->{message} );
}
else {
### Debug
# print 'Response: ' . Dumper $data;
###### Ab hier wird die ResponseHash Referenze für die Rückgabe zusammen gestellt
$self->{cached}->{current_date_time} =
strftime( "%a, %e %b %Y %H:%M",
@ -403,7 +404,7 @@ sub _ProcessingRetrieveData($$) {
) + 0.5
),
'humidity' =>
$data->{list}->[$i]->{main}->{humidity},
$data->{list}->[$i]->{main}->{humidity},
'condition' => encode_utf8(
$data->{list}->[$i]->{weather}->[0]
->{description}
@ -424,12 +425,20 @@ sub _ProcessingRetrieveData($$) {
+ 0.5
),
'cloudCover' =>
$data->{list}->[$i]->{clouds}->{all},
$data->{list}->[$i]->{clouds}->{all},
'code' =>
$codes{ $data->{list}->[$i]->{weather}->[0]
$codes{ $data->{list}->[$i]->{weather}->[0]
->{id} },
'iconAPI' =>
$data->{list}->[$i]->{weather}->[0]->{icon},
$data->{list}->[$i]->{weather}->[0]->{icon},
'rain1h' =>
$data->{list}->[$i]->{rain}->{'1h'},
'rain3h' =>
$data->{list}->[$i]->{rain}->{'3h'},
'snow1h' =>
$data->{list}->[$i]->{snow}->{'1h'},
'snow3h' =>
$data->{list}->[$i]->{snow}->{'3h'},
},
);