add hook example

add support for onecall endpoint with api version 2.5
This commit is contained in:
2023-01-05 08:18:05 +01:00
parent 6907a1cb97
commit 785f9d07b4
4 changed files with 62 additions and 10 deletions

View File

@ -213,6 +213,8 @@ sub new {
$self->{apiversion} =
( $apioptions->{version} ? $apioptions->{version} : '2.5' );
$self->{endpointType} =
( $apioptions->{endpoint} ? $apioptions->{endpoint} : 'forecast' );
$self->{cached} = _CreateForecastRef($self);
@ -316,7 +318,8 @@ sub _RetrieveDataFromOpenWeatherMap {
timeout => 15,
self => $self,
endpoint => $self->{endpoint} eq 'none'
? ( $self->{apiversion} == 3.0 ? 'onecall' : 'weather' )
? ( $self->{apiversion} == 3.0
|| $self->{endpointType} eq 'onecall' ? 'onecall' : 'weather' )
: 'forecast',
callback => \&_RetrieveDataFinished,
};
@ -989,7 +992,7 @@ sub _strftimeWrapper {
"abstract": "Wetter API für OpenWeatherMap"
}
},
"version": "v3.0.12",
"version": "v3.0.15",
"author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
],