...roll: block
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
package main;
|
||||
|
||||
use strict;
|
||||
@@ -6,11 +5,6 @@ use warnings;
|
||||
use POSIX;
|
||||
use feature "state";
|
||||
|
||||
sub MyUtils_Initialize($$)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
}
|
||||
|
||||
use constant {
|
||||
STATE_IDLE => 0,
|
||||
STATE_UP => 1,
|
||||
@@ -45,17 +39,17 @@ use constant {
|
||||
# dir: Himmelsrichtung des Fensters
|
||||
# typ: n-normal, s-schlaf bis wecken geschlossen, o-nachts offen
|
||||
my @rolls = (
|
||||
{ roll => "wohn.rollTerrR", dir=>"W", typ=>"no", temp=>"tempWohn", tempSoll=>20, win=>"wohn.fenTerr", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "wohn.rollTerrL", dir=>"W", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "wohn.rollSofa", dir=>"S", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "ess.roll", dir=>"S", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "kuch.rollBar", dir=>"S", typ=>"n", temp=>"tempKueche", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "kuch.rollStr", dir=>"O", typ=>"n", temp=>"tempKueche", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "arb.rollTerr", dir=>"W", typ=>"no", temp=>"tempStudio", tempSoll=>20, win=>"", block=>"blockRoll", state=>STATE_IDLE, },
|
||||
{ roll => "arb.rollWeg", dir=>"S", typ=>"n", temp=>"tempStudio", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "bad.roll", dir=>"S", typ=>"n", temp=>"tempBad", tempSoll=>22, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "schlaf.rollWeg", dir=>"S", typ=>"s", temp=>"tempSchlaf", tempSoll=>18, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "schlaf.rollStr", dir=>"O", typ=>"o", temp=>"tempSchlaf", tempSoll=>18, win=>"", block=>"", state=>STATE_IDLE, },
|
||||
{ roll => "wohn.rollTerrR", dir=>"W", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"wohn.fenTerr", block=>"", },
|
||||
{ roll => "wohn.rollTerrL", dir=>"W", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"", block=>"", },
|
||||
{ roll => "wohn.rollSofa", dir=>"S", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"", block=>"", },
|
||||
{ roll => "ess.roll", dir=>"S", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"", block=>"", },
|
||||
{ roll => "kuch.rollBar", dir=>"S", typ=>"n", temp=>"tempKueche", tempSoll=>20, win=>"", block=>"", },
|
||||
{ roll => "kuch.rollStr", dir=>"O", typ=>"n", temp=>"tempKueche", tempSoll=>20, win=>"", block=>"", },
|
||||
{ roll => "arb.rollTerr", dir=>"W", typ=>"n", temp=>"tempStudio", tempSoll=>20, win=>"", block=>"blockRoll", },
|
||||
{ roll => "arb.rollWeg", dir=>"S", typ=>"n", temp=>"tempStudio", tempSoll=>20, win=>"", block=>"", },
|
||||
{ roll => "bad.roll", dir=>"S", typ=>"n", temp=>"tempBad", tempSoll=>22, win=>"", block=>"", },
|
||||
{ roll => "schlaf.rollWeg", dir=>"S", typ=>"s", temp=>"tempSchlaf", tempSoll=>18, win=>"", block=>"", },
|
||||
{ roll => "schlaf.rollStr", dir=>"O", typ=>"so", temp=>"tempSchlaf", tempSoll=>18, win=>"", block=>"", },
|
||||
);
|
||||
|
||||
|
||||
@@ -64,6 +58,15 @@ my @blocktime=localtime;
|
||||
my $blocktimerRunning=0;
|
||||
my $delaySec=11;
|
||||
|
||||
sub MyUtils_Initialize($$)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
for my $r (@rolls) {
|
||||
$r->{btr}=0;
|
||||
$r->{state} = STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub myfhem($)
|
||||
{
|
||||
@@ -126,6 +129,7 @@ sub RollUpSec($$) {
|
||||
#myfhem("set ".$name." up ".$sec);
|
||||
if ($st eq "closed") { myfhem("set ".$name." up ".$sec); }
|
||||
else { # noch nicht geschlossen: nochmal versuchen
|
||||
Dbg("retry $name");
|
||||
my $t=getDelayTime(39);
|
||||
my $i=$tc++;
|
||||
myfhem("set ".$name." closes");
|
||||
@@ -154,7 +158,7 @@ sub RollSlotState($$$)
|
||||
my ($r, $skipDown, $ndelay) = @_;
|
||||
$ndelay ||= 0;
|
||||
|
||||
if ($skipDown==SKIP_NO || $skipDown==SKIP_DOWN ) {
|
||||
if (!Value($r->{block}) && ($skipDown==SKIP_NO || $skipDown==SKIP_DOWN) ) {
|
||||
if ($r->{state}!=STATE_SLOT) {
|
||||
RollSlot($r, $ndelay);
|
||||
$r->{state}=STATE_SLOT;
|
||||
@@ -172,7 +176,7 @@ sub RollUpState($$$)
|
||||
my ($r, $skipUp, $ndelay) = @_;
|
||||
$ndelay ||= 0;
|
||||
|
||||
if ($skipUp==SKIP_NO) {
|
||||
if (!Value($r->{block}) && $skipUp==SKIP_NO) {
|
||||
if ($r->{state}!=STATE_UP) {
|
||||
my $t1=getDelayTime($ndelay*$delaySec);
|
||||
my $i=$tc++;
|
||||
@@ -193,7 +197,7 @@ sub RollDownState($$$)
|
||||
my ($r, $skipDown, $ndelay) = @_;
|
||||
$ndelay ||= 0;
|
||||
|
||||
if ($skipDown==SKIP_NO) {
|
||||
if (!Value($r->{block}) && $skipDown==SKIP_NO) {
|
||||
if ($r->{state}!=STATE_DOWN) {
|
||||
my $t1=getDelayTime($ndelay*$delaySec);
|
||||
my $i=$tc++;
|
||||
@@ -282,7 +286,7 @@ sub SlotBlockCheck($)
|
||||
my ($r) = @_;
|
||||
if($r->{btr}) {
|
||||
if(!IsLater("@{$r->{bt}}[2]:@{$r->{bt}}[1]")) {
|
||||
Dbg("Schlitz blocked");
|
||||
Dbg("Schlitz blocked $r->{roll}");
|
||||
return(0);
|
||||
} else {
|
||||
$r->{btr}=0;
|
||||
@@ -390,10 +394,6 @@ sub checkSkip($)
|
||||
my $typ=$r->{typ};
|
||||
my $skipDown=SKIP_NO; my $skipUp=SKIP_NO;
|
||||
|
||||
if (Value($r->{block})) {
|
||||
$skipDown=SKIP_ALL;
|
||||
$skipUp=SKIP_ALL;
|
||||
}
|
||||
if ($winstate eq "Open") {
|
||||
# Offene Fenster nicht mit Rollaeden verschliessen
|
||||
$skipDown=SKIP_ALL;
|
||||
@@ -407,7 +407,6 @@ sub checkSkip($)
|
||||
#Dbg("Skip1: t:$typ w:winstate r:$skipRunter h:$skipUp");
|
||||
if($wach eq "0") {
|
||||
#Dbg("Skip2: t:$typ w:winstate r:$skipDown h:$skipUp");
|
||||
|
||||
$skipUp=SKIP_ALL;
|
||||
}
|
||||
}
|
||||
@@ -458,7 +457,7 @@ sub RollCheck()
|
||||
my $NoSunNotHot = !$dirIn && ($tempO<=TEMP_HIGH || $tempI<=TEMP_OK);
|
||||
|
||||
if (!$tag) {
|
||||
if (index($r->{typ}, "o") != -1) { $run=RollUpState ($r, $skipUp, $ndelay++); }
|
||||
if (index($r->{typ}, "o") != -1) { $run=RollUpState ($r, SKIP_NO, $ndelay++); }
|
||||
else { $run=RollDownState($r, $skipDown, $ndelay++); }
|
||||
} elsif ($dawn) { # Abenddämmerung
|
||||
$run=RollUpState($r, $skipUp, $ndelay++);
|
||||
|
||||
Reference in New Issue
Block a user