From 13bcf3bf82b3f29e2020d734b03ead1b82cda351 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Thu, 1 May 2025 09:01:00 +0000 Subject: [PATCH] 76_SolarForecast: Version 1.51.7 git-svn-id: https://svn.fhem.de/fhem/trunk@29909 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 44 +++++++++++++++------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 4ef05a4f5..ebf6e9ce8 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -160,6 +160,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( + "1.51.7" => "01.05.2025 __createAdditionalEvents: optimized for SVG 'steps', new key plantControl->genPVforecastsToEvent ", "1.51.6" => "30.04.2025 graphicBeamXContent: change batsocforecast_XX to batsocCombi_XX, new options batsocForecast_XX, batsocReal_XX ". "new Paramaeter socprogwhsum, socwhsum in pvHisory & NextHours ", "1.51.5" => "28.04.2025 attr transformed: graphicBeamWidth, graphicHourCount, graphicEnergyUnit, graphicSpaceSize ". @@ -6714,6 +6715,7 @@ sub _attrplantControl { ## no critic "not used" cycleInterval => { comp => '\d+', act => 1 }, feedinPowerLimit => { comp => '\d+', act => 0 }, genPVdeviation => { comp => '(daily|continuously)', act => 1 }, + genPVforecastsToEvent => { comp => '(adapt4Steps)', act => 0 }, showLink => { comp => '(0|1)', act => 0 }, }; @@ -9381,18 +9383,26 @@ return; sub __createAdditionalEvents { my $paref = shift; my $name = $paref->{name}; - my $type = $paref->{type}; - my $hash = $defs{$name}; my $done = 0; + my $g2ev = CurrentVal ($name, 'genPVforecastsToEvent', ''); for my $idx (sort keys %{$data{$name}{nexthours}}) { - my $nhts = NexthoursVal ($hash, $idx, 'starttime', undef); - my $nhfc = NexthoursVal ($hash, $idx, 'pvfc', undef); + my $nhts = NexthoursVal ($name, $idx, 'starttime', undef); + my $nhfc = NexthoursVal ($name, $idx, 'pvfc', undef); next if(!defined $nhts || !defined $nhfc); - - $done = 1; + my ($dt, $h) = $nhts =~ /([\w-]+)\s(\d{2})/xs; + # https://forum.fhem.de/index.php?msg=1340607 + storeReading ('AllPVforecastsToEvent', "0 Wh", $dt." ".$h.":00:00") if(!$done); # vor dem ersten Prognosewert immer einen Nullwert setzen + + $done = 1; + + if ($g2ev eq 'adapt4Steps') { # für SVG 'steps'-Darstellung optimieren + storeReading ('AllPVforecastsToEvent', "0 Wh", $dt." ".$h.":00:00"); # jeden neuen Stundenwert mit 0 starten + storeReading ('AllPVforecastsToEvent', "$nhfc Wh", $dt." ".$h.":00:01"); + } + storeReading ('AllPVforecastsToEvent', "$nhfc Wh", $dt." ".$h.":59:59"); } @@ -25490,8 +25500,8 @@ to ensure that the system configuration is correct. batsocCombi_XX the predicted (from the next hour) and actual SOC (%) of the battery XX up to the current time batsocForecast_XX the predicted SOC (%) of the battery XX batsocReal_XX the real SOC (%) achieved by the battery XX - batsocForecastSum the predicted SOC (%) as a sum across all batteries - batsocRealSum the real SOC achieved (%) as a sum across all batteries + batsocForecastSum the predicted SOC (%) as the resultant across all batteries + batsocRealSum the real SOC achieved (%) as the resultant across all batteries consumption Energy consumption consumptionForecast forecasted energy consumption energycosts Cost of energy purchased from the grid. The currency is defined in the setupMeterDev, key conprice. @@ -25818,6 +25828,11 @@ to ensure that the system configuration is correct. daily - Calculation and creation of Today_PVdeviation takes place after sunset (default) continuously - Calculation and creation of Today_PVdeviation is continuous + genPVforecastsToEvent The module generates daily ‘AllPVforecastsToEvent’ events to visualize the PV forecast. + Further explanations can be found in the german Wiki. + Event generation can be optimized for specific uses. + adapt4Steps - the events are optimized for the SVG Plot-Type 'steps' + showLink Display of a link to the detailed view of the device above the graphics area 0 - Display off, 1 - Display on, default: 0 @@ -25826,7 +25841,7 @@ to ensure that the system configuration is correct. @@ -28020,8 +28035,8 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. batsocCombi_XX der prognostizierte (ab kommender Stunde) und bis zur aktuellen Zeit real erreichte SOC (%) der Batterie XX batsocForecast_XX der prognostizierte SOC (%) der Batterie XX batsocReal_XX der real erreichte SOC (%) der Batterie XX - batsocForecastSum der prognostizierte SOC (%) als Summe über alle Batterien - batsocRealSum der real erreichte SOC (%) als Summe über alle Batterien + batsocForecastSum der prognostizierte SOC (%) als Resultierende über alle Batterien + batsocRealSum der real erreichte SOC (%) als Resultierende über alle Batterien consumption Energieverbrauch consumptionForecast prognostizierter Energieverbrauch energycosts Kosten des Energiebezuges aus dem Netz. Die Währung ist im setupMeterDev, Schlüssel conprice, definiert. @@ -28346,6 +28361,11 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. daily - Berechnung und Erstellung von Today_PVdeviation erfolgt nach Sonnenuntergang (default) continuously - Berechnung und Erstellung von Today_PVdeviation erfolgt fortlaufend + genPVforecastsToEvent Das Modul erzeugt täglich 'AllPVforecastsToEvent'-Events zur Visualisierung der PV Prognose. + Nähere Erläuterungen dazu sind im Wiki beschrieben. + Die Eventerzeugung kann für bestimmte Nutzungen optimiert werden. + adapt4Steps - die Events werden für den SVG Plot-Type 'steps' optimiert + showLink Anzeige eines Links zur Detailansicht des Device über dem Grafikbereich 0 - Anzeige aus, 1 - Anzeige an, default: 0 @@ -28354,7 +28374,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.