patch-addOnecallMode #5

Merged
marko merged 26 commits from patch-addOnecallMode into dev 2022-12-20 13:44:37 +00:00
4 changed files with 43 additions and 41 deletions
Showing only changes of commit 52490f38bb - Show all commits

View File

@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# 59_Weather.pm # 59_Weather.pm
# Copyright by Dr. Boris Neubert # (c) 2009-2023 Copyright by Dr. Boris Neubert
# e-mail: omega at online dot de # e-mail: omega at online dot de
# #
# Contributors: # Contributors:
@ -1098,7 +1098,8 @@ sub Weather_CheckOptions {
$f =~ tr/dh/./cd if ( defined $f && $f ); $f =~ tr/dh/./cd if ( defined $f && $f );
$items =~ tr/0-9/./cd if ( defined($items) && $items ); $items =~ tr/0-9/./cd if ( defined($items) && $items );
$items = 6 if ( !$items ); $items = AttrVal( $d, 'forecastLimit', 6 )
if ( !$items );
my $forecastConfig = Weather_ForcastConfig($hash); my $forecastConfig = Weather_ForcastConfig($hash);
$f = ( $f = (
@ -1532,15 +1533,15 @@ sub Weather_CheckOptions {
], ],
"release_status": "stable", "release_status": "stable",
"license": "GPL_2", "license": "GPL_2",
"version": "v2.2.5", "version": "v2.2.6",
"author": [ "author": [
"Marko Oldenburg <leongaultier@gmail.com>" "Marko Oldenburg <fhemdevelopment@cooltux.net>"
], ],
"x_fhem_maintainer": [ "x_fhem_maintainer": [
"CoolTux" "CoolTux"
], ],
"x_fhem_maintainer_github": [ "x_fhem_maintainer_github": [
"LeonGaultier" "CoolTuxNet"
], ],
"prereqs": { "prereqs": {
"runtime": { "runtime": {

View File

@ -1,9 +1,9 @@
# $Id: $ # $Id: $
############################################################################### ###############################################################################
# #
# Developed with Kate # Developed with VSCodium and richterger perl plugin
# #
# (c) 2019 Copyright: Marko Oldenburg (leongaultier at gmail dot com) # (c) 2019-2023 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# All rights reserved # All rights reserved
# #
# Special thanks goes to: # Special thanks goes to:
@ -164,7 +164,8 @@ sub new {
$self->{cachemaxage} = ( $self->{cachemaxage} = (
defined( $apioptions->{cachemaxage} ) defined( $apioptions->{cachemaxage} )
? $apioptions->{cachemaxage} ? $apioptions->{cachemaxage}
: 900 ); : 900
);
$self->{extend} = $self->{extend} =
( defined( $apioptions->{extend} ) ? $apioptions->{extend} : 'none' ); ( defined( $apioptions->{extend} ) ? $apioptions->{extend} : 'none' );
$self->{cached} = _CreateForecastRef($self); $self->{cached} = _CreateForecastRef($self);
@ -222,7 +223,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;
@ -248,8 +249,7 @@ sub _RetrieveDataFromDarkSky($) {
# 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);
} }
@ -486,8 +486,8 @@ sub _ProcessingRetrieveData($$) {
->{apparentTemperatureHighTime} ->{apparentTemperatureHighTime}
) )
), ),
'code' => 'code' => $codes{
$codes{ $data->{daily}->{data}->[$i]->{icon} $data->{daily}->{data}->[$i]->{icon}
}, },
'iconAPI' => 'iconAPI' =>
$data->{daily}->{data}->[$i]->{icon}, $data->{daily}->{data}->[$i]->{icon},
@ -662,9 +662,9 @@ sub _ProcessingRetrieveData($$) {
'temperature' => sprintf( "%.1f", 'temperature' => sprintf( "%.1f",
$data->{hourly}->{data}->[$i] $data->{hourly}->{data}->[$i]
->{temperature} ), ->{temperature} ),
'code' => 'code' => $codes{
$codes{ $data->{hourly}->{data}->[$i] $data->{hourly}->{data}->[$i]->{icon}
->{icon} }, },
'iconAPI' => 'iconAPI' =>
$data->{hourly}->{data}->[$i]->{icon}, $data->{hourly}->{data}->[$i]->{icon},
'condition' => encode_utf8( 'condition' => encode_utf8(
@ -790,7 +790,7 @@ sub _CreateForecastRef($) {
long => $self->{long}, long => $self->{long},
apiMaintainer => apiMaintainer =>
'Marko Oldenburg (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)', 'Marko Oldenburg (<a href=https://forum.fhem.de/index.php?action=profile;u=13684>CoolTux</a>)',
apiVersion => version->parse(DarkSkyAPI->VERSION())->normal, apiVersion => version->parse( DarkSkyAPI->VERSION() )->normal,
} }
); );
@ -820,7 +820,6 @@ sub strftimeWrapper(@) {
1; 1;
=pod =pod
=encoding utf8 =encoding utf8
@ -833,15 +832,15 @@ sub strftimeWrapper(@) {
"abstract": "Wetter API für Weather DarkSky" "abstract": "Wetter API für Weather DarkSky"
} }
}, },
"version": "v1.0.0", "version": "v1.2.0",
"author": [ "author": [
"Marko Oldenburg <leongaultier@gmail.com>" "Marko Oldenburg <fhemdevelopment@cooltux.net>"
], ],
"x_fhem_maintainer": [ "x_fhem_maintainer": [
"CoolTux" "CoolTux"
], ],
"x_fhem_maintainer_github": [ "x_fhem_maintainer_github": [
"LeonGaultier" "CoolTuxNet"
], ],
"prereqs": { "prereqs": {
"runtime": { "runtime": {

View File

@ -1,9 +1,9 @@
# $Id: $ # $Id: $
############################################################################### ###############################################################################
# #
# Developed with VSCodium and richterger perl plugin. # Developed with VSCodium and richterger perl plugin
# #
# (c) 2019-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net) # (c) 2019-2023 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# All rights reserved # All rights reserved
# #
# Special thanks goes to: # Special thanks goes to:
@ -182,7 +182,9 @@ my %codes = (
sub new { sub new {
### geliefert wird ein Hash ### geliefert wird ein Hash
my ( $class, $argsRef ) = @_; my $class = shift;
my $argsRef = shift;
my $apioptions = _parseApiOptions( $argsRef->{apioptions} ); my $apioptions = _parseApiOptions( $argsRef->{apioptions} );
my $self = { my $self = {
@ -923,7 +925,7 @@ sub strftimeWrapper {
"abstract": "Wetter API für OpenWeatherMap" "abstract": "Wetter API für OpenWeatherMap"
} }
}, },
"version": "v3.0.1", "version": "v3.0.2",
"author": [ "author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>" "Marko Oldenburg <fhemdevelopment@cooltux.net>"
], ],
@ -931,7 +933,7 @@ sub strftimeWrapper {
"CoolTux" "CoolTux"
], ],
"x_fhem_maintainer_github": [ "x_fhem_maintainer_github": [
"LeonGaultier" "CoolTuxNet"
], ],
"prereqs": { "prereqs": {
"runtime": { "runtime": {

View File

@ -747,7 +747,7 @@ sub strftimeWrapper(@) {
"abstract": "Wetter API für Weather Underground" "abstract": "Wetter API für Weather Underground"
} }
}, },
"version": "v1.0.1", "version": "v1.0.2",
"author": [ "author": [
"Julian Pawlowski <julian.pawlowski@gmail.com>" "Julian Pawlowski <julian.pawlowski@gmail.com>"
], ],