set update intervall per attr

This commit is contained in:
Philipp Wo 2019-11-23 12:47:42 +01:00
parent 5094dda70b
commit 0051426f7f
1 changed files with 10 additions and 10 deletions

View File

@ -74,6 +74,7 @@ TadoAPI_Initialize($)
$hash->{AttrList} =
"homeID " .
"mobileID " .
"updateIntervall " .
$main::readingFnAttributes;
}
@ -123,7 +124,7 @@ sub TadoAPI_Define($$)
# start the status update timer
RemoveInternalTimer($hash);
InternalTimer( gettimeofday() + 10, "TadoAPI_Update", $hash, 0 );
InternalTimer( gettimeofday() + 15, "TadoAPI_Update", $hash, 0 );
if ( defined($homeID) && $homeID ne "" ) {
$attr{$name}{homeID} = $homeID;
@ -511,15 +512,14 @@ sub TadoAPI_Update(@){
Log3 $name, 5, "TadoAPI $name" . ": " . "TadoAPI_Update called";
# timer loop
#
my $nextTimer = "none";
# if api online, try again in 5 minutes
my $intervall = 300;
$intervall = $attr{$name}{updateIntervall} if (defined($attr{$name}{updateIntervall}) && $attr{$name}{updateIntervall} =~ m/^-?\d+$/);
# if api online, try again in xx minutes
if ( $apiStatus ) {
$nextTimer = gettimeofday() + 300;
$nextTimer = gettimeofday() + $intervall;
}
Log3 $name, 5, "TadoAPI $name" . ": " . "Next Timer = $nextTimer";
RemoveInternalTimer($hash);
InternalTimer( $nextTimer, "TadoAPI_Update", $hash, 0 );
@ -1383,9 +1383,9 @@ sub TadoAPI_readPassword($)
<a name="TadoAPIdefine"></a>
<b>Define</b>
<ul>
The username and password must match the username and password used on the Tado website.
After successful define, store PASSWORD with set &lt;name&gt; password &lt;your-tado-password&gt;
Password is sored in encrypted FHEM store. All requests to the API are via oauth2 token.<br>
The username and password must match the username and password used on the Tado website.<br>
After successful define, store PASSWORD with <code>set &lt;name&gt; password &lt;your-tado-password&gt;</code>.<br>
Note: Password is encrypted and saved in FHEM uniqueID file. All requests to the API are handeld via oauth2 token.<br>
Examples:
<ul><code>