diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 2f6a4821d..3d2408a90 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -126,6 +126,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "0.68.3 "=> "19.09.2022 fix calculation of currentAPIinterval ", "0.68.2 "=> "18.09.2022 fix function _setpvCorrectionFactorAuto, new attr optimizeSolCastAPIreqInterval, change createReadingsFromArray ", "0.68.1 "=> "17.09.2022 new readings Today_MaxPVforecast, Today_MaxPVforecastTime ", "0.68.0 "=> "15.09.2022 integrate SolCast API, change attribute Wh/kWh to Wh_kWh, rename Reading nextPolltime to ". @@ -1841,19 +1842,21 @@ sub __solCast_ApiResponse { my $string = $paref->{string}; my $allstrings = $paref->{allstrings}; + my $type = $hash->{TYPE}; + my ($msg,$starttmstr); if ($err ne "") { $msg = 'SolCast API server response: '.$err; Log3 ($name, 2, "$name - $msg"); - + + $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{response_message} = $err; readingsSingleUpdate($hash, "state", $msg, 1); return; } elsif ($myjson ne "") { # Evaluiere ob Daten im JSON-Format empfangen wurden my ($success) = evaljson($hash, $myjson); - my $type = $hash->{TYPE}; if(!$success) { $msg = 'ERROR - invalid SolCast API server response'; @@ -1884,6 +1887,7 @@ sub __solCast_ApiResponse { Log3 ($name, 3, "$name - $msg"); + $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{response_message} = $jdata->{'response_status'}{'message'}; readingsSingleUpdate($hash, "state", $msg, 1); return; } @@ -1951,6 +1955,8 @@ sub __solCast_ApiResponse { my $t = time; ___setLastAPIcallKeyData ($hash, $t); + $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{response_message} = 'success'; + my $param = { hash => $hash, name => $name, @@ -2033,7 +2039,7 @@ sub ___setLastAPIcallKeyData { # $data{$type}{$name}{current}{solCastTodayMaxAPIcalls} = $madr; - my $darr = $madr - SolCastAPIVal ($hash, '?All', '?All', 'todayDoneAPIcalls', 0); # verbleibende SolCast API Calls am aktuellen Tag + my $darr = $madr - (SolCastAPIVal ($hash, '?All', '?All', 'todayDoneAPIcalls', 0) / ($asc * $upc)); # verbleibende SolCast API Calls am aktuellen Tag $darr = 0 if($darr < 0); $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayRemaingAPIcalls} = $darr; @@ -2047,6 +2053,8 @@ sub ___setLastAPIcallKeyData { $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{currentAPIinterval} = $apirepetdef; $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{currentAPIinterval} = int ($dart / $darr) if($dart && $darr); + + # Log3 ($name, 1, qq{$name - madr: $madr, darr: $darr, dart: $dart, interval: }. SolCastAPIVal ($hash, '?All', '?All', 'currentAPIinterval', "")); } else { $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{currentAPIinterval} = $apirepetdef; @@ -5426,6 +5434,7 @@ sub _createSummaries { for my $h (1..47) { my $pvfc = NexthoursVal ($hash, "NextHour".sprintf("%02d",$h), "pvforecast", 0); my $confc = NexthoursVal ($hash, "NextHour".sprintf("%02d",$h), "confc", 0); + my $istdy = NexthoursVal ($hash, "NextHour".sprintf("%02d",$h), "today", 1); if($h == 1) { $next1HoursSum->{PV} += $pvfc / 60 * $minute; @@ -5456,7 +5465,7 @@ sub _createSummaries { $restOfDaySum->{PV} += $pvfc if($h <= $rdh); $restOfDaySum->{Consumption} += $confc if($h <= $rdh); - $tomorrowSum->{PV} += $pvfc if($h > $rdh); + $tomorrowSum->{PV} += $pvfc if(!$istdy); } for my $th (1..24) { @@ -9911,12 +9920,12 @@ Ein/Ausschaltzeiten sowie deren Ausführung vom SolarForecast Modul übernehmen