This commit is contained in:
2016-03-27 16:58:01 +02:00
committed by Marc Hoppe
parent 84c27863f6
commit e88e701a59
2 changed files with 43 additions and 3 deletions

View File

@@ -279,8 +279,17 @@ sub RollCheck() {
my $tempOut=ReadingsVal("wetter", "temp_c", 99);
my $twil=Value("twil");
if($twil>=3 && $twil<10) { # civil
if ($twil>=3 && $twil<10) { # civil
$tag=1;
myfhem("set tag 1");
} else {
myfhem("set tag 0");
}
my $light=ReadingsVal("twil", "light", 0);
if ($light>=5) { # weather
myfhem("set hell 1");
} else {
myfhem("set hell 0");
}
my $wett=ReadingsVal("wetter", "code", 99);
@@ -343,7 +352,7 @@ sub RollCheck() {
}
}
#Dbg("RollCheck:$r->{roll}-tempH:$tempH temp:$temp tempO:$tempOut so:$sonne wett:$wett sr:$sr twil:$twil tag:$tag fen:$fen skipR:$skipRunter skipH:$skipHoch st:$r->{state}");
Dbg("RollCheck:$r->{roll}-tempH:$tempH temp:$temp tempO:$tempOut so:$sonne wett:$wett sr:$sr twil:$twil tag:$tag fen:$fen skipR:$skipRunter skipH:$skipHoch st:$r->{state}");
if( $tag and $sonne and $tempH) {
if($r->{state}!=STATE_SCHLITZ) {

View File

@@ -54,7 +54,7 @@ SetExtensions($$@)
}
if($se_list{$cmd} && $se_list{$cmd} != int(@a)) {
return "$cmd requires $se_list{$cmd} parameter";
}
se }
my $cmd1 = ($cmd =~ m/^on.*/ ? "on" : "off");
my $cmd2 = ($cmd =~ m/^on.*/ ? "off" : "on");
@@ -62,13 +62,42 @@ SetExtensions($$@)
if($cmd eq "on-for-timer" || $cmd eq "off-for-timer") {
RemoveInternalTimer("SE $name $cmd");
delete($hash->{SE_TIMERRUNNING});
return "$cmd requires a number as argument" if($param !~ m/^\d*\.?\d*$/);
if($param) {
$hash->{SE_TIMERRUNNING} = $cmd;
DoSet($name, $cmd1);
InternalTimer(gettimeofday()+$param,"SetExtensionsFn","SE $name $cmd",0);
}
} elsif($cmd eq "on-for-timer-when-off") {
my $startTimer=1;
my $timercmd="on-for-timer";
if(!$hash->{SE_TIMERRUNNING}) {
my $actualState = ReadingsVal($name, "state", undef);
if($actualState eq $cmd1) {
$startTimer=0; # started Manually do not override by timer
}
}
if($startTimer) {
RemoveInternalTimer("SE $name $timercmd");
delete($hash->{SE_TIMERRUNNING});
return "$cmd requires a number as argument" if($param !~ m/^\d*\.?\d*$/);
if($param) {
$hash->{SE_TIMERRUNNING} = $timercmd;
DoSet($name, $cmd1);
InternalTimer(gettimeofday()+$param,"SetExtensionsFn","SE $name $timercmd",0);
}
}
} elsif($cmd eq "on-stop-timer" ) {
my $timercmd="on-for-timer";
RemoveInternalTimer("SE $name $timercmd");
delete($hash->{SE_TIMERRUNNING});
DoSet($name, $cmd1);
} elsif($cmd =~ m/^(on|off)-till/) {
my ($err, $hr, $min, $sec, $fn) = GetTimeSpec($param);
return "$cmd: $err" if($err);
@@ -154,9 +183,11 @@ SetExtensionsFn($)
if($cmd eq "on-for-timer") {
$defs{$name}{SE_TIMERRUNNING}="";
DoSet($name, "off");
} elsif($cmd eq "off-for-timer") {
$defs{$name}{SE_TIMERRUNNING}="";
DoSet($name, "on");
} elsif($cmd eq "blink" && $defs{$name}{SE_BLINKPARAM}) {