From 2382cb5380ef9623416343f3e625910aaccce7ec Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 24 Apr 2021 17:48:43 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.39.0 git-svn-id: https://svn.fhem.de/fhem/trunk@24325 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 50a26b5e4..6428fcc4e 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -118,7 +118,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "0.39.0" => "24.04.2021 new attr sameWeekdaysForConsfc ", + "0.39.0" => "24.04.2021 new attr sameWeekdaysForConsfc, readings Current_SelfConsumption, Current_SelfConsumptionQuote ", "0.38.3" => "21.04.2021 minor fixes in sub calcVariance, Traffic light indicator for prediction quality, some more fixes ", "0.38.2" => "20.04.2021 fix _estConsumptionForecast, add consumption values to graphic ", "0.38.1" => "19.04.2021 bug fixing ", @@ -2415,9 +2415,16 @@ sub _calcSummaries { my $batout = CurrentVal ($hash, "powerbatout", 0); # aktuelle Batterieentladung my $consumption = int ($pvgen - $gfeedin + $gcon - $batin + $batout); - $data{$type}{$name}{current}{consumption} = $consumption; + my $selfconsumption = int ($pvgen - $gfeedin); + my $selfconsumptionquote = sprintf("%.0f", $selfconsumption / $pvgen * 100); + + $data{$type}{$name}{current}{consumption} = $consumption; + $data{$type}{$name}{current}{selfconsumption} = $selfconsumption; + $data{$type}{$name}{current}{selfconsumptionquote} = $selfconsumptionquote; push @$daref, "Current_Consumption<>". $consumption. " W"; + push @$daref, "Current_SelfConsumption<>". $selfconsumption. " W"; + push @$daref, "Current_SelfConsumptionQuote<>".$selfconsumptionquote. " %"; push @$daref, "NextHours_Sum01_PVforecast<>". (int $next1HoursSum->{PV})." Wh"; push @$daref, "NextHours_Sum02_PVforecast<>". (int $next2HoursSum->{PV})." Wh";