From 2601a4264336120b1810996ceff3aaa11866f115 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Thu, 2 Feb 2023 22:58:40 +0100 Subject: [PATCH 1/3] fix: : Undefined subroutine &FHEM::Core::Weather::DeleteForecastreadings [Ticket: #46] --- controls_Weather.txt | 10 +++++----- lib/FHEM/Core/Weather.pm | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controls_Weather.txt b/controls_Weather.txt index 88ff76a..44b9f32 100644 --- a/controls_Weather.txt +++ b/controls_Weather.txt @@ -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-02_22:56:41 33947 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 diff --git a/lib/FHEM/Core/Weather.pm b/lib/FHEM/Core/Weather.pm index b65d22e..d481929 100644 --- a/lib/FHEM/Core/Weather.pm +++ b/lib/FHEM/Core/Weather.pm @@ -317,7 +317,7 @@ sub _ReturnWithError { return; } -sub _DeleteForecastreadings { +sub DeleteForecastreadings { return 0 unless ( __PACKAGE__ eq caller(0) ); my $hash = shift; -- 2.45.2 From 5f611555e3dbfc0ff5296d80e0a987cc431625dd Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 5 Feb 2023 09:20:20 +0100 Subject: [PATCH 2/3] fix: failed then Readonly is missing --- controls_Weather.txt | 2 +- lib/FHEM/Core/Weather.pm | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/controls_Weather.txt b/controls_Weather.txt index 44b9f32..6eed585 100644 --- a/controls_Weather.txt +++ b/controls_Weather.txt @@ -1,5 +1,5 @@ UPD 2023-01-29_16:14:48 25809 FHEM/59_Weather.pm -UPD 2023-02-02_22:56:41 33947 lib/FHEM/Core/Weather.pm +UPD 2023-02-05_09:19:03 34095 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 diff --git a/lib/FHEM/Core/Weather.pm b/lib/FHEM/Core/Weather.pm index d481929..f1454e7 100644 --- a/lib/FHEM/Core/Weather.pm +++ b/lib/FHEM/Core/Weather.pm @@ -32,9 +32,18 @@ package FHEM::Core::Weather; use strict; use warnings; -use Time::HiRes qw(gettimeofday); +my $missingModul = 'apt install'; + +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,8 +327,6 @@ sub _ReturnWithError { } sub DeleteForecastreadings { - return 0 unless ( __PACKAGE__ eq caller(0) ); - my $hash = shift; my $name = $hash->{NAME}; -- 2.45.2 From 30dd03cbea6351c2667da37ed58d13709fa80e7d Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sun, 5 Feb 2023 09:26:04 +0100 Subject: [PATCH 3/3] fix: missing perl modules --- controls_Weather.txt | 2 +- lib/FHEM/Core/Weather.pm | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/controls_Weather.txt b/controls_Weather.txt index 6eed585..1dfe74d 100644 --- a/controls_Weather.txt +++ b/controls_Weather.txt @@ -1,5 +1,5 @@ UPD 2023-01-29_16:14:48 25809 FHEM/59_Weather.pm -UPD 2023-02-05_09:19:03 34095 lib/FHEM/Core/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 diff --git a/lib/FHEM/Core/Weather.pm b/lib/FHEM/Core/Weather.pm index f1454e7..2408121 100644 --- a/lib/FHEM/Core/Weather.pm +++ b/lib/FHEM/Core/Weather.pm @@ -32,7 +32,7 @@ package FHEM::Core::Weather; use strict; use warnings; -my $missingModul = 'apt install'; +my $missingModul = ''; eval { use Time::HiRes qw /gettimeofday/; 1 } or $missingModul .= "libtime-hires-perl "; @@ -777,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 Weather [API=] [apikey=] [location=] [interval=] [lang=]"; -- 2.45.2