From 764bc0f747058aa2b0389e686822aca5864b20b6 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sun, 24 Jan 2021 08:35:16 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.3.0 git-svn-id: https://svn.fhem.de/fhem/trunk@23603 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 73c71b428..4b369daa8 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -959,8 +959,8 @@ sub centralTask { createReadingsFromArray ($hash, \@da, 1); } - sumNextHours ($hash, $chour, \@da); # Zusammenfassung nächste 4 Stunden erstellen - calcVariance ($params); # Autokorrektur berechnen + collectSummaries ($hash, $chour, \@da); # Zusammenfassung nächste 4 Stunden u.a. erstellen + calcVariance ($params); # Autokorrektur berechnen readingsSingleUpdate($hash, "state", "updated", 1); # Abschluß state } @@ -1024,7 +1024,7 @@ sub writeHistoryToFile { } else { my $lw = gettimeofday(); - $hash->{HISTFILE} = "last write time: ".FmtTime($lw); + $hash->{HISTFILE} = "last write time: ".FmtTime($lw)." File: $file"; } } @@ -2488,7 +2488,7 @@ return $sq; ################################################################ # Zusammenfassungen erstellen ################################################################ -sub sumNextHours { +sub collectSummaries { my $hash = shift; my $chour = shift; # aktuelle Stunde my $daref = shift; @@ -2498,6 +2498,7 @@ sub sumNextHours { my $next4HoursSum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; my $restOfDaySum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; my $tomorrowSum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; + my $todaySum = { "PV" => 0, "Consumption" => 0, "Total" => 0, "ConsumpRcmd" => 0 }; my $rdh = 24 - $chour - 1; # verbleibende Anzahl Stunden am Tag beginnend mit 00 (abzüglich aktuelle Stunde) my $thforecast = ReadingsNum ($name, "ThisHour_PVforecast", 0); @@ -2505,14 +2506,16 @@ sub sumNextHours { $restOfDaySum->{PV} = $thforecast; for my $h (1..47) { - $next4HoursSum->{PV} += ReadingsNum ($name, "NextHour".(sprintf "%02d", $h)."_PVforecast", 0) if($h <= 3); - $restOfDaySum->{PV} += ReadingsNum ($name, "NextHour".(sprintf "%02d", $h)."_PVforecast", 0) if($h <= $rdh); - $tomorrowSum->{PV} += ReadingsNum ($name, "NextHour".(sprintf "%02d", $h)."_PVforecast", 0) if($h > $rdh); + $next4HoursSum->{PV} += ReadingsNum ($name, "NextHour". (sprintf "%02d", $h)."_PVforecast", 0) if($h <= 3); + $restOfDaySum->{PV} += ReadingsNum ($name, "NextHour". (sprintf "%02d", $h)."_PVforecast", 0) if($h <= $rdh); + $tomorrowSum->{PV} += ReadingsNum ($name, "NextHour". (sprintf "%02d", $h)."_PVforecast", 0) if($h > $rdh); + $todaySum->{PV} += ReadingsNum ($name, "Today_Hour".(sprintf "%02d", $h)."_PVforecast", 0) if($h <= 23); } push @$daref, "Next04Hours_PV:". (int $next4HoursSum->{PV})." Wh"; push @$daref, "RestOfDay_PV:". (int $restOfDaySum->{PV}). " Wh"; push @$daref, "Tomorrow_PV:". (int $tomorrowSum->{PV}). " Wh"; + push @$daref, "Today_PV:". (int $todaySum->{PV}). " Wh"; createReadingsFromArray ($hash, $daref, 1); @@ -2808,8 +2811,9 @@ verfügbare Globalstrahlung ganz spezifisch in elektrische Energie umgewandelt.