forcast Datastructure change to HashRef daily and hourly
This commit is contained in:
		@@ -191,13 +191,12 @@ sub Weather_ReturnWithError($$) {
 | 
			
		||||
#     readingsBulkUpdate($hash, "pubDateRemote", $pubDate) if(defined($pubDate));
 | 
			
		||||
#     readingsBulkUpdate($hash, "validity", "stale");
 | 
			
		||||
#     readingsEndUpdate($hash, $doTrigger);
 | 
			
		||||
    print 'In der Return with Error Funktion' . "\n";
 | 
			
		||||
 | 
			
		||||
    readingsBeginUpdate($hash);
 | 
			
		||||
    readingsBulkUpdate($hash, 'lastError', $responseRef->{status});
 | 
			
		||||
    
 | 
			
		||||
    foreach my $r (keys %{$responseRef} ) {
 | 
			
		||||
        readingsBulkUpdate($hash, $r, $responseRef->{$r}) if ($r ne 'status' or ($r ne 'current' and ref($r) ne 'HASH') );
 | 
			
		||||
        readingsBulkUpdate($hash, $r, $responseRef->{$r}) if ( ref($responseRef->{$r}) ne 'HASH' );
 | 
			
		||||
    }
 | 
			
		||||
    readingsBulkUpdate($hash, 'state', 'API Maintainer: ' . $responseRef->{apiMaintainer} .  ' ErrorMsg: ' . $responseRef->{status});
 | 
			
		||||
    readingsEndUpdate($hash, 1);
 | 
			
		||||
@@ -370,7 +369,7 @@ sub Weather_WriteReadings($$) {
 | 
			
		||||
    readingsBulkUpdate($hash, "validity", "up-to-date");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    # current
 | 
			
		||||
    ### current
 | 
			
		||||
    if ( defined($dataRef->{current}) and ref( $dataRef->{current} ) eq 'HASH' ) {
 | 
			
		||||
        while( my ($r,$v) = each %{$dataRef->{current}} ) {
 | 
			
		||||
            readingsBulkUpdate($hash, $r, $v)
 | 
			
		||||
@@ -386,12 +385,39 @@ sub Weather_WriteReadings($$) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    # forecast
 | 
			
		||||
    if (  defined($dataRef->{forecast}) and ref( $dataRef->{forecast} ) eq 'ARRAY'
 | 
			
		||||
    and scalar( @{ $dataRef->{forecast} } ) > 0 )
 | 
			
		||||
    ### forecast
 | 
			
		||||
    if ( ref( $dataRef->{forecast} ) eq 'HASH' ) {
 | 
			
		||||
        ## hourly
 | 
			
		||||
        if (  defined($dataRef->{forecast}->{hourly}) and ref( $dataRef->{forecast}->{hourly} ) eq 'ARRAY'
 | 
			
		||||
        and scalar( @{ $dataRef->{forecast}->{hourly} } ) > 0 )
 | 
			
		||||
        {
 | 
			
		||||
            my $i= 0;
 | 
			
		||||
        foreach my $fc (@{$dataRef->{forecast}}) {
 | 
			
		||||
            foreach my $fc (@{$dataRef->{forecast}->{hourly}}) {
 | 
			
		||||
                $i++;
 | 
			
		||||
                my $f= "hfc" . $i ."_";
 | 
			
		||||
                
 | 
			
		||||
                while( my ($r,$v) = each %{$fc} ) {
 | 
			
		||||
                    readingsBulkUpdate($hash, $f.$r, $v)
 | 
			
		||||
                    if ( ref($dataRef->{$r}) ne 'HASH' and ref($dataRef->{$r}) ne 'ARRAY' );
 | 
			
		||||
                }
 | 
			
		||||
        #         readingsBulkUpdate($hash, $f . "day_of_week", $wdays_txt_i18n{$fc->{day}});
 | 
			
		||||
                readingsBulkUpdate($hash, $f . 'icon',  $iconlist[$dataRef->{forecast}->{hourly}[$i-1]{code}]);
 | 
			
		||||
                if (  defined($dataRef->{forecast}->{hourly}[$i-1]{wind_direction})
 | 
			
		||||
                and defined($dataRef->{forecast}->{hourly}[$i-1]{wind_speed}) )
 | 
			
		||||
                {
 | 
			
		||||
                    my $wdir= degrees_to_direction($dataRef->{forecast}->{hourly}[$i-1]{wind_direction}, @directions_txt_i18n);
 | 
			
		||||
                    readingsBulkUpdate($hash, $f . 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{forecast}->{hourly}[$i-1]{wind_speed} . ' km/h');
 | 
			
		||||
                }
 | 
			
		||||
        #         readingsBulkUpdate($hash, $f . 'day_of_week', $wdays_txt_i18n{substr($dataRef->{forecast}->{hourly}[$i-1]{date},0,3)});
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        ## daily
 | 
			
		||||
        if (  defined($dataRef->{forecast}->{daily}) and ref( $dataRef->{forecast}->{daily} ) eq 'ARRAY'
 | 
			
		||||
            and scalar( @{ $dataRef->{forecast}->{daily} } ) > 0 )
 | 
			
		||||
        {
 | 
			
		||||
            my $i= 0;
 | 
			
		||||
            foreach my $fc (@{$dataRef->{forecast}->{daily}}) {
 | 
			
		||||
                $i++;
 | 
			
		||||
                my $f= "fc" . $i ."_";
 | 
			
		||||
                
 | 
			
		||||
@@ -400,14 +426,15 @@ sub Weather_WriteReadings($$) {
 | 
			
		||||
                    if ( ref($dataRef->{$r}) ne 'HASH' and ref($dataRef->{$r}) ne 'ARRAY' );
 | 
			
		||||
                }
 | 
			
		||||
        #         readingsBulkUpdate($hash, $f . "day_of_week", $wdays_txt_i18n{$fc->{day}});
 | 
			
		||||
            readingsBulkUpdate($hash, $f . 'icon',  $iconlist[$dataRef->{forecast}[$i-1]{code}]);
 | 
			
		||||
            if (  defined($dataRef->{forecast}[$i-1]{wind_direction})
 | 
			
		||||
            and defined($dataRef->{forecast}[$i-1]{wind_speed}) )
 | 
			
		||||
                readingsBulkUpdate($hash, $f . 'icon',  $iconlist[$dataRef->{forecast}->{daily}[$i-1]{code}]);
 | 
			
		||||
                if (  defined($dataRef->{forecast}->{daily}[$i-1]{wind_direction})
 | 
			
		||||
                and defined($dataRef->{forecast}->{daily}[$i-1]{wind_speed}) )
 | 
			
		||||
                {
 | 
			
		||||
                my $wdir= degrees_to_direction($dataRef->{forecast}[$i-1]{wind_direction}, @directions_txt_i18n);
 | 
			
		||||
                readingsBulkUpdate($hash, $f . 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{forecast}[$i-1]{wind_speed} . ' km/h');
 | 
			
		||||
                    my $wdir= degrees_to_direction($dataRef->{forecast}->{daily}[$i-1]{wind_direction}, @directions_txt_i18n);
 | 
			
		||||
                    readingsBulkUpdate($hash, $f . 'wind_condition', 'Wind: ' . $wdir . ' ' . $dataRef->{forecast}->{daily}[$i-1]{wind_speed} . ' km/h');
 | 
			
		||||
                }
 | 
			
		||||
        #         readingsBulkUpdate($hash, $f . 'day_of_week', $wdays_txt_i18n{substr($dataRef->{forecast}->{daily}[$i-1]{date},0,3)});
 | 
			
		||||
            }
 | 
			
		||||
    #         readingsBulkUpdate($hash, $f . 'day_of_week', $wdays_txt_i18n{substr($dataRef->{forecast}[$i-1]{date},0,3)});
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -192,7 +192,7 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
                localtime( $self->{fetchTime} )
 | 
			
		||||
              );
 | 
			
		||||
            $self->{cached}->{timezone} = $data->{timezone};
 | 
			
		||||
            $self->{cached}->{license} = $data->{flags}->{'meteoalarm-license'};
 | 
			
		||||
            $self->{cached}->{license}->{Text} = $data->{flags}->{'meteoalarm-license'};
 | 
			
		||||
            $self->{cached}->{current} = {
 | 
			
		||||
                'temperature' => int(
 | 
			
		||||
                    sprintf( "%.1f", $data->{currently}->{temperature} ) + 0.5
 | 
			
		||||
@@ -205,14 +205,24 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
                ),
 | 
			
		||||
                'humidity'   => $data->{currently}->{humidity} * 100,
 | 
			
		||||
                'condition'  => encode_utf8( $data->{currently}->{summary} ),
 | 
			
		||||
                'pressure'   => $data->{currently}->{pressure},
 | 
			
		||||
                'wind'       => $data->{currently}->{windSpeed},
 | 
			
		||||
                'wind_speed' => $data->{currently}->{windSpeed},
 | 
			
		||||
                'pressure'   => int(
 | 
			
		||||
                    sprintf( "%.1f", $data->{currently}->{pressure} ) + 0.5
 | 
			
		||||
                ),
 | 
			
		||||
                'wind'       => int(
 | 
			
		||||
                    sprintf( "%.1f", $data->{currently}->{windSpeed} ) + 0.5
 | 
			
		||||
                ),
 | 
			
		||||
                'wind_speed' => int(
 | 
			
		||||
                    sprintf( "%.1f", $data->{currently}->{windSpeed} ) + 0.5
 | 
			
		||||
                ),
 | 
			
		||||
                'wind_direction' => $data->{currently}->{windBearing},
 | 
			
		||||
                'windGust'       => $data->{currently}->{windGust},
 | 
			
		||||
                'cloudCover'     => $data->{currently}->{cloudCover},
 | 
			
		||||
                'windGust'       => int(
 | 
			
		||||
                    sprintf( "%.1f", $data->{currently}->{windGust} ) + 0.5
 | 
			
		||||
                ),
 | 
			
		||||
                'cloudCover'     => $data->{currently}->{cloudCover} * 100,
 | 
			
		||||
                'uvIndex'        => $data->{currently}->{uvIndex},
 | 
			
		||||
                'visibility'     => $data->{currently}->{visibility},
 | 
			
		||||
                'visibility'     => int(
 | 
			
		||||
                    sprintf( "%.1f", $data->{currently}->{visibility} ) + 0.5
 | 
			
		||||
                ),
 | 
			
		||||
                'ozone'          => $data->{currently}->{ozone},
 | 
			
		||||
                'code'           => $codes{ $data->{currently}->{icon} },
 | 
			
		||||
                'iconAPI'        => $data->{currently}->{icon},
 | 
			
		||||
@@ -238,7 +248,7 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
                my $i = 0;
 | 
			
		||||
                foreach ( @{ $data->{daily}->{data} } ) {
 | 
			
		||||
                    push(
 | 
			
		||||
                        @{ $self->{cached}->{forecast} },
 | 
			
		||||
                        @{ $self->{cached}->{forecast}->{daily} },
 | 
			
		||||
                        {
 | 
			
		||||
                            'date' => strftime(
 | 
			
		||||
                                "%a, %d.%m.%Y",
 | 
			
		||||
@@ -383,20 +393,34 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
                                      ->{data}->[$i]->{precipIntensityMaxTime}
 | 
			
		||||
                                )
 | 
			
		||||
                            ),
 | 
			
		||||
                            'dewPoint' => $data->{daily}->{data}->[$i]->{dewPoint},
 | 
			
		||||
                            'dewPoint' => int(
 | 
			
		||||
                                sprintf( "%.1f",
 | 
			
		||||
                                    $data->{daily}->{data}->[$i]->{dewPoint}
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                            ),
 | 
			
		||||
                            'humidity' => $data->{daily}->{data}->[$i]->{humidity}
 | 
			
		||||
                              * 100,
 | 
			
		||||
                            'cloudCover' =>
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{cloudCover},
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{cloudCover} * 100,
 | 
			
		||||
                            'precipType' =>
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{precipType},
 | 
			
		||||
 | 
			
		||||
                            'wind_direction' =>
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{windBearing},
 | 
			
		||||
                            'wind' => $data->{daily}->{data}->[$i]->{windSpeed},
 | 
			
		||||
                            'wind_speed' =>
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{windSpeed},
 | 
			
		||||
                            'windGust' => $data->{daily}->{data}->[$i]->{windGust},
 | 
			
		||||
                            'wind' => int(
 | 
			
		||||
                                sprintf( "%.1f",
 | 
			
		||||
                                    $data->{daily}->{data}->[$i]->{windSpeed}
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                            ),
 | 
			
		||||
                            'wind_speed' => int(
 | 
			
		||||
                                sprintf( "%.1f",
 | 
			
		||||
                                    $data->{daily}->{data}->[$i]->{windSpeed}
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                            ),
 | 
			
		||||
                            'windGust' => int(
 | 
			
		||||
                                sprintf( "%.1f",
 | 
			
		||||
                                    $data->{daily}->{data}->[$i]->{windGust}) + 0.5
 | 
			
		||||
                            ),
 | 
			
		||||
                            'windGustTime' => strftime(
 | 
			
		||||
                                "%a,%e %b %Y %H:%M %p",
 | 
			
		||||
                                localtime(
 | 
			
		||||
@@ -420,9 +444,14 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
 | 
			
		||||
                            'precipProbability' =>
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{precipProbability},
 | 
			
		||||
                            'pressure' => $data->{daily}->{data}->[$i]->{pressure},
 | 
			
		||||
                            'visibility' =>
 | 
			
		||||
                              $data->{daily}->{data}->[$i]->{visibility},
 | 
			
		||||
                            'pressure' => int(
 | 
			
		||||
                                sprintf( "%.1f",
 | 
			
		||||
                                    $data->{daily}->{data}->[$i]->{pressure}) + 0.5
 | 
			
		||||
                            ),
 | 
			
		||||
                            'visibility' => int(
 | 
			
		||||
                                sprintf( "%.1f",
 | 
			
		||||
                                    $data->{daily}->{data}->[$i]->{visibility}) + 0.5
 | 
			
		||||
                            ),
 | 
			
		||||
                        }
 | 
			
		||||
                    );
 | 
			
		||||
                    
 | 
			
		||||
 
 | 
			
		||||
@@ -252,38 +252,44 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
                $self->{cached}->{city}    = $data->{name};
 | 
			
		||||
                $self->{cached}->{current} = {
 | 
			
		||||
                    'temperature' => int(
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 ) ) + 0.5
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 )
 | 
			
		||||
                        ) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'temp_c' => int(
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 ) ) + 0.5
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp} - 273.15 )
 | 
			
		||||
                        ) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'low_c' => int(
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_min} - 273.15 ) ) +
 | 
			
		||||
                        0.5
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_min} - 273.15 )
 | 
			
		||||
                        ) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'high_c' => int(
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_max} - 273.15 ) ) +
 | 
			
		||||
                        0.5
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_max} - 273.15 )
 | 
			
		||||
                        ) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'tempLow' => int(
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_min} - 273.15 ) ) +
 | 
			
		||||
                        0.5
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_min} - 273.15 )
 | 
			
		||||
                        ) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'tempHigh' => int(
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_max} - 273.15 ) ) +
 | 
			
		||||
                        0.5
 | 
			
		||||
                        sprintf( "%.1f", ( $data->{main}->{temp_max} - 273.15 ) 
 | 
			
		||||
                        ) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'humidity'   => $data->{main}->{humidity},
 | 
			
		||||
                    'condition'  => encode_utf8( $data->{weather}[0]{description} ),
 | 
			
		||||
                    'pressure'   => $data->{main}->{pressure},
 | 
			
		||||
                    'wind'       => $data->{wind}->{speed},
 | 
			
		||||
                    'wind_speed' => $data->{wind}->{speed},
 | 
			
		||||
                    'condition'  => encode_utf8( $data->{weather}->[0]->{description} ),
 | 
			
		||||
                    'pressure'   => int(sprintf( "%.1f",
 | 
			
		||||
                            $data->{main}->{pressure}) + 0.5
 | 
			
		||||
                    ),
 | 
			
		||||
                    'wind'       => int(sprintf( "%.1f",
 | 
			
		||||
                            $data->{wind}->{speed}) + 0.5 ),
 | 
			
		||||
                    'wind_speed' => int(sprintf( "%.1f",
 | 
			
		||||
                            $data->{wind}->{speed}) + 0.5 ),
 | 
			
		||||
                    'wind_direction' => $data->{wind}->{deg},
 | 
			
		||||
                    'cloudCover'     => $data->{clouds}->{all},
 | 
			
		||||
                    'visibility'     => $data->{visibility},
 | 
			
		||||
 | 
			
		||||
                    'code'           => $codes{ $data->{weather}[0]{id} },
 | 
			
		||||
                    'iconAPI'    => $data->{weather}[0]{icon},
 | 
			
		||||
                    'visibility'     => int(sprintf( "%.1f",
 | 
			
		||||
                            $data->{visibility}) + 0.5 ),
 | 
			
		||||
                    'code'           => $codes{ $data->{weather}->[0]->{id} },
 | 
			
		||||
                    'iconAPI'    => $data->{weather}->[0]->{icon},
 | 
			
		||||
                    'sunsetTime' => strftime(
 | 
			
		||||
                        "%a,%e %b %Y %H:%M %p",
 | 
			
		||||
                        localtime( $data->{sys}->{sunset} )
 | 
			
		||||
@@ -307,44 +313,52 @@ sub _ProcessingRetrieveData($$) {
 | 
			
		||||
                    my $i = 0;
 | 
			
		||||
                    foreach ( @{ $data->{list} } ) {
 | 
			
		||||
                        push(
 | 
			
		||||
                            @{ $self->{cached}->{forecast} },
 | 
			
		||||
                            @{ $self->{cached}->{forecast}->{hourly} },
 | 
			
		||||
                            {
 | 
			
		||||
                                'temperature' => int(
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp} - 273.15 ) ) + 0.5
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}->[$i]->{main}->{temp} - 273.15 )
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'temp_c' => int(
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp} - 273.15 ) ) + 0.5
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}->[$i]->{main}->{temp} - 273.15 )
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'low_c' => int(
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp_min} - 273.15 ) ) +
 | 
			
		||||
                                    0.5
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}->[$i]->{main}->{temp_min} - 273.15 )
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'high_c' => int(
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp_max} - 273.15 ) ) +
 | 
			
		||||
                                    0.5
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}->[$i]->{main}->{temp_max} - 273.15 )
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'tempLow' => int(
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp_min} - 273.15 ) ) +
 | 
			
		||||
                                    0.5
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}->[$i]->{main}->{temp_min} - 273.15 )
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'tempHigh' => int(
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}[$i]{main}->{temp_max} - 273.15 ) ) +
 | 
			
		||||
                                    0.5
 | 
			
		||||
                                    sprintf( "%.1f", ( $data->{list}->[$i]->{main}->{temp_max} - 273.15 )
 | 
			
		||||
                                    ) + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'humidity'   => $data->{list}[$i]{main}->{humidity},
 | 
			
		||||
                                'condition'  => encode_utf8( $data->{list}[$i]{weather}[0]{description} ),
 | 
			
		||||
                                'pressure'   => $data->{list}[$i]{main}->{pressure},
 | 
			
		||||
                                'wind'       => $data->{list}[$i]{wind}->{speed},
 | 
			
		||||
                                'wind_speed' => $data->{list}[$i]{wind}->{speed},
 | 
			
		||||
                                
 | 
			
		||||
                                'cloudCover'     => $data->{list}[$i]{clouds}->{all},
 | 
			
		||||
                                'visibility'     => $data->{visibility},
 | 
			
		||||
                                'code'           => $codes{ $data->{list}[$i]{weather}[0]{id} },
 | 
			
		||||
                                'iconAPI'    => $data->{list}[$i]{weather}[0]{icon},
 | 
			
		||||
                                
 | 
			
		||||
                                'humidity'   => $data->{list}->[$i]->{main}->{humidity},
 | 
			
		||||
                                'condition'  => encode_utf8( $data->{list}->[$i]->{weather}->[0]->{description} ),
 | 
			
		||||
                                'pressure'   => int(sprintf( "%.1f",
 | 
			
		||||
                                        $data->{list}->[$i]->{main}->{pressure})
 | 
			
		||||
                                        + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'wind'       => int(sprintf( "%.1f",
 | 
			
		||||
                                        $data->{list}->[$i]->{wind}->{speed}
 | 
			
		||||
                                        )  + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'wind_speed' => int(sprintf( "%.1f",
 | 
			
		||||
                                        $data->{list}->[$i]->{wind}->{speed}
 | 
			
		||||
                                        )  + 0.5
 | 
			
		||||
                                ),
 | 
			
		||||
                                'cloudCover'     => $data->{list}->[$i]->{clouds}->{all},
 | 
			
		||||
                                'code'           => $codes{ $data->{list}->[$i]->{weather}->[0]->{id} },
 | 
			
		||||
                                'iconAPI'    => $data->{list}->[$i]->{weather}->[0]->{icon},
 | 
			
		||||
                                'pubDate' =>
 | 
			
		||||
                                strftime( "%a,%e %b %Y %H:%M %p", localtime( ($data->{list}[$i]{dt}) - 3600 ) ),
 | 
			
		||||
                            }
 | 
			
		||||
                                    strftime( "%a,%e %b %Y %H:%M %p", localtime( ($data->{list}->[$i]->{dt}) - 3600 ) ),
 | 
			
		||||
                            },
 | 
			
		||||
                        );
 | 
			
		||||
                        
 | 
			
		||||
                        $i++;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user