Merge pull request #7 from fhem/patch-wu
add support for set weather newLocation, temorary location change
This commit is contained in:
commit
7885ec01bd
@ -172,6 +172,15 @@ sub setRetrieveData {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub setLocation {
|
||||||
|
my ($self,$lat,$long) = @_;
|
||||||
|
|
||||||
|
$self->{lat} = $lat;
|
||||||
|
$self->{long} = $long;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub getFetchTime {
|
sub getFetchTime {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
@ -188,10 +197,19 @@ sub _RetrieveDataFromWU($) {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
# 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}->{long} == $self->{long}
|
||||||
|
)
|
||||||
|
{
|
||||||
return _CallWeatherCallbackFn($self);
|
return _CallWeatherCallbackFn($self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$self->{cached}->{lat} = $self->{lat}
|
||||||
|
unless ( $self->{cached}->{lat} == $self->{lat} );
|
||||||
|
$self->{cached}->{long} = $self->{long}
|
||||||
|
unless ( $self->{cached}->{long} == $self->{long} );
|
||||||
|
|
||||||
my $paramRef = {
|
my $paramRef = {
|
||||||
timeout => 15,
|
timeout => 15,
|
||||||
self => $self,
|
self => $self,
|
||||||
|
Loading…
Reference in New Issue
Block a user