76_SolarForecast.pm: contrib 0.65.5

git-svn-id: https://svn.fhem.de/fhem/trunk@26239 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2022-07-17 07:30:54 +00:00
parent 40ed507801
commit 4562c63504

View File

@ -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);