From bab8d53f5b3d87ed64ce16c42ed38a6df7a9cac5 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sat, 23 Jan 2021 08:01:53 +0000 Subject: [PATCH] 76_SolarForecast.pm: contrib 0.3.0 git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23591 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- contrib/DS_Starter/76_SolarForecast.pm | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/contrib/DS_Starter/76_SolarForecast.pm b/contrib/DS_Starter/76_SolarForecast.pm index 4339a31ad..78ba2dcfa 100644 --- a/contrib/DS_Starter/76_SolarForecast.pm +++ b/contrib/DS_Starter/76_SolarForecast.pm @@ -114,7 +114,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "0.3.0" => "21.12.2021 add cloud correction, add rain correction ", + "0.3.0" => "21.12.2021 add cloud correction, add rain correction, add reset pvHistory ", "0.2.0" => "20.12.2021 use SMUtils, JSON, implement getter data,html,pvHistory, correct the 'disable' problem ", "0.1.0" => "09.12.2020 initial Version " ); @@ -446,7 +446,7 @@ sub Set { "moduleEfficiency ". "moduleTiltAngle:$tilt ". "pvCorrectionFactor_Auto:on,off ". - "reset:currentForecastDev,currentInverterDev,currentMeterDev ". + "reset:currentForecastDev,currentInverterDev,currentMeterDev,pvHistory ". $cf ; @@ -576,7 +576,13 @@ sub _setreset { ## no critic "not used" my $paref = shift; my $hash = $paref->{hash}; my $name = $paref->{name}; - my $prop = $paref->{prop} // return qq{no reading to reset specified}; + my $prop = $paref->{prop} // return qq{no source specified for reset}; + + if($prop eq "pvHistory") { + my $type = $hash->{TYPE}; + delete $data{$type}{$name}{pvhist}; + return; + } readingsDelete($hash, $prop); @@ -836,8 +842,8 @@ sub Notify { # Dadurch kann die Menge der Events verringert werden. In sub DbRep_Define angeben. my $myHash = shift; my $dev_hash = shift; - my $myName = $myHash->{NAME}; # Name des eigenen Devices - my $devName = $dev_hash->{NAME}; # Device welches Events erzeugt hat + my $myName = $myHash->{NAME}; # Name des eigenen Devices + my $devName = $dev_hash->{NAME}; # Device welches Events erzeugt hat return if(IsDisabled($myName) || !$myHash->{NOTIFYDEV}); @@ -2345,17 +2351,16 @@ sub setPVhistory { my $paref = shift; my $hash = $paref->{hash}; my $name = $paref->{name}; - my $t = $paref->{t}; # aktuelle Unix-Zeit + my $t = $paref->{t}; # aktuelle Unix-Zeit my $chour = $paref->{chour}; my $ethishour = $paref->{ethishour} // 0; my $calcpv = $paref->{calcpv} // 0; my $type = $hash->{TYPE}; - my $day = strftime "%d", localtime($t); # aktueller Tag - my $pvhh = $data{$type}{$name}{pvhist}; + my $day = strftime "%d", localtime($t); # aktueller Tag - $pvhh->{$day}{$chour}{pvrl} = $ethishour if(defined $ethishour); # realer Energieertrag - $pvhh->{$day}{$chour}{pvfc} = $calcpv if(defined $calcpv); # prognostizierter Energieertrag + $data{$type}{$name}{pvhist}{$day}{$chour}{pvrl} = $ethishour if(defined $ethishour); # realer Energieertrag + $data{$type}{$name}{pvhist}{$day}{$chour}{pvfc} = $calcpv if(defined $calcpv); # prognostizierter Energieertrag Log3 ($name, 5, "$name - set PV History hour $chour -> real: $ethishour, forecast: $calcpv"); @@ -2607,7 +2612,7 @@ verfügbare Globalstrahlung ganz spezifisch in elektrische Energie umgewandelt. - +
forecastDays 1
forecastProperties Rad1h,TTT,Neff,R600,ww,SunUp,SunRise,SunSet
forecastProperties Rad1h,TTT,Neff,R101,ww,SunUp,SunRise,SunSet
forecastResolution 1
forecastStation <Stationscode der ausgewerteten DWD Station>
Hinweis: Die ausgewählte forecastStation muß Strahlungswerte (Rad1h Readings) liefern.