code style
This commit is contained in:
parent
cb3f5c1ecb
commit
cc25c68125
@ -208,7 +208,8 @@ sub new {
|
|||||||
$self->{cachemaxage} = (
|
$self->{cachemaxage} = (
|
||||||
defined( $apioptions->{cachemaxage} )
|
defined( $apioptions->{cachemaxage} )
|
||||||
? $apioptions->{cachemaxage}
|
? $apioptions->{cachemaxage}
|
||||||
: 900 );
|
: 900
|
||||||
|
);
|
||||||
$self->{cached} = _CreateForecastRef($self);
|
$self->{cached} = _CreateForecastRef($self);
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
@ -247,7 +248,7 @@ sub setRetrieveData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub setLocation {
|
sub setLocation {
|
||||||
my ($self,$lat,$long) = @_;
|
my ( $self, $lat, $long ) = @_;
|
||||||
|
|
||||||
$self->{lat} = $lat;
|
$self->{lat} = $lat;
|
||||||
$self->{long} = $long;
|
$self->{long} = $long;
|
||||||
@ -273,8 +274,7 @@ sub _RetrieveDataFromOpenWeatherMap {
|
|||||||
# retrieve data from cache
|
# retrieve data from cache
|
||||||
if ( ( time() - $self->{fetchTime} ) < $self->{cachemaxage}
|
if ( ( time() - $self->{fetchTime} ) < $self->{cachemaxage}
|
||||||
and $self->{cached}->{lat} == $self->{lat}
|
and $self->{cached}->{lat} == $self->{lat}
|
||||||
and $self->{cached}->{long} == $self->{long}
|
and $self->{cached}->{long} == $self->{long} )
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return _CallWeatherCallbackFn($self);
|
return _CallWeatherCallbackFn($self);
|
||||||
}
|
}
|
||||||
@ -441,7 +441,8 @@ sub _ProcessingRetrieveData {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
$self->{cached}->{current}->{'visibility'} = int(sprintf( "%.1f", $data->{visibility} ) + 0.5)
|
$self->{cached}->{current}->{'visibility'} =
|
||||||
|
int( sprintf( "%.1f", $data->{visibility} ) + 0.5 )
|
||||||
if ( exists $data->{visibility} );
|
if ( exists $data->{visibility} );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,7 +617,8 @@ sub _CreateForecastRef {
|
|||||||
long => $self->{long},
|
long => $self->{long},
|
||||||
apiMaintainer =>
|
apiMaintainer =>
|
||||||
'Leon Gaultier (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)',
|
'Leon Gaultier (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)',
|
||||||
apiVersion => version->parse(OpenWeatherMapAPI->VERSION())->normal,
|
apiVersion =>
|
||||||
|
version->parse( OpenWeatherMapAPI->VERSION() )->normal,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -646,7 +648,6 @@ sub strftimeWrapper {
|
|||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
|
||||||
=encoding utf8
|
=encoding utf8
|
||||||
|
Loading…
x
Reference in New Issue
Block a user