2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

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:
LeonGaultier 2023-02-05 08:51:35 +00:00
parent 23af086689
commit c1b5e245d6
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. # 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. # 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 - bugfix: 59_Weather: fix Undefined subroutine
- feature: 74_AutomowerConnect: rework detail view - feature: 74_AutomowerConnect: rework detail view
getter for MowerData and StatisticsData getter for MowerData and StatisticsData

View File

@ -32,9 +32,18 @@ package FHEM::Core::Weather;
use strict; use strict;
use warnings; 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 experimental qw /switch/;
use Readonly;
#use Readonly;
use FHEM::Meta; use FHEM::Meta;
@ -318,7 +327,6 @@ sub _ReturnWithError {
} }
sub DeleteForecastreadings { sub DeleteForecastreadings {
my $hash = shift; my $hash = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
@ -769,6 +777,12 @@ sub Define {
return $@ unless ( FHEM::Meta::SetInternals($hash) ); return $@ unless ( FHEM::Meta::SetInternals($hash) );
use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' ); 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 = my $usage =
"syntax: define <name> Weather [API=<API>] [apikey=<apikey>] [location=<location>] [interval=<interval>] [lang=<lang>]"; "syntax: define <name> Weather [API=<API>] [apikey=<apikey>] [location=<location>] [interval=<interval>] [lang=<lang>]";