FRITZBOX: interval during disable

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@16264 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tupol 2018-02-25 16:33:46 +00:00
parent 7c8da9cb05
commit e73f7ad612
2 changed files with 15 additions and 11 deletions

View File

@ -1069,11 +1069,13 @@ LUXTRONIK2_UpdateDone($)
} }
# 76 userHeatpumpParameters # 76 userHeatpumpParameters
if (defined $a[76]) {
my @userReadings = split /,/, $a[76]; my @userReadings = split /,/, $a[76];
foreach (@userReadings) { foreach (@userReadings) {
my( $rName, $rValue) = split / /, $_; my( $rName, $rValue) = split / /, $_;
readingsBulkUpdate($hash, $rName, $rValue); readingsBulkUpdate($hash, $rName, $rValue);
} }
}
readingsEndUpdate($hash,1); readingsEndUpdate($hash,1);

View File

@ -318,7 +318,7 @@ sub FRITZBOX_Attr($@)
} }
} }
if ($aName =~ /fritzBoxIP|m3uFileLocal|m3uFileURL/ && $hash->{APICHECKED} == 1) { if ( $aName =~ /fritzBoxIP|m3uFileLocal|m3uFileURL/ && $hash->{APICHECKED} == 1 || $aName eq "disable" ) {
$hash->{APICHECKED} = 0; $hash->{APICHECKED} = 0;
RemoveInternalTimer($hash->{helper}{TimerReadout}); RemoveInternalTimer($hash->{helper}{TimerReadout});
InternalTimer(gettimeofday(), "FRITZBOX_Readout_Start", $hash->{helper}{TimerReadout}, 1); InternalTimer(gettimeofday(), "FRITZBOX_Readout_Start", $hash->{helper}{TimerReadout}, 1);
@ -650,13 +650,15 @@ sub FRITZBOX_Readout_Start($)
my ($timerpara) = @_; my ($timerpara) = @_;
# my ( $name, $func ) = split( /\./, $timerpara ); # my ( $name, $func ) = split( /\./, $timerpara );
my $index = rindex( $timerpara, "." ); # rechter punkt my $index = rindex( $timerpara, "." ); # rechter Punkt
my $func = substr $timerpara, $index + 1, length($timerpara); # function extrahieren my $func = substr $timerpara, $index + 1, length($timerpara); # function extrahieren
my $name = substr $timerpara, 0, $index; # name extrahieren my $name = substr $timerpara, 0, $index; # name extrahieren
my $hash = $defs{$name}; my $hash = $defs{$name};
my $runFn; my $runFn;
my $disable = AttrVal( $name, "disable", 0 );
# Set timer value (min. 60) # Set timer value (min. 60)
$hash->{INTERVAL} = AttrVal( $name, "INTERVAL", $hash->{INTERVAL} ); $hash->{INTERVAL} = AttrVal( $name, "INTERVAL", $hash->{INTERVAL} );
$hash->{INTERVAL} = 60 if $hash->{INTERVAL} < 60 && $hash->{INTERVAL} != 0; $hash->{INTERVAL} = 60 if $hash->{INTERVAL} < 60 && $hash->{INTERVAL} != 0;
@ -664,7 +666,7 @@ sub FRITZBOX_Readout_Start($)
my $interval = $hash->{INTERVAL}; my $interval = $hash->{INTERVAL};
# First run is an API check # First run is an API check
unless ( $hash->{APICHECKED} ) { unless ( $hash->{APICHECKED} && ! $disable ) {
$interval = 10; $interval = 10;
$hash->{STATE} = "Check APIs"; $hash->{STATE} = "Check APIs";
$runFn = "FRITZBOX_API_Check_Run"; $runFn = "FRITZBOX_API_Check_Run";
@ -678,7 +680,7 @@ sub FRITZBOX_Readout_Start($)
if( $interval != 0 ) { if( $interval != 0 ) {
RemoveInternalTimer($hash->{helper}{TimerReadout}); RemoveInternalTimer($hash->{helper}{TimerReadout});
InternalTimer(gettimeofday()+$interval, "FRITZBOX_Readout_Start", $hash->{helper}{TimerReadout}, 1); InternalTimer(gettimeofday()+$interval, "FRITZBOX_Readout_Start", $hash->{helper}{TimerReadout}, 1);
if( AttrVal( $name, "disable", 0 ) == 1 ) { if( $disable ) {
readingsSingleUpdate( $hash, "state", "disabled", 1 ); readingsSingleUpdate( $hash, "state", "disabled", 1 );
return undef; return undef;
} }