Merge pull request #5 from fhem/jpawlowski-WU

Update to version v1.0.0
This commit is contained in:
Leon Gaultier 2019-06-07 21:08:50 +02:00 committed by GitHub
commit 487aee60dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -326,7 +326,6 @@ sub _ProcessingRetrieveData($$) {
{ {
if ( $response =~ m/^\{.*\}$/ ) { if ( $response =~ m/^\{.*\}$/ ) {
my $data = eval { decode_json( encode_utf8($response) ) }; my $data = eval { decode_json( encode_utf8($response) ) };
if ($@) { if ($@) {
_ErrorHandling( $self, _ErrorHandling( $self,
'Weather Underground decode JSON err ' . $@ ); 'Weather Underground decode JSON err ' . $@ );
@ -425,15 +424,20 @@ sub _ProcessingRetrieveData($$) {
}; };
} }
if ( ref( $data->{daily} ) eq "HASH" if (
and scalar keys %{ $data->{daily} } > 0 (
and ref( $data->{daily}{temperatureMin} ) eq "ARRAY" ref( $data->{temperatureMin} ) eq "ARRAY"
and scalar @{ $data->{daily}{temperatureMin} } > 0 ) and scalar @{ $data->{temperatureMin} } > 0
)
|| ( ref( $data->{daily}{temperatureMin} ) eq "ARRAY"
and scalar @{ $data->{daily}{temperatureMin} } > 0 )
)
{ {
### löschen des alten Datensatzes ### löschen des alten Datensatzes
delete $self->{cached}{forecast}; delete $self->{cached}{forecast};
my $data = $data->{daily}; my $data =
exists( $data->{daily} ) ? $data->{daily} : $data;
my $days = scalar @{ $data->{temperatureMin} }; my $days = scalar @{ $data->{temperatureMin} };
my $i = 0; my $i = 0;
@ -614,10 +618,7 @@ sub _ProcessingRetrieveData($$) {
} }
push( push(
@{ @{ $self->{cached}{forecast}{hourly} },
$self->{cached}{forecast}{daypart}[$day]
{$part}
},
{ {
'cloudCover' => $data->{cloudCover}[$i], 'cloudCover' => $data->{cloudCover}[$i],
'dayOrNight' => $data->{dayOrNight}[$i], 'dayOrNight' => $data->{dayOrNight}[$i],
@ -658,7 +659,7 @@ sub _ProcessingRetrieveData($$) {
'wxPhraseShort' => 'wxPhraseShort' =>
$data->{wxPhraseShort}[$i], $data->{wxPhraseShort}[$i],
} }
); ) if ( defined( $data->{temperature}[$i] ) );
$i++; $i++;
$day++ if ( $part eq 'night' ); $day++ if ( $part eq 'night' );
@ -743,8 +744,7 @@ sub strftimeWrapper(@) {
"abstract": "Wetter API für Weather Underground" "abstract": "Wetter API für Weather Underground"
} }
}, },
"version": "v0.0.3", "version": "v1.0.0",
"release_status": "testing",
"author": [ "author": [
"Julian Pawlowski <julian.pawlowski@gmail.com>" "Julian Pawlowski <julian.pawlowski@gmail.com>"
], ],