From ef8d164307b8cb31af70b402bb10c4a7618db11c Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Fri, 21 Jul 2023 12:01:40 +0000 Subject: [PATCH] 76_Solarforcast: contrib 0.80.13 git-svn-id: https://svn.fhem.de/fhem/trunk@27788 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/76_SolarForecast.pm | 50 +++++++++++++-------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index a0ca7a463..54155aea6 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -1,5 +1,5 @@ ######################################################################################################################## -# $Id: 76_SolarForecast.pm 21735 2023-07-18 23:53:24Z DS_Starter $ +# $Id: 76_SolarForecast.pm 21735 2023-07-21 23:53:24Z DS_Starter $ ######################################################################################################################### # 76_SolarForecast.pm # @@ -136,7 +136,8 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "0.80.13"=> "18.07.2023 include parameter DoN in nextHours hash, new KPI's todayConForecastTillSunset, currentRunMtsConsumer_XX ", + "0.80.13"=> "18.07.2023 include parameter DoN in nextHours hash, new KPI's todayConForecastTillSunset, currentRunMtsConsumer_XX ". + "minor fixes and improvements ", "0.80.12"=> "16.07.2023 preparation for alternative switch device in consumer attribute, revise CommandRef ". "fix/improve sub ___readCandQ and much more, get pvHistory -> one specific day selectable ". "get valConsumerMaster -> one specific consumer selectable, enhance consumer key locktime by on-locktime ", @@ -5953,11 +5954,11 @@ sub ___switchConsumerOn { my $cname = ConsumerVal ($hash, $c, 'name', ''); # Consumer Device Name my $calias = ConsumerVal ($hash, $c, 'alias', ''); # Consumer Device Alias - my ($swoncond,$swoffcond,$info,$err); - ($swoncond,$info,$err) = isAddSwitchOnCond ($hash, $c); # zusätzliche Switch on Bedingung + my ($swoncond,$swoffcond,$infon,$infoff,$err); + ($swoncond,$infon,$err) = isAddSwitchOnCond ($hash, $c); # zusätzliche Switch on Bedingung Log3 ($name, 1, "$name - $err") if($err); - ($swoffcond,$info,$err) = isAddSwitchOffCond ($hash, $c); # zusätzliche Switch off Bedingung + ($swoffcond,$infoff,$err) = isAddSwitchOffCond ($hash, $c); # zusätzliche Switch off Bedingung Log3 ($name, 1, "$name - $err") if($err); my ($iilt,$rlt) = isInLocktime ($paref); # Sperrzeit Status ermitteln @@ -5977,6 +5978,8 @@ sub ___switchConsumerOn { Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - current Context is switching "on" => }. qq{swoncond: $swoncond, on-command: $oncom } ); + Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - isAddSwitchOnCond Info: $infon}) if($swoncond && $infon); + Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - isAddSwitchOffCond Info: $infoff}) if($swoffcond && $infoff); if (simplifyCstate($pstate) =~ /planned|priority|starting/xs && isInTimeframe ($hash, $c) && $iilt) { Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - switching on postponed by >isInLocktime<}); @@ -6050,7 +6053,8 @@ sub ___switchConsumerOff { my $c = $paref->{consumer}; my $t = $paref->{t}; # aktueller Unixtimestamp my $state = $paref->{state}; - + my $debug = $paref->{debug}; + my $pstate = ConsumerVal ($hash, $c, "planstate", ""); my $stopts = ConsumerVal ($hash, $c, "planswitchoff", undef); # geplante Unix Stopzeit my $auto = ConsumerVal ($hash, $c, "auto", 1); @@ -6059,20 +6063,31 @@ sub ___switchConsumerOff { my $mode = ConsumerVal ($hash, $c, "mode", $defcmode); # Consumer Planungsmode my $hyst = ConsumerVal ($hash, $c, "hysteresis", $defhyst); # Hysterese - my $offcom = ConsumerVal ($hash, $c, "offcom", ""); # Set Command für "off" - my ($swoffcond,$info,$err) = isAddSwitchOffCond ($hash, $c); # zusätzliche Switch off Bedingung + my $offcom = ConsumerVal ($hash, $c, "offcom", ""); # Set Command für "off" + my ($swoffcond,$infoff,$err) = isAddSwitchOffCond ($hash, $c); # zusätzliche Switch off Bedingung my $cause; Log3 ($name, 1, "$name - $err") if($err); my ($iilt,$rlt) = isInLocktime ($paref); # Sperrzeit Status ermitteln - debugLog ($paref, "consumerSwitching", qq{consumer "$c" - current Context is switching "off" => }. - qq{swoffcond: $swoffcond, off-command: $offcom}); - - if ($stopts && $t >= $stopts && $iilt) { - debugLog ($paref, "consumerSwitching", qq{consumer "$c" - switching off postponed by >isInLocktime<}); + if ($debug =~ /consumerSwitching/x) { # nur für Debugging + Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - current Context is switching "off" => }. + qq{swoffcond: $swoffcond, off-command: $offcom} + ); + Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - isAddSwitchOffCond Info: $infoff}) if($swoffcond && $infoff); + + if ($stopts && $t >= $stopts && $iilt) { + Log3 ($name, 1, qq{$name DEBUG> consumer "$c" - switching off postponed by >isInLocktime<}); + } } + + #debugLog ($paref, "consumerSwitching", qq{consumer "$c" - current Context is switching "off" => }. + # qq{swoffcond: $swoffcond, off-command: $offcom}); + + #if ($stopts && $t >= $stopts && $iilt) { + # debugLog ($paref, "consumerSwitching", qq{consumer "$c" - switching off postponed by >isInLocktime<}); + #} if(($swoffcond || ($stopts && $t >= $stopts)) && !$iilt && ($auto && $offcom && simplifyCstate($pstate) =~ /started|starting|stopping|interrupt|continu/xs)) { @@ -9114,9 +9129,8 @@ sub substConsumerIcon { my $hash = shift; my $c = shift; - my $name = $hash->{NAME}; - - my $cicon = ConsumerVal ($hash, $c, "icon", ""); # Icon des Consumerdevices angegeben ? + my $name = $hash->{NAME}; + my $cicon = ConsumerVal ($hash, $c, "icon", ""); # Icon des Consumerdevices angegeben ? if (!$cicon) { $cicon = 'light_light_dim_100'; @@ -13090,9 +13104,9 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. auto Reading im Verbraucherdevice welches das Schalten des Verbrauchers freigibt bzw. blockiert (optional) Readingwert = 1 - Schalten freigegeben (default), 0: Schalten blockiert pcurr Reading:Einheit (W/kW) welches den aktuellen Energieverbrauch liefert (optional) - :<Schwellenwert> (W) - aktuelle Leistung ab welcher der Verbraucher als aktiv gewertet wird. + :<Schwellenwert> (W) - Ab diesem Leistungsbezug wird der Verbraucher als aktiv gewertet. Die Angabe ist optional (default: 0) etotal Reading:Einheit (Wh/kWh) des Consumer Device, welches die Summe der verbrauchten Energie liefert (optional) - :<Schwellenwert> (Wh) - Energieverbrauch pro Stunde ab dem der Verbrauch als gültig gewertet wird. + :<Schwellenwert> (Wh) - Ab diesem Energieverbrauch pro Stunde wird der Verbrauch als gültig gewertet. Optionale Angabe (default: 0) swoncond Bedingung die zusätzlich erfüllt sein muß um den Verbraucher einzuschalten (optional). Der geplante Zyklus wird gestartet. Device - Device zur Lieferung der zusätzlichen Einschaltbedingung Reading - Reading zur Lieferung der zusätzlichen Einschaltbedingung