...weniger prints
This commit is contained in:
@@ -46,7 +46,7 @@ my @rolls = (
|
|||||||
{ roll => "ess.roll", 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.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 => "kuch.rollStr", dir=>"O", typ=>"n", temp=>"tempKueche", tempSoll=>20, win=>"", block=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "arb.rollTerr", dir=>"W", typ=>"n", temp=>"tempStudio", tempSoll=>20, win=>"wohn.fenTerr", block=>"blockRoll", state=>STATE_IDLE, },
|
{ roll => "arb.rollTerr", dir=>"W", typ=>"n", 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 => "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 => "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.rollWeg", dir=>"S", typ=>"s", temp=>"tempSchlaf", tempSoll=>18, win=>"", block=>"", state=>STATE_IDLE, },
|
||||||
@@ -54,52 +54,6 @@ my @rolls = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#my @rollHoch = (
|
|
||||||
# "bad.roll",
|
|
||||||
# "arb.rollWeg",
|
|
||||||
# "arb.rollTerr",
|
|
||||||
# "kuch.rollStr",
|
|
||||||
# "kuch.rollBar",
|
|
||||||
# "ess.roll",
|
|
||||||
# "wohn.rollSofa",
|
|
||||||
# "wohn.rollTerrL",
|
|
||||||
# "wohn.rollTerrR"
|
|
||||||
#);
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#my @rollRunter = (
|
|
||||||
# "wohn.rollTerrR",
|
|
||||||
# "wohn.rollTerrL",
|
|
||||||
# "wohn.rollSofa",
|
|
||||||
# "ess.roll",
|
|
||||||
# "kuch.rollBar",
|
|
||||||
# "kuch.rollStr",
|
|
||||||
# "arb.rollTerr",
|
|
||||||
# "arb.rollWeg",
|
|
||||||
# "bad.roll",
|
|
||||||
# "schlaf.rollWeg"
|
|
||||||
## "schlaf.rollStr"
|
|
||||||
#);
|
|
||||||
#
|
|
||||||
#my @rollWeck = (
|
|
||||||
# "schlaf.rollWeg",
|
|
||||||
# "schlaf.rollStr"
|
|
||||||
#);
|
|
||||||
#
|
|
||||||
#my @rollTest = (
|
|
||||||
# "wohn.rollTerrR"
|
|
||||||
#);
|
|
||||||
#
|
|
||||||
#my @rollSchlaf = (
|
|
||||||
# "schlaf.rollWeg",
|
|
||||||
# "schlaf.rollStr"
|
|
||||||
#);
|
|
||||||
#
|
|
||||||
#my @rollArb = (
|
|
||||||
# "arb.rollTerr",
|
|
||||||
# "arb.rollWeg",
|
|
||||||
#);
|
|
||||||
|
|
||||||
my $tc=0;
|
my $tc=0;
|
||||||
my @blocktime=localtime;
|
my @blocktime=localtime;
|
||||||
my $blocktimerRunning=0;
|
my $blocktimerRunning=0;
|
||||||
@@ -130,124 +84,8 @@ sub findRoll($)
|
|||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------
|
#------------------------------------------
|
||||||
|
|
||||||
#sub RollCheckSkip($$)
|
|
||||||
#{
|
|
||||||
# my($cmd, $roll) = @_;
|
|
||||||
# my $skip=0;
|
|
||||||
# if ($cmd eq "closes") {
|
|
||||||
# if ($roll eq "wohn.rollTerrR") {
|
|
||||||
# if (Value("wohn.fenTerr") eq "Open") {
|
|
||||||
# $skip=1;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# return $skip
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##------------------------------------------
|
|
||||||
#
|
|
||||||
#sub RollCmd($$$)
|
|
||||||
#{
|
|
||||||
# my ($cmd, $roll, $delay) = @_;
|
|
||||||
# if(RollCheckSkip($cmd, $roll)==0) {
|
|
||||||
# myfhem ("define r".int(rand(10000))." at +".$delay." set ".$roll." ".$cmd);
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##------------------------------------------
|
|
||||||
#
|
|
||||||
#sub RollGroup(\@$$)
|
|
||||||
#{
|
|
||||||
# my ($rolls, $cmd, $delay) = @_;
|
|
||||||
# #Log 1, "RollGroup ## cmd:$cmd del:$delay";
|
|
||||||
# my $i;
|
|
||||||
# my @myrolls;
|
|
||||||
# @myrolls=@$rolls;
|
|
||||||
#
|
|
||||||
# $i=0;
|
|
||||||
# for my $r (@myrolls) {
|
|
||||||
# my @tparts = gmtime($i*$delay+1);
|
|
||||||
# my $t=sprintf ("%02d:%02d:%02d",@tparts[2,1,0]);
|
|
||||||
# my $skip=0;
|
|
||||||
# #$t="00:00:".sprintf("%02d", $i*5);
|
|
||||||
# #Log 1, "time $t";
|
|
||||||
# if ($cmd eq "closes") {
|
|
||||||
# if ($r eq "wohn.rollTerrR") {
|
|
||||||
# if (Value("wohn.fenTerr") eq "Open") {
|
|
||||||
# $skip=1;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# if($skip==0) {
|
|
||||||
# myfhem ("define r".$i." at +".$t." set ".$r." ".$cmd);
|
|
||||||
# }
|
|
||||||
# $i=$i+1;
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#sub RollGroup2(\@$$)
|
|
||||||
#{
|
|
||||||
# my ($typ, $cmd, $delay) = @_;
|
|
||||||
# #Log 1, "RollGroup ## cmd:$cmd del:$delay";
|
|
||||||
# my $i=0;
|
|
||||||
# my $r=0;
|
|
||||||
#
|
|
||||||
# for $r (@rolls) {
|
|
||||||
# if (index($r->{typ}, $typ) != -1) {
|
|
||||||
# my @tparts = gmtime($i*$delay+1);
|
|
||||||
# my $t=sprintf ("%02d:%02d:%02d",@tparts[2,1,0]);
|
|
||||||
# my $skip=0;
|
|
||||||
# #$t="00:00:".sprintf("%02d", $i*5);
|
|
||||||
# #Log 1, "time $t";
|
|
||||||
# if ($cmd eq "closes") {
|
|
||||||
# if ($r eq "wohn.rollTerrR") {
|
|
||||||
# if (Value("wohn.fenTerr") eq "Open") {
|
|
||||||
# $skip=1;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# if($skip==0) {
|
|
||||||
# myfhem ("define r".$i." at +".$t." set ".$r." ".$cmd);
|
|
||||||
# }
|
|
||||||
# $i=$i+1;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##------------------------------------------
|
|
||||||
#
|
|
||||||
#sub RollTest() {
|
|
||||||
# &RollGroup(\@rollTest, "closes", 1);
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##------------------------------------------
|
|
||||||
#
|
|
||||||
#sub RollAll($$) {
|
|
||||||
# my ($cmd, $delay) = @_;
|
|
||||||
## Log 1, "c:$cmd d:$delay";
|
|
||||||
# if($cmd eq "closes") {
|
|
||||||
# &RollGroup(\@rollRunter, $cmd,$delay);
|
|
||||||
# }
|
|
||||||
# else {
|
|
||||||
# &RollGroup(\@rollHoch, $cmd,$delay);
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##------------------------------------------
|
|
||||||
#
|
|
||||||
#sub RollWeck($) {
|
|
||||||
# my ($delay) = @_;
|
|
||||||
# #&RollGroup(\@rollWeck, "up 5", $delay);
|
|
||||||
# &RollGroup(\@rollWeck, "opens", $delay);
|
|
||||||
# myfhem("define weckwachat at +03:00:00 set wach 1");
|
|
||||||
#}
|
|
||||||
#
|
|
||||||
##------------------------------------------
|
|
||||||
|
|
||||||
sub Dbg($) {
|
sub Dbg($) {
|
||||||
if(Value("DebugRoll") eq "1") {
|
if(Value("DebugRoll") eq "1") {
|
||||||
Log 1,$_[0];
|
Log 1,$_[0];
|
||||||
@@ -281,8 +119,10 @@ sub RollRunterSchlitz($$$)
|
|||||||
myfhem("define rc".$i." at +".$t1." set ".$r->{roll}." closes");
|
myfhem("define rc".$i." at +".$t1." set ".$r->{roll}." closes");
|
||||||
myfhem("define ru".$i." at +".$t2." set ".$r->{roll}." up 6");
|
myfhem("define ru".$i." at +".$t2." set ".$r->{roll}." up 6");
|
||||||
$r->{state}=STATE_SCHLITZ;
|
$r->{state}=STATE_SCHLITZ;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------
|
#------------------------------------------
|
||||||
@@ -300,8 +140,10 @@ sub RollHoch($$$)
|
|||||||
Dbg("RollChg: $r->{roll} - hoch($ndelay)\n");
|
Dbg("RollChg: $r->{roll} - hoch($ndelay)\n");
|
||||||
myfhem("define ro".$i." at +".$t1." set ". $r->{roll} ." opens");
|
myfhem("define ro".$i." at +".$t1." set ". $r->{roll} ." opens");
|
||||||
$r->{state}=STATE_HOCH;
|
$r->{state}=STATE_HOCH;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------
|
#------------------------------------------
|
||||||
@@ -319,8 +161,10 @@ sub RollRunter($$$)
|
|||||||
Dbg("RollChg: $r->{roll} - runter($ndelay)\n");
|
Dbg("RollChg: $r->{roll} - runter($ndelay)\n");
|
||||||
myfhem("define rc".$i." at +".$t1." set ".$r->{roll}." closes");
|
myfhem("define rc".$i." at +".$t1." set ".$r->{roll}." closes");
|
||||||
$r->{state}=STATE_RUNTER;
|
$r->{state}=STATE_RUNTER;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------
|
#------------------------------------------
|
||||||
@@ -354,7 +198,7 @@ sub IsLater($)
|
|||||||
#Dbg("Islater:$t");
|
#Dbg("Islater:$t");
|
||||||
my @time = localtime(time);
|
my @time = localtime(time);
|
||||||
if ($t =~ /(\d+):(\d+)/ and ($time[2]>=$1) and ($time[1]>=$2) ) {
|
if ($t =~ /(\d+):(\d+)/ and ($time[2]>=$1) and ($time[1]>=$2) ) {
|
||||||
Dbg("later:$t");
|
#Dbg("later:$t");
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
@@ -459,7 +303,7 @@ sub checkSkip($$)
|
|||||||
# Offene Fenster nicht mit Rollaeden verschliessen
|
# Offene Fenster nicht mit Rollaeden verschliessen
|
||||||
$skipRunter=SKIP_ALL;
|
$skipRunter=SKIP_ALL;
|
||||||
} elsif (index($typ, "o") != -1) {
|
} elsif (index($typ, "o") != -1) {
|
||||||
Dbg("Skip0: t:$typ w:$winstate r:$skipRunter h:$skipHoch");
|
#Dbg("Skip0: t:$typ w:$winstate r:$skipRunter h:$skipHoch");
|
||||||
|
|
||||||
# bei typ o nur auf schlitz schliessen
|
# bei typ o nur auf schlitz schliessen
|
||||||
$skipRunter=SKIP_DOWN;
|
$skipRunter=SKIP_DOWN;
|
||||||
@@ -501,30 +345,34 @@ sub RollCheck()
|
|||||||
if($twil>=7) { # ss-weather
|
if($twil>=7) { # ss-weather
|
||||||
$dawn=1;
|
$dawn=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbg("RollCheck to:$tempOut twil:$twil light:$light wett:$wett sr:$sr block:$sonneblock\n");
|
|
||||||
|
|
||||||
for $r ( @rolls ) {
|
for $r ( @rolls ) {
|
||||||
#Dbg("--------r:g ".$r->{roll}." / ".$r->{temp});
|
#Dbg("--------r:g ".$r->{roll}." / ".$r->{temp});
|
||||||
|
my $run=0;
|
||||||
my $tempIn=ReadingsVal($r->{temp},"temperature", 99);
|
my $tempIn=ReadingsVal($r->{temp},"temperature", 99);
|
||||||
my($tempI, $tempO)=checkTemps($tempIn, $tempOut, $r->{tempSoll}); # Temperatur klassifizieren
|
my($tempI, $tempO)=checkTemps($tempIn, $tempOut, $r->{tempSoll}); # Temperatur klassifizieren
|
||||||
my $sunIn=checkSunIn($twil, $sr, $r->{dir}, $sonneblock, $sunny); # Sonne scheint ins Fenster ?
|
my $sunIn=checkSunIn($twil, $sr, $r->{dir}, $sonneblock, $sunny); # Sonne scheint ins Fenster ?
|
||||||
# Offene Fenster nicht mit Rollaeden verschliessen, zur Schlafenszeit nicht öffnen
|
# Offene Fenster nicht mit Rollaeden verschliessen, zur Schlafenszeit nicht öffnen
|
||||||
my ($skipRunter, $skipHoch)=checkSkip($r, $wach);
|
my ($skipRunter, $skipHoch)=checkSkip($r, $wach);
|
||||||
Dbg("RollCheck:$r->{roll}-tempLevI,O:$tempI,$tempO tempI,O:$tempIn,$tempOut so:$sunIn wett:$wett sr:$sr "
|
|
||||||
. "twil:$twil tag:$tag wach:$wach skipR,H:$skipRunter,$skipHoch st:$r->{state}");
|
|
||||||
if (!$tag) {
|
if (!$tag) {
|
||||||
RollRunter($r, $skipRunter, $ndelay++);
|
$run=RollRunter($r, $skipRunter, $ndelay++);
|
||||||
} elsif ($dawn) {
|
} elsif ($dawn) {
|
||||||
RollHoch($r, $skipHoch, $ndelay++);
|
$run=RollHoch($r, $skipHoch, $ndelay++);
|
||||||
} elsif ($tempI==TEMP_HIGH && (($sunIn && ($tempO!=TEMP_IDLE && $tempO>TEMP_COLD)) || $tempO==TEMP_HIGH)) {
|
} elsif ($tempI==TEMP_HIGH
|
||||||
RollRunterSchlitz($r, $skipRunter, $ndelay++);
|
&& ( ( $sunIn && ($tempO>TEMP_COLD))
|
||||||
} elsif ( ($tempI==TEMP_LOW && $tempO==TEMP_LOW)
|
|| $tempO==TEMP_HIGH
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
$run=RollRunterSchlitz($r, $skipRunter, $ndelay++);
|
||||||
|
} elsif ( ($tempI==TEMP_LOW && $tempO==TEMP_LOW)
|
||||||
|| (!$sunIn && ($tempO!=TEMP_IDLE && $tempO<TEMP_HIGH))) {
|
|| (!$sunIn && ($tempO!=TEMP_IDLE && $tempO<TEMP_HIGH))) {
|
||||||
RollHoch($r, $skipHoch, $ndelay++);
|
$run=RollHoch($r, $skipHoch, $ndelay++);
|
||||||
} elsif ( ($tag && !$tagalt) || ($wach && !$wachalt) ) { # bei Tagesbeginn und im Temp-hysteresebereich -> hoch
|
} elsif ( ($tag && !$tagalt) || ($wach && !$wachalt) ) { # bei Tagesbeginn hoch
|
||||||
RollHoch($r, $skipHoch, $ndelay++);
|
$run=RollHoch($r, $skipHoch, $ndelay++);
|
||||||
|
}
|
||||||
|
if ($run) {
|
||||||
|
Dbg("RollCheck to:$tempOut twil:$twil light:$light wett:$wett sr:$sr block:$sonneblock\n");
|
||||||
|
Dbg("RollCheck:$r->{roll}-tempLevI,O:$tempI,$tempO tempI,O:$tempIn,$tempOut so:$sunIn wett:$wett sr:$sr "
|
||||||
|
. "twil:$twil tag:$tag wach:$wach skipR,H:$skipRunter,$skipHoch st:$r->{state}");
|
||||||
}
|
}
|
||||||
} # for $r
|
} # for $r
|
||||||
$tagalt=$tag;
|
$tagalt=$tag;
|
||||||
|
|||||||
Reference in New Issue
Block a user