59_Weather: return missing perl modules message

git-svn-id: https://svn.fhem.de/fhem/trunk@27178 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
CoolTux
2023-02-05 08:51:35 +00:00
parent 7e0f6d84ba
commit bc63100a22
2 changed files with 18 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: 59_Weather: return missing perl modules message
- bugfix: 59_Weather: fix Undefined subroutine
- feature: 74_AutomowerConnect: rework detail view
getter for MowerData and StatisticsData

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;
@@ -318,7 +327,6 @@ sub _ReturnWithError {
}
sub DeleteForecastreadings {
my $hash = shift;
my $name = $hash->{NAME};
@@ -769,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>]";