From 3faacc7c34a9ee0b50a8d35e50651d26d18a9409 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Wed, 16 Dec 2020 09:15:37 +0000 Subject: [PATCH] 76_Solarforcast: contrib 0.1.0 git-svn-id: https://svn.fhem.de/fhem/trunk@23361 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 259b6729d..8cd4b6296 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -640,6 +640,8 @@ sub _transferForecastValues { push @$daref, "Tomorrow_HourSunRise:".$fc1_SunRise; push @$daref, "Tomorrow_HourSunSet:". $fc1_SunSet; + deleteReadingspec ($myHash, "NextHour.*"); + for my $num (0..47) { my $fh = $chour + $num; $fd = int ($fh / 24) ; @@ -1876,6 +1878,23 @@ sub createReadings { return; } +################################################################ +# alle Readings eines Devices oder nur Reaging-Regex +# löschen +################################################################ +sub deleteReadingspec { + my $hash = shift; + my $spec = shift // ".*"; + + my $readingspec = '^'.$spec.'$'; + + for my $reading ( grep { /$readingspec/ } keys %{$hash->{READINGS}} ) { + readingsDelete($hash, $reading); + } + +return; +} + ###################################################################################### # NOTIFYDEV erstellen ######################################################################################