fix onecall update,
remove weather endpoint
This commit is contained in:
parent
3d8a1d72e5
commit
96ce411948
@ -421,141 +421,57 @@ sub _ProcessingRetrieveData {
|
||||
localtime( $self->{fetchTime} ) );
|
||||
|
||||
given ( $self->{endpoint} ) {
|
||||
when ('weather') {
|
||||
$self->{cached}->{country} = $data->{sys}->{country};
|
||||
$self->{cached}->{city} = encode_utf8( $data->{name} );
|
||||
$self->{cached}->{license}{text} = 'none';
|
||||
$self->{cached}->{current} = {
|
||||
'temperature' => int(
|
||||
sprintf( "%.1f", $data->{main}->{temp} ) + 0.5
|
||||
),
|
||||
'temp_c' => int(
|
||||
sprintf( "%.1f", $data->{main}->{temp} ) + 0.5
|
||||
),
|
||||
'low_c' => int(
|
||||
sprintf( "%.1f", $data->{main}->{temp_min} ) +
|
||||
0.5
|
||||
),
|
||||
'high_c' => int(
|
||||
sprintf( "%.1f", $data->{main}->{temp_max} ) +
|
||||
0.5
|
||||
),
|
||||
'tempLow' => int(
|
||||
sprintf( "%.1f", $data->{main}->{temp_min} ) +
|
||||
0.5
|
||||
),
|
||||
'tempHigh' => int(
|
||||
sprintf( "%.1f", $data->{main}->{temp_max} ) +
|
||||
0.5
|
||||
),
|
||||
'tempFeelsLike_c' => int(
|
||||
sprintf( "%.1f", $data->{main}->{feels_like} )
|
||||
+ 0.5
|
||||
),
|
||||
'humidity' => $data->{main}->{humidity},
|
||||
'condition' => encode_utf8(
|
||||
$data->{weather}->[0]->{description}
|
||||
),
|
||||
'pressure' => int(
|
||||
sprintf( "%.1f", $data->{main}->{pressure} ) +
|
||||
0.5
|
||||
),
|
||||
'wind' => int(
|
||||
sprintf( "%.1f",
|
||||
( $data->{wind}->{speed} * 3.6 ) ) + 0.5
|
||||
),
|
||||
'wind_speed' => int(
|
||||
sprintf( "%.1f",
|
||||
( $data->{wind}->{speed} * 3.6 ) ) + 0.5
|
||||
),
|
||||
'wind_gust' => int(
|
||||
sprintf( "%.1f",
|
||||
( $data->{wind}->{gust} * 3.6 ) ) + 0.5
|
||||
),
|
||||
'wind_direction' => $data->{wind}->{deg},
|
||||
'rain_1h' => $data->{rain}->{'1h'},
|
||||
'cloudCover' => $data->{clouds}->{all},
|
||||
'code' => $codes{ $data->{weather}->[0]->{id} },
|
||||
'iconAPI' => $data->{weather}->[0]->{icon},
|
||||
'sunsetTime' => strftimeWrapper(
|
||||
"%a, %e %b %Y %H:%M",
|
||||
localtime( $data->{sys}->{sunset} )
|
||||
),
|
||||
'sunriseTime' => strftimeWrapper(
|
||||
"%a, %e %b %Y %H:%M",
|
||||
localtime( $data->{sys}->{sunrise} )
|
||||
),
|
||||
'pubDate' => strftimeWrapper(
|
||||
"%a, %e %b %Y %H:%M",
|
||||
localtime( $data->{dt} )
|
||||
),
|
||||
'visibility' => int(
|
||||
sprintf( "%.1f", $data->{visibility} ) + 0.5
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
when ('onecall') {
|
||||
if ( !exists( $self->{cached}->{current} ) ) {
|
||||
$self->{cached}->{current} = {
|
||||
'temperature' => int(
|
||||
sprintf( "%.1f", $data->{current}->{temp} )
|
||||
+ 0.5
|
||||
sprintf( "%.1f", $data->{current}->{temp} ) +
|
||||
0.5
|
||||
),
|
||||
'temp_c' => int(
|
||||
sprintf( "%.1f", $data->{current}->{temp} )
|
||||
+ 0.5
|
||||
sprintf( "%.1f", $data->{current}->{temp} ) +
|
||||
0.5
|
||||
),
|
||||
'tempFeelsLike_c' => int(
|
||||
sprintf( "%.1f",
|
||||
$data->{current}->{feels_like} ) + 0.5
|
||||
),
|
||||
'dew_point' => int(
|
||||
sprintf( "%.1f",
|
||||
$data->{current}->{dew_point} ) + 0.5
|
||||
sprintf(
|
||||
"%.1f", $data->{current}->{dew_point}
|
||||
) + 0.5
|
||||
),
|
||||
'humidity' => $data->{current}->{humidity},
|
||||
'condition' => encode_utf8(
|
||||
$data->{current}->{weather}->[0]
|
||||
->{description}
|
||||
$data->{current}->{weather}->[0]->{description}
|
||||
),
|
||||
'pressure' => int(
|
||||
sprintf( "%.1f",
|
||||
$data->{current}->{pressure} ) + 0.5
|
||||
sprintf( "%.1f", $data->{current}->{pressure} )
|
||||
+ 0.5
|
||||
),
|
||||
'wind' => int(
|
||||
sprintf(
|
||||
"%.1f",
|
||||
(
|
||||
$data->{current}->{wind_speed} * 3.6
|
||||
)
|
||||
) + 0.5
|
||||
sprintf( "%.1f",
|
||||
( $data->{current}->{wind_speed} * 3.6 ) )
|
||||
+ 0.5
|
||||
),
|
||||
'wind_speed' => int(
|
||||
sprintf(
|
||||
"%.1f",
|
||||
(
|
||||
$data->{current}->{wind_speed} * 3.6
|
||||
)
|
||||
) + 0.5
|
||||
sprintf( "%.1f",
|
||||
( $data->{current}->{wind_speed} * 3.6 ) )
|
||||
+ 0.5
|
||||
),
|
||||
'wind_gust' => int(
|
||||
sprintf( "%.1f",
|
||||
( $data->{current}->{wind_gust} * 3.6 )
|
||||
) + 0.5
|
||||
( $data->{current}->{wind_gust} * 3.6 ) ) +
|
||||
0.5
|
||||
),
|
||||
'wind_direction' =>
|
||||
$data->{current}->{wind_deg},
|
||||
'wind_direction' => $data->{current}->{wind_deg},
|
||||
'rain_1h' => $data->{rain}->{'1h'},
|
||||
'cloudCover' => $data->{current}->{clouds},
|
||||
'code' => $codes{
|
||||
$data->{current}->{weather}->[0]->{id}
|
||||
},
|
||||
'code' =>
|
||||
$codes{ $data->{current}->{weather}->[0]->{id} },
|
||||
'iconAPI' =>
|
||||
$data->{current}->{weather}->[0]->{icon},
|
||||
'condition' => encode_utf8(
|
||||
$data->{current}->{weather}->[0]
|
||||
->{description}
|
||||
$data->{current}->{weather}->[0]->{description}
|
||||
),
|
||||
'sunsetTime' => strftimeWrapper(
|
||||
"%a, %e %b %Y %H:%M",
|
||||
@ -575,7 +491,6 @@ sub _ProcessingRetrieveData {
|
||||
),
|
||||
'uvi' => $data->{current}->{uvi},
|
||||
};
|
||||
}
|
||||
|
||||
if ( ref( $data->{hourly} ) eq "ARRAY"
|
||||
&& scalar( @{ $data->{hourly} } ) > 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user