From 68f6afb938444a6945e4e60d6711ffa497a2a6dc Mon Sep 17 00:00:00 2001 From: DS_Starter Date: Sun, 4 Feb 2024 19:26:49 +0000 Subject: [PATCH] 76_SolarForecast: fix plant check ctrlWeatherDevX git-svn-id: https://svn.fhem.de/fhem/trunk@28474 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/76_SolarForecast.pm | 49 ++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 9d8bae59f..c69bfc206 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -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: 76_SolarForecast: fix plant check ctrlWeatherDevX - feature: 76_SolarForecast: add attr ctrlWeatherDev2, ctrlWeatherDev3 - bugfix: 76_SMAInverter: Voltage L1-L2-L3 bug - change: 76_SolarForecast: first step of multi weather device merger diff --git a/fhem/FHEM/76_SolarForecast.pm b/fhem/FHEM/76_SolarForecast.pm index 7fd9fef0a..6d54dd61d 100644 --- a/fhem/FHEM/76_SolarForecast.pm +++ b/fhem/FHEM/76_SolarForecast.pm @@ -157,6 +157,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.15.1" => "04.02.2024 checkPlantConfig: fix check attribute ctrlWeatherDevX ", "1.15.0" => "03.02.2024 reduce cpu utilization, add attributes ctrlWeatherDev2, ctrlWeatherDev3 ", "1.14.3" => "02.02.2024 _transferWeatherValues: first step of multi weather device merger ", "1.14.2" => "02.02.2024 fix warning, _transferAPIRadiationValues: Consider upper and lower deviation limit AI to API forecast ", @@ -567,6 +568,8 @@ my %hqtxt = ( DE => qq{Status} }, result => { EN => qq{Result}, DE => qq{Ergebnis} }, + attrib => { EN => qq{attribute}, + DE => qq{Attribut} }, note => { EN => qq{Note}, DE => qq{Hinweis} }, wfmdcf => { EN => qq{Wait for more days with a consumption figure}, @@ -4921,7 +4924,7 @@ sub _savePlantConfig { ); for my $cfg (@aconfigs) { - my $val = ReadingsVal($name, $cfg, ""); + my $val = ReadingsVal ($name, $cfg, ""); next if(!$val); push @pvconf, $cfg."<>".$val; } @@ -13415,23 +13418,31 @@ sub checkPlantConfig { ##################################### for my $step (1..$weatherDevMax) { my $fcname = AttrVal ($name, 'ctrlWeatherDev'.$step, ''); + next if(!$fcname && $step ne 1); if (!$fcname || !$defs{$fcname}) { - $result->{'DWD Weather Attributes'}{state} = $nok; - $result->{'DWD Weather Attributes'}{result} .= qq{The DWD device "$fcname" doesn't exist.
}; - $result->{'DWD Weather Attributes'}{fault} = 1; + $result->{'DWD Weather Attributes'}{state} = $nok; + + if (!$fcname) { + $result->{'DWD Weather Attributes'}{result} .= qq{No DWD device is defined in attribute "ctrlWeatherDev$step".
}; + } + else { + $result->{'DWD Weather Attributes'}{result} .= qq{The DWD device "$fcname" doesn't exist.
}; + } + + $result->{'DWD Weather Attributes'}{fault} = 1; } else { - $result->{'DWD Weather Attributes'}{note} .= qq{checked attributes of device "$fcname":
}. join (' ', @dweattrmust). '
'; + $result->{'DWD Weather Attributes'}{note} .= qq{checked attributes of device "$fcname":
}. join (' ', @dweattrmust).'
'; $err = checkdwdattr ($name, $fcname, \@dweattrmust); if ($err) { $result->{'DWD Weather Attributes'}{state} = $nok; - $result->{'DWD Weather Attributes'}{result} .= $err. '
'; + $result->{'DWD Weather Attributes'}{result} .= $err.'
'; $result->{'DWD Weather Attributes'}{fault} = 1; } else { - $result->{'DWD Weather Attributes'}{result} = $hqtxt{fulfd}{$lang}; + $result->{'DWD Weather Attributes'}{result} .= $hqtxt{fulfd}{$lang}." ($hqtxt{attrib}{$lang}: ctrlWeatherDev$step)
"; } } } @@ -15796,12 +15807,13 @@ to ensure that the system configuration is correct. After the definition of the device, depending on the forecast sources used, it is mandatory to store additional plant-specific information with the corresponding set commands.
- The following set commands are used to store information that is relevant for the function of the module:

+ The following set commands and attributes are used to store information that is relevant for the function of the + module:

+
+ + Note: If the latitude and longitude attributes are set in the global device, the sunrise and sunset + result from this information.
@@ -17865,13 +17880,13 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. Nach der Definition des Devices sind in Abhängigkeit der verwendeten Prognosequellen zwingend weitere anlagenspezifische Angaben mit den entsprechenden set-Kommandos zu hinterlegen.
- Mit nachfolgenden set-Kommandos werden für die Funktion des Moduls maßgebliche Informationen + Mit nachfolgenden set-Kommandos und Attributen werden für die Funktion des Moduls maßgebliche Informationen hinterlegt:

+
+ + Hinweis: Sind die Attribute latitude und longitude im global Device gesetzt, ergibt sich der + Sonnenauf- und Sonnenuntergang aus diesen Angaben.