added attr disable - 0,1 - set attribute to 1 to disable periodical requests to the api

This commit is contained in:
Philipp Wo 2024-12-23 10:31:11 +01:00
parent dc17b52fca
commit 7983f00e57

View File

@ -1,5 +1,5 @@
#===============================================================================
# $Id: 98_TadoAPI.pm 107 2023-12-16 16:11:28Z psycho160 $
# $Id: 98_TadoAPI.pm 107 2024-12-23 07:15:20Z psycho160 $
#
# FILE: 98_TadoAPI.pm
#
@ -76,6 +76,7 @@ sub TadoAPI_Initialize {
. "mobileID "
. "showPosData:0,1 "
. "updateIntervall "
. "disable:0,1 "
. $readingFnAttributes;
return;
@ -106,6 +107,7 @@ sub TadoAPI_Define {
. "define <name> TadoAPI <username>"
if ( int(@a) < 1 );
my ( $user, $homeID ) = @a;
Log3 $name, 3, "TadoAPI_Define $name: called ";
$hash->{STATE} = "defined";
@ -662,6 +664,12 @@ sub TadoAPI_Update {
Log3 $name, 5, "TadoAPI $name" . ": " . "TadoAPI_Update called";
if ( AttrVal( $name, "disable", 0 ) == 1 ){
Log3 $name, 3, "TadoAPI: $name global disabled (attr) :-(";
$hash->{STATE} = "disabled";
return;
}
my $nextTimer = "none";
my $intervall = 300;
@ -866,6 +874,8 @@ sub TadoAPI_UpdateFn {
my $CurrentTokenData = TadoAPI_LoadToken($hash);
my $homeID = $attr{$name}{homeID};
return $hash->{STATE} = "disabled" if ( AttrVal( $name, "disable", 0 ) == 1 );
if ( $apiStatus == 1 && defined($CurrentTokenData) ) {
# zone specific updates