publish forecast data in OpenWeatherMap, code change in 59_Weather, change response data structure for Weather Modul

This commit is contained in:
Marko Oldenburg
2019-01-10 09:30:26 +01:00
parent c49d955687
commit 5b95ea31e4
3 changed files with 86 additions and 93 deletions

View File

@@ -297,14 +297,17 @@ sub _ProcessingRetrieveData($$) {
};
}
if ( $self->{endpoint} eq 'forecas' ) {
my $i = 0;
if ( $self->{endpoint} eq 'forecast' ) {
if ( ref( $data->{list} ) eq "ARRAY"
and scalar( @{ $data->{list} } ) > 0 )
{
## löschen des alten Datensatzes
delete $self->{cached}->{forecast};
my $i = 0;
foreach ( @{ $data->{list} } ) {
push(
@{ $self->{cached}->{forecast}->{daily} },
@{ $self->{cached}->{forecast} },
{
'temperature' => int(
sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp} - 273.15 ) ) + 0.5
@@ -340,7 +343,7 @@ sub _ProcessingRetrieveData($$) {
'iconAPI' => $data->{list}[$i]{weather}[0]{icon},
'pubDate' =>
strftime( "%a,%e %b %Y %H:%M %p", localtime( $data->{list}[$i]{dt} ) ),
strftime( "%a,%e %b %Y %H:%M %p", localtime( ($data->{list}[$i]{dt}) - 3600 ) ),
}
);