From 8ef726bd3d6a63e9cb35cb435ff2c3902a3f744c Mon Sep 17 00:00:00 2001 From: mike3436 <> Date: Fri, 5 Mar 2021 10:14:51 +0000 Subject: [PATCH] 26_tahoma.pm:2021-03-05 V 0223 new Attributes intervalLoginMin and intervalLoginMax git-svn-id: https://svn.fhem.de/fhem/trunk@23890 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/26_tahoma.pm | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/26_tahoma.pm b/fhem/FHEM/26_tahoma.pm index 9886a6ab1..ae6c98b0c 100644 --- a/fhem/FHEM/26_tahoma.pm +++ b/fhem/FHEM/26_tahoma.pm @@ -57,6 +57,7 @@ # 2019-02-08 V 0221 new Attribute devName to set personal name instead of 'iPhone' # 2019-05-26 V 0222 correct parse of result in EnduserAPISetupGateways # 2019-06-15 V 0222 new Attribute levelRound +# 2021-03-05 V 0223 new Attributes intervalLoginMin and intervalLoginMax package main; @@ -97,6 +98,8 @@ sub tahoma_Initialize($) "intervalRefresh ". "intervalEvents ". "intervalStates ". + "intervalLoginMin ". + "intervalLoginMax ". "logfile ". "url ". "placeClasses ". @@ -134,7 +137,7 @@ sub tahoma_Define($$) my @a = split("[ \t][ \t]*", $def); - my $ModuleVersion = "0221"; + my $ModuleVersion = "0223"; my $subtype; my $name = $a[0]; @@ -218,6 +221,8 @@ sub tahoma_Define($$) $hash->{getEventsInterval} = 2; $hash->{refreshStatesInterval} = 120; $hash->{getStatesInterval} = 0; + $hash->{getLoginIntervalMin} = 5; + $hash->{getLoginIntervalMax} = 160; } else { return "Usage: define tahoma device\ @@ -303,8 +308,9 @@ sub tahoma_login($) $hash->{userAgent} = $attr{$name}{userAgent} if (defined $attr{$name}{userAgent}); $hash->{timeout} = 10; $hash->{HTTPCookies} = undef; - $hash->{loginRetryTimer} = 5 if (!defined $hash->{loginRetryTimer}); - $hash->{loginRetryTimer} *= 2 if ($hash->{loginRetryTimer} < 160); + $hash->{loginRetryTimer} = $hash->{getLoginIntervalMin} if (!defined $hash->{loginRetryTimer}); + $hash->{loginRetryTimer} *= 2 if ($hash->{loginRetryTimer} < $hash->{getLoginIntervalMax}); + $hash->{loginRetryTimer} = $hash->{getLoginIntervalMax} if ($hash->{loginRetryTimer} > $hash->{getLoginIntervalMax}); $hash->{eventId} = undef; Log3 $name, 2, "$name: login start"; @@ -1119,7 +1125,7 @@ sub tahoma_parseLogin($$) } else { $hash->{inVersion} = $json->{version}; $hash->{logged_in} = 1; - $hash->{loginRetryTimer} = 5; + $hash->{loginRetryTimer} = $hash->{getLoginIntervalMin}; } Log3 $name, 2, "$name: login end, logged_in=".$hash->{logged_in}; } @@ -1598,6 +1604,20 @@ sub tahoma_Attr($$$) $attrVal = int($attrVal); $attrVal = 2 if ($attrVal < 2 && $attrVal != 0); $hash->{getEventsInterval} = $attrVal; + } elsif( $attrName eq "intervalLoginMin" ) { + my $hash = $defs{$name}; + return "Attribute 'intervalLoginMin' only usable for type ACCOUNT" if $hash->{SUBTYPE} ne "ACCOUNT"; + $attrVal = defined $attrVal ? int($attrVal) : 2; + $attrVal = int($attrVal); + $attrVal = 2 if ($attrVal < 2 && $attrVal != 0); + $hash->{getLoginIntervalMin} = $attrVal; + } elsif( $attrName eq "intervalLoginMax" ) { + my $hash = $defs{$name}; + return "Attribute 'intervalLoginMax' only usable for type ACCOUNT" if $hash->{SUBTYPE} ne "ACCOUNT"; + $attrVal = defined $attrVal ? int($attrVal) : 2; + $attrVal = int($attrVal); + $attrVal = 160 if ($attrVal < 160 && $attrVal != 0); + $hash->{getLoginIntervalMax} = $attrVal; } elsif( $attrName eq "disable" ) { my $hash = $defs{$name}; RemoveInternalTimer($hash); @@ -1855,7 +1875,17 @@ sub tahoma_decrypt($) + +
local Attributes for DEVICE: