Merge pull request 'dev' (#51) from dev into testing

Reviewed-on: #51
This commit is contained in:
Marko Oldenburg 2023-02-05 09:46:46 +01:00
commit 2afb98f9b9
2 changed files with 23 additions and 10 deletions

View File

@ -1,5 +1,5 @@
UPD 2023-01-10_21:41:34 25809 FHEM/59_Weather.pm
UPD 2023-01-10_21:20:58 33948 lib/FHEM/Core/Weather.pm
UPD 2023-01-10_21:25:52 50106 lib/FHEM/APIs/Weather/DarkSkyAPI.pm
UPD 2023-01-10_21:25:49 33422 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm
UPD 2023-01-10_21:25:53 36101 lib/FHEM/APIs/Weather/wundergroundAPI.pm
UPD 2023-01-29_16:14:48 25809 FHEM/59_Weather.pm
UPD 2023-02-05_09:25:24 34254 lib/FHEM/Core/Weather.pm
UPD 2023-01-29_16:14:48 50106 lib/FHEM/APIs/Weather/DarkSkyAPI.pm
UPD 2023-01-29_16:14:48 33422 lib/FHEM/APIs/Weather/OpenWeatherMapAPI.pm
UPD 2023-01-29_16:14:48 36101 lib/FHEM/APIs/Weather/wundergroundAPI.pm

View File

@ -32,9 +32,18 @@ package FHEM::Core::Weather;
use strict;
use warnings;
use Time::HiRes qw(gettimeofday);
my $missingModul = '';
eval { use Time::HiRes qw /gettimeofday/; 1 }
or $missingModul .= "libtime-hires-perl ";
eval { use Readonly; 1 }
or $missingModul .= "libreadonly-perl ";
#use Time::HiRes qw(gettimeofday);
use experimental qw /switch/;
use Readonly;
#use Readonly;
use FHEM::Meta;
@ -317,9 +326,7 @@ sub _ReturnWithError {
return;
}
sub _DeleteForecastreadings {
return 0 unless ( __PACKAGE__ eq caller(0) );
sub DeleteForecastreadings {
my $hash = shift;
my $name = $hash->{NAME};
@ -770,6 +777,12 @@ sub Define {
return $@ unless ( FHEM::Meta::SetInternals($hash) );
use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' );
return
'Cannot define Weather device. Please use "apt install '
. ${missingModul}
. ' to install missing perl modules'
if ($missingModul);
my $usage =
"syntax: define <name> Weather [API=<API>] [apikey=<apikey>] [location=<location>] [interval=<interval>] [lang=<lang>]";