...
This commit is contained in:
@@ -281,6 +281,15 @@ sub RollCheck() {
|
|||||||
my $twil=Value("twil");
|
my $twil=Value("twil");
|
||||||
if ($twil>=3 && $twil<10) { # civil
|
if ($twil>=3 && $twil<10) { # civil
|
||||||
$tag=1;
|
$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);
|
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( $tag and $sonne and $tempH) {
|
||||||
if($r->{state}!=STATE_SCHLITZ) {
|
if($r->{state}!=STATE_SCHLITZ) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ SetExtensions($$@)
|
|||||||
}
|
}
|
||||||
if($se_list{$cmd} && $se_list{$cmd} != int(@a)) {
|
if($se_list{$cmd} && $se_list{$cmd} != int(@a)) {
|
||||||
return "$cmd requires $se_list{$cmd} parameter";
|
return "$cmd requires $se_list{$cmd} parameter";
|
||||||
}
|
‚se }
|
||||||
|
|
||||||
my $cmd1 = ($cmd =~ m/^on.*/ ? "on" : "off");
|
my $cmd1 = ($cmd =~ m/^on.*/ ? "on" : "off");
|
||||||
my $cmd2 = ($cmd =~ m/^on.*/ ? "off" : "on");
|
my $cmd2 = ($cmd =~ m/^on.*/ ? "off" : "on");
|
||||||
@@ -62,13 +62,42 @@ SetExtensions($$@)
|
|||||||
|
|
||||||
if($cmd eq "on-for-timer" || $cmd eq "off-for-timer") {
|
if($cmd eq "on-for-timer" || $cmd eq "off-for-timer") {
|
||||||
RemoveInternalTimer("SE $name $cmd");
|
RemoveInternalTimer("SE $name $cmd");
|
||||||
|
delete($hash->{SE_TIMERRUNNING});
|
||||||
return "$cmd requires a number as argument" if($param !~ m/^\d*\.?\d*$/);
|
return "$cmd requires a number as argument" if($param !~ m/^\d*\.?\d*$/);
|
||||||
|
|
||||||
if($param) {
|
if($param) {
|
||||||
|
$hash->{SE_TIMERRUNNING} = $cmd;
|
||||||
DoSet($name, $cmd1);
|
DoSet($name, $cmd1);
|
||||||
InternalTimer(gettimeofday()+$param,"SetExtensionsFn","SE $name $cmd",0);
|
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/) {
|
} elsif($cmd =~ m/^(on|off)-till/) {
|
||||||
my ($err, $hr, $min, $sec, $fn) = GetTimeSpec($param);
|
my ($err, $hr, $min, $sec, $fn) = GetTimeSpec($param);
|
||||||
return "$cmd: $err" if($err);
|
return "$cmd: $err" if($err);
|
||||||
@@ -154,9 +183,11 @@ SetExtensionsFn($)
|
|||||||
|
|
||||||
|
|
||||||
if($cmd eq "on-for-timer") {
|
if($cmd eq "on-for-timer") {
|
||||||
|
$defs{$name}{SE_TIMERRUNNING}="";
|
||||||
DoSet($name, "off");
|
DoSet($name, "off");
|
||||||
|
|
||||||
} elsif($cmd eq "off-for-timer") {
|
} elsif($cmd eq "off-for-timer") {
|
||||||
|
$defs{$name}{SE_TIMERRUNNING}="";
|
||||||
DoSet($name, "on");
|
DoSet($name, "on");
|
||||||
|
|
||||||
} elsif($cmd eq "blink" && $defs{$name}{SE_BLINKPARAM}) {
|
} elsif($cmd eq "blink" && $defs{$name}{SE_BLINKPARAM}) {
|
||||||
|
|||||||
Reference in New Issue
Block a user