mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
98_RandomTimer: a try to avoid the problem of article http://forum.fhem.de/index.php/topic,14010.msg310929.html#msg310929
git-svn-id: https://svn.fhem.de/fhem/trunk@8959 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
fbdfb0e346
commit
bbb5759b0b
@ -28,7 +28,7 @@ package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use IO::Socket;
|
||||
# use IO::Socket;
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
use Time::Local 'timelocal_nocheck';
|
||||
|
||||
@ -162,7 +162,6 @@ sub RandomTimer_Exec($) {
|
||||
if ($active) {
|
||||
# wenn temporär ausgeschaltet
|
||||
if ($disabled) {
|
||||
#Log3 $hash, 3, "[".$hash->{NAME}. "] RandomTimer for $hash->{DEVICE} going down";
|
||||
Log3 $hash, 3, "[".$hash->{NAME}."]"." ending RandomTimer on $hash->{DEVICE}: "
|
||||
. strftime("%H:%M:%S(%d)",localtime($hash->{startTime})) . " - "
|
||||
. strftime("%H:%M:%S(%d)",localtime($hash->{stopTime}));
|
||||
@ -401,17 +400,20 @@ sub RandomTimer_device_switch ($)
|
||||
sub RandomTimer_isDisabled($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
my $disable = AttrVal($hash->{NAME}, "disable", 0 );
|
||||
my $disableCond = AttrVal($hash->{NAME}, "disableCond", 0 );
|
||||
my $disable = AttrVal($hash->{NAME}, "disable", 0 );
|
||||
return $disable if($disable);
|
||||
|
||||
$disable = $disable || eval ($disableCond);
|
||||
if ($@) {
|
||||
$@ =~ s/\n/ /g;
|
||||
Log3 ($hash, 3, "[$hash->{NAME}] ERROR: " . $@ . " EVALUATING " . $disableCond);
|
||||
my $disableCond = AttrVal($hash->{NAME}, "disableCond", "nf" );
|
||||
if ($disableCond eq "nf") {
|
||||
return 0;
|
||||
} else {
|
||||
$disable = eval ($disableCond);
|
||||
if ($@) {
|
||||
$@ =~ s/\n/ /g;
|
||||
Log3 ($hash, 3, "[$hash->{NAME}] ERROR: " . $@ . " EVALUATING " . $disableCond);
|
||||
}
|
||||
return $disable;
|
||||
}
|
||||
$disable = 0 if (!defined($disable));
|
||||
|
||||
return $disable;
|
||||
}
|
||||
########################################################################
|
||||
sub RandomTimer_Wakeup() { # {RandomTimer_Wakeup()}
|
||||
|
Loading…
Reference in New Issue
Block a user