2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-24 02:59:22 +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:
dietmar63 2015-07-13 20:41:54 +00:00
parent fbdfb0e346
commit bbb5759b0b

View File

@ -28,7 +28,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
use IO::Socket; # use IO::Socket;
use Time::HiRes qw(gettimeofday); use Time::HiRes qw(gettimeofday);
use Time::Local 'timelocal_nocheck'; use Time::Local 'timelocal_nocheck';
@ -162,7 +162,6 @@ sub RandomTimer_Exec($) {
if ($active) { if ($active) {
# wenn temporär ausgeschaltet # wenn temporär ausgeschaltet
if ($disabled) { if ($disabled) {
#Log3 $hash, 3, "[".$hash->{NAME}. "] RandomTimer for $hash->{DEVICE} going down";
Log3 $hash, 3, "[".$hash->{NAME}."]"." ending RandomTimer on $hash->{DEVICE}: " 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->{startTime})) . " - "
. strftime("%H:%M:%S(%d)",localtime($hash->{stopTime})); . strftime("%H:%M:%S(%d)",localtime($hash->{stopTime}));
@ -401,17 +400,20 @@ sub RandomTimer_device_switch ($)
sub RandomTimer_isDisabled($) { sub RandomTimer_isDisabled($) {
my ($hash) = @_; my ($hash) = @_;
my $disable = AttrVal($hash->{NAME}, "disable", 0 ); my $disable = AttrVal($hash->{NAME}, "disable", 0 );
my $disableCond = AttrVal($hash->{NAME}, "disableCond", 0 ); return $disable if($disable);
$disable = $disable || eval ($disableCond); my $disableCond = AttrVal($hash->{NAME}, "disableCond", "nf" );
if ($@) { if ($disableCond eq "nf") {
$@ =~ s/\n/ /g; return 0;
Log3 ($hash, 3, "[$hash->{NAME}] ERROR: " . $@ . " EVALUATING " . $disableCond); } 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()} sub RandomTimer_Wakeup() { # {RandomTimer_Wakeup()}