mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
76_SolarForecast: attr setupRadiationAPI and setupWeatherDev1 can be set largely independently of each other
git-svn-id: https://svn.fhem.de/fhem/trunk@29384 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
24e4d05aa6
commit
da89c9f388
@ -158,7 +158,8 @@ BEGIN {
|
||||
my %vNotesIntern = (
|
||||
"1.38.0" => "30.11.2024 optimize data handling, rename getter solApiData to radiationApiData, ".
|
||||
"set setupStringAzimuth, setupStringDeclination is checked due to dependencies to OpenMeteo ".
|
||||
"attr setupRadiationAPI and setupWeatherDev1 can be set largely independently of each other ",
|
||||
"attr setupRadiationAPI and setupWeatherDev1 can be set largely independently of each other ".
|
||||
"rename sub SolCastAPIVal to RadiationAPIVal ",
|
||||
"1.37.9" => "29.11.2024 activate StatusAPI-Hash, Separation of radiation API-data, API-state data, weather-API data ",
|
||||
"1.37.8" => "28.11.2024 edit commref, func _searchCacheFiles for renaming Cache files when device is renamed ".
|
||||
"_saveEnergyConsumption: extended for Debug collectData, preparation of weatherApiData ".
|
||||
@ -1074,7 +1075,7 @@ my %hcsr = (
|
||||
runTimeTrainAI => { fnr => 3, fn => \&CircularVal, par => 99, unit => '', def => '-' },
|
||||
SunHours_Remain => { fnr => 4, fn => \&CurrentVal, par => '', unit => '', def => 0 }, # fnr => 3 -> Custom Calc
|
||||
SunMinutes_Remain => { fnr => 4, fn => \&CurrentVal, par => '', unit => '', def => 0 },
|
||||
dayAfterTomorrowPVforecast => { fnr => 4, fn => \&SolCastAPIVal, par => 'pv_estimate50', unit => '', def => 0 },
|
||||
dayAfterTomorrowPVforecast => { fnr => 4, fn => \&RadiationAPIVal, par => 'pv_estimate50', unit => '', def => 0 },
|
||||
todayGridFeedIn => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => 0 },
|
||||
todayGridConsumption => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => 0 },
|
||||
todayBatIn => { fnr => 4, fn => \&CircularVal, par => 99, unit => '', def => 0 },
|
||||
@ -2879,7 +2880,7 @@ sub __solCast_ApiResponse {
|
||||
$period = $jdata->{'forecasts'}[$k]{'period'}; # -> dann bereits beim letzten Abruf gespeicherte Daten der aktuellen Stunde durch 2 teilen damit
|
||||
$period =~ s/.*(\d\d).*/$1/; # -> die neuen Daten (in dem Fall nur die einer halben Stunde) im nächsten Schritt addiert werden
|
||||
|
||||
my $est50 = SolCastAPIVal ($hash, $string, $starttmstr, 'pv_estimate50', 0) / (60/$period);
|
||||
my $est50 = RadiationAPIVal ($hash, $string, $starttmstr, 'pv_estimate50', 0) / (60/$period);
|
||||
$data{$type}{$name}{solcastapi}{$string}{$starttmstr}{pv_estimate50} = sprintf "%.0f", $est50 if($est50);
|
||||
|
||||
$k++;
|
||||
@ -2912,7 +2913,7 @@ sub __solCast_ApiResponse {
|
||||
if ($debug =~ /apiProcess/x) { # nur für Debugging
|
||||
if (exists $data{$type}{$name}{solcastapi}{$string}{$starttmstr}) {
|
||||
Log3 ($name, 1, qq{$name DEBUG> SolCast API Hash - Start Date/Time: }. $starttmstr);
|
||||
Log3 ($name, 1, qq{$name DEBUG> SolCast API Hash - pv_estimate50 add: }.$pvest50.qq{, contains already: }.SolCastAPIVal ($hash, $string, $starttmstr, 'pv_estimate50', 0));
|
||||
Log3 ($name, 1, qq{$name DEBUG> SolCast API Hash - pv_estimate50 add: }.$pvest50.qq{, contains already: }.RadiationAPIVal ($hash, $string, $starttmstr, 'pv_estimate50', 0));
|
||||
}
|
||||
}
|
||||
|
||||
@ -7101,8 +7102,8 @@ sub centralTask {
|
||||
##########################################################################################################################
|
||||
if (exists $data{$type}{$name}{solcastapi}{'?IdPair'}) { # 29.11.2024
|
||||
for my $pk (keys %{$data{$type}{$name}{solcastapi}{'?IdPair'}}) {
|
||||
my $apikey = SolCastAPIVal ($hash, '?IdPair', $pk, 'apikey', '');
|
||||
my $rtid = SolCastAPIVal ($hash, '?IdPair', $pk, 'rtid', '');
|
||||
my $apikey = RadiationAPIVal ($hash, '?IdPair', $pk, 'apikey', '');
|
||||
my $rtid = RadiationAPIVal ($hash, '?IdPair', $pk, 'rtid', '');
|
||||
|
||||
if ($apikey && $rtid) {
|
||||
$data{$type}{$name}{statusapi}{'?IdPair'}{$pk}{rtid} = $rtid;
|
||||
@ -7117,7 +7118,7 @@ sub centralTask {
|
||||
my ($rapi, $wapi) = getStatusApiName ($hash);
|
||||
|
||||
for my $key (keys %{$data{$type}{$name}{solcastapi}{'?All'}{'?All'}}) {
|
||||
my $val = SolCastAPIVal ($hash, '?All', '?All', $key, '');
|
||||
my $val = RadiationAPIVal ($hash, '?All', '?All', $key, '');
|
||||
|
||||
if ($rapi && $val) {
|
||||
$data{$type}{$name}{statusapi}{$rapi}{'?All'}{$key} = $val;
|
||||
@ -7138,7 +7139,7 @@ sub centralTask {
|
||||
|
||||
delete $data{$type}{$name}{solcastapi}{'?All'} if(!keys %{$data{$type}{$name}{solcastapi}{'?All'}});
|
||||
|
||||
my $vrmcr = SolCastAPIVal ($hash, '?VRM', '?API', 'credentials', ''); # 29.11.2024
|
||||
my $vrmcr = RadiationAPIVal ($hash, '?VRM', '?API', 'credentials', ''); # 29.11.2024
|
||||
if ($vrmcr) {
|
||||
$data{$type}{$name}{statusapi}{'?VRM'}{'?API'}{credentials} = $vrmcr;
|
||||
delete $data{$type}{$name}{solcastapi}{'?VRM'};
|
||||
@ -8340,7 +8341,7 @@ sub _transferAPIRadiationValues {
|
||||
my $nhtstr = 'NextHour'.sprintf "%02d", $num;
|
||||
my ($wtday, $wthour) = $wantdt =~ /(\d{2})\s(\d{2}):/xs;
|
||||
my $hod = sprintf "%02d", int $wthour + 1; # Stunde des Tages
|
||||
my $rad1h = SolCastAPIVal ($hash, '?All', $wantdt, 'Rad1h', undef);
|
||||
my $rad1h = RadiationAPIVal ($hash, '?All', $wantdt, 'Rad1h', undef);
|
||||
|
||||
$paref->{wantdt} = $wantdt;
|
||||
$paref->{wantts} = $wantts;
|
||||
@ -8556,7 +8557,7 @@ sub __calcPVestimates {
|
||||
}
|
||||
|
||||
$peak *= 1000;
|
||||
my $est = SolCastAPIVal ($hash, $string, $wantdt, 'pv_estimate50', 0);
|
||||
my $est = RadiationAPIVal ($hash, $string, $wantdt, 'pv_estimate50', 0);
|
||||
my $pv = sprintf "%.1f", ($est * $hc); # Korrekturfaktor anwenden
|
||||
|
||||
my $invcap = 0;
|
||||
@ -19583,7 +19584,7 @@ return $def;
|
||||
# Usage:
|
||||
# StringVal ($hash, $strg, $key, $def)
|
||||
#
|
||||
# $strg: - Name des Strings aus setupStringPeak
|
||||
# $strg: - Name des Strings aus setupInverterStrings
|
||||
# $key: peak - Peakleistung aus setupStringPeak
|
||||
# tilt - Neigungswinkel der Module aus setupStringDeclination
|
||||
# dir - Ausrichtung der Module als Azimut-Bezeichner (N,NE,E,SE,S,SW,W,NW)
|
||||
@ -19820,7 +19821,7 @@ return $def;
|
||||
##########################################################################################################################################################
|
||||
# Wert des solcastapi-Hash zurückliefern
|
||||
# Usage:
|
||||
# SolCastAPIVal ($hash, $tring, $ststr, $key, $def)
|
||||
# RadiationAPIVal ($hash, $tring, $ststr, $key, $def)
|
||||
#
|
||||
# $tring: Stringname aus "setupInverterStrings" (?All für allg. Werte)
|
||||
# $ststr: Startzeit der Form YYYY-MM-DD hh:00:00
|
||||
@ -19829,9 +19830,9 @@ return $def;
|
||||
# $def: Defaultwert
|
||||
#
|
||||
# Sonderabfragen:
|
||||
# SolCastAPIVal ($hash, '?All', $ststr, 'Rad1h', $def) - Globalstrahlung mit Startzeit ohne Stringbezug
|
||||
# RadiationAPIVal ($hash, '?All', $ststr, 'Rad1h', $def) - Globalstrahlung mit Startzeit ohne Stringbezug
|
||||
##########################################################################################################################################################
|
||||
sub SolCastAPIVal {
|
||||
sub RadiationAPIVal {
|
||||
my $hash = shift;
|
||||
my $string = shift;
|
||||
my $ststr = shift;
|
||||
|
Loading…
Reference in New Issue
Block a user