From 4562c635044afadc5f08b4abbdd6338308573891 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sun, 17 Jul 2022 07:30:54 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.65.5 git-svn-id: https://svn.fhem.de/fhem/trunk@26239 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 79e986005..422de01f7 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -1736,7 +1736,7 @@ sub _attrconsumer { ## no critic "not used" return qq{The device "$codev" doesn't exist!}; } - if(!$h->{type} || !$h->{power}) { + if(!$h->{type} || !exists $h->{power}) { return qq{The syntax of "$aName" is not correct. Please consider the commandref.}; } @@ -4264,7 +4264,10 @@ sub _calcSummaries { my $consumption = int ($pvgen - $gfeedin + $gcon - $batin + $batout); my $selfconsumption = int ($pvgen - $gfeedin - $batin + $batout); $selfconsumption = $selfconsumption < 0 ? 0 : $selfconsumption; + my $surplus = int ($pvgen - $consumption); # aktueller Überschuß + $surplus = 0 if($surplus < 0); # wegen Vergleich nompower vs. surplus + my $selfconsumptionrate = 0; my $autarkyrate = 0; $selfconsumptionrate = sprintf("%.0f", $selfconsumption / $pvgen * 100) if($pvgen * 1 > 0);