From 30bc9f7064584312b31dff2c350eb8f3ad57d45f Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Wed, 10 Jun 2020 17:21:30 +0000 Subject: [PATCH] 76_SMAPortal: bug fixes get/switch consumers git-svn-id: https://svn.fhem.de/fhem/trunk@22153 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/76_SMAPortal.pm | 9 +++++---- fhem/contrib/DS_Starter/76_SMAPortal.pm | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/76_SMAPortal.pm b/fhem/FHEM/76_SMAPortal.pm index e00a29c40..ad2939c03 100644 --- a/fhem/FHEM/76_SMAPortal.pm +++ b/fhem/FHEM/76_SMAPortal.pm @@ -718,7 +718,7 @@ sub controlParams { my $name = shift; # Voreinstellungen - my $timeout = 290; # Standard Timeout + my $timeoutdef = 290; # Standard Timeout my $definterval = 300; # Standard Interval my $buffer = 5; # Sicherheitspuffer zum nächsten Intervall @@ -732,14 +732,15 @@ sub controlParams { $ctime = 7 if($ctime > 7); # Ausreißer ignorieren if(!$interval) { # manueller Datenabruf - return ($interval,$maxcycles,$timeout,$ctime); + return ($interval,$maxcycles,$timeoutdef,$ctime); } # max Anzahl Zyklen $maxcycles = int(($interval - $buffer) / $ctime) if($ctime); # Timeout kalkulieren - $timeout = int(($maxcycles * $ctime) + $proctime - $buffer); + my $timeout = int(($maxcycles * $ctime) + $proctime - $buffer); + $timeout = $timeoutdef if($timeout < 10); return ($interval,$maxcycles,$timeout,$ctime); } @@ -1337,7 +1338,7 @@ sub ParseData { ## no critic $op = ($op eq "auto") ? "off (automatic)" : $op; readingsBulkUpdate($hash, "L3_${d}_Switch", $op); } - readingsBulkUpdate($hash, "lastCycleTime", $ctime); + readingsBulkUpdate($hash, "lastCycleTime", $ctime) if($ctime > 0); readingsBulkUpdate($hash, "summary" , "$sum W"); } else { diff --git a/fhem/contrib/DS_Starter/76_SMAPortal.pm b/fhem/contrib/DS_Starter/76_SMAPortal.pm index 250a891ab..9470a6eef 100644 --- a/fhem/contrib/DS_Starter/76_SMAPortal.pm +++ b/fhem/contrib/DS_Starter/76_SMAPortal.pm @@ -718,7 +718,7 @@ sub controlParams { my $name = shift; # Voreinstellungen - my $timeout = 290; # Standard Timeout + my $timeoutdef = 290; # Standard Timeout my $definterval = 300; # Standard Interval my $buffer = 5; # Sicherheitspuffer zum nächsten Intervall @@ -732,14 +732,15 @@ sub controlParams { $ctime = 7 if($ctime > 7); # Ausreißer ignorieren if(!$interval) { # manueller Datenabruf - return ($interval,$maxcycles,$timeout,$ctime); + return ($interval,$maxcycles,$timeoutdef,$ctime); } # max Anzahl Zyklen $maxcycles = int(($interval - $buffer) / $ctime) if($ctime); # Timeout kalkulieren - $timeout = int(($maxcycles * $ctime) + $proctime - $buffer); + my $timeout = int(($maxcycles * $ctime) + $proctime - $buffer); + $timeout = $timeoutdef if($timeout < 10); return ($interval,$maxcycles,$timeout,$ctime); } @@ -1337,7 +1338,7 @@ sub ParseData { ## no critic $op = ($op eq "auto") ? "off (automatic)" : $op; readingsBulkUpdate($hash, "L3_${d}_Switch", $op); } - readingsBulkUpdate($hash, "lastCycleTime", $ctime); + readingsBulkUpdate($hash, "lastCycleTime", $ctime) if($ctime > 0); readingsBulkUpdate($hash, "summary" , "$sum W"); } else {