add support fpr Meta.pm and little Code changes

This commit is contained in:
Marko Oldenburg 2019-09-11 08:42:42 +02:00
parent 5ff16316eb
commit 84f0562f27
2 changed files with 63 additions and 7 deletions

View File

@ -28,14 +28,14 @@
# #
############################################################################### ###############################################################################
package wundergroundAPI; package DarkSkyAPI;
use strict; use strict;
use warnings; use warnings;
use FHEM::Meta; use FHEM::Meta;
use Data::Dumper; use Data::Dumper;
FHEM::Meta::Load(__PACKAGE__); FHEM::Meta::Load(__PACKAGE__);
use version 0.50; our $VERSION = $main::packages{wundergroundAPI}{META}{version}; use version 0.50; our $VERSION = $main::packages{DarkSkyAPI}{META}{version};
package DarkSkyAPI::Weather; package DarkSkyAPI::Weather;
use strict; use strict;
@ -772,7 +772,7 @@ 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 => DarkSkyAPI->VERSION(), apiVersion => version->parse(DarkSkyAPI->VERSION())->normal,
} }
); );
@ -809,10 +809,10 @@ sub strftimeWrapper(@) {
=for :application/json;q=META.json DarkSkyAPI.pm =for :application/json;q=META.json DarkSkyAPI.pm
{ {
"abstract": "Weather API for Weather Dark Sky", "abstract": "Weather API for Weather DarkSky",
"x_lang": { "x_lang": {
"de": { "de": {
"abstract": "Wetter API für Weather Dark Sky" "abstract": "Wetter API für Weather DarkSky"
} }
}, },
"version": "v1.0.0", "version": "v1.0.0",

View File

@ -32,6 +32,15 @@
# https://api.openweathermap.org/data/2.5/forecast?lat=[lat]&lon=[long]&APPID=[API] Forecast # https://api.openweathermap.org/data/2.5/forecast?lat=[lat]&lon=[long]&APPID=[API] Forecast
# https://openweathermap.org/weather-conditions Icons und Conditions ID's # https://openweathermap.org/weather-conditions Icons und Conditions ID's
package OpenWeatherMapAPI;
use strict;
use warnings;
use FHEM::Meta;
use Data::Dumper;
FHEM::Meta::Load(__PACKAGE__);
use version 0.50; our $VERSION = $main::packages{OpenWeatherMapAPI}{META}{version};
package OpenWeatherMapAPI::Weather; package OpenWeatherMapAPI::Weather;
use strict; use strict;
use warnings; use warnings;
@ -116,7 +125,6 @@ eval "use Encode qw(encode_utf8);1" or $missingModul .= "Encode ";
# use Data::Dumper; # for Debug only # use Data::Dumper; # for Debug only
## API URL ## API URL
use constant URL => 'https://api.openweathermap.org/data/2.5/'; use constant URL => 'https://api.openweathermap.org/data/2.5/';
use constant VERSION => '1.0.0';
## URL . 'weather?' for current data ## URL . 'weather?' for current data
## URL . 'forecast?' for forecast data ## URL . 'forecast?' for forecast data
@ -598,7 +606,7 @@ 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, apiVersion => version->parse(OpenWeatherMapAPI->VERSION())->normal,
} }
); );
@ -627,3 +635,51 @@ sub strftimeWrapper(@) {
############################################################################## ##############################################################################
1; 1;
=pod
=encoding utf8
=for :application/json;q=META.json OpenWeatherMapAPI.pm
{
"abstract": "Weather API for Weather OpenWeatherMap",
"x_lang": {
"de": {
"abstract": "Wetter API für OpenWeatherMap"
}
},
"version": "v1.0.0",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],
"x_fhem_maintainer": [
"CoolTux"
],
"x_fhem_maintainer_github": [
"LeonGaultier"
],
"prereqs": {
"runtime": {
"requires": {
"FHEM::Meta": 0,
"HttpUtils": 0,
"strict": 0,
"warnings": 0,
"constant": 0,
"POSIX": 0,
"JSON::PP": 0
},
"recommends": {
"JSON": 0
},
"suggests": {
"JSON::XS": 0,
"Cpanel::JSON::XS": 0
}
}
}
}
=end :application/json;q=META.json
=cut