This commit is contained in:
2017-10-28 10:40:31 +02:00
parent 4f7cdafb64
commit fd4b1b4e00
2 changed files with 20 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
package main;
use strict;
use warnings;
@@ -16,6 +17,12 @@ use constant {
STATE_SCHLITZ => 3,
};
use constant {
TEMP_IDLE => 0,
TEMP_HIGH => 1,
TEMP_LOW => 2,
TEMP_COLD => 3,
};
my @rolls = (
{ roll => "wohn.rollTerrR", dir=>"W", typ=>"n", temp=>"tempWohn", tempSoll=>20, win=>"wohn.fenTerr", state=>STATE_IDLE, },
@@ -254,7 +261,7 @@ sub RollRunter($$)
sub IsSunny($)
{
my ($wett)=@_;
if($wett==30 || $wett==31 || $wett==32 || $wett==33 || $wett==34 || $wett==35 || $wett==36) { # sonnig, heiter, heiss
if($wett==30|| $wett==32 || $wett==34 || $wett==36) { # sonnig, heiter, heiss
return(1);
}
return(0);
@@ -330,13 +337,14 @@ sub setTagHell($$)
sub checkTemps($$$)
{
my($temp, $tempOut, $tempSoll)=@_;
my $tempH=0; my $tempOH=0; my $tempL=0; my$tempOL=0;
my $tempI=TEMP_IDLE; my $tempO=TEMP_IDLE;
if ($temp > $tempSoll+$tempIn_offset+0.5) { $tempH =1; }
if ($temp < $tempSoll+$tempIn_offset-0.5) { $tempL =1; }
if ($tempOut > $tempSoll+$tempOut_offset+0.5) { $tempOH=1; }
if ($tempOut < $tempSoll+$tempOut_offset-0.5) { $tempOL=1; }
return($tempH, $tempOH, $tempL, $tempOL);
if ($temp > $tempSoll+$tempIn_offset+0.5) { $tempI=TEMP_HIGH; }
if ($temp < $tempSoll+$tempIn_offset-0.5) { $tempI=TEMP_LOW; }
if ($tempOut > $tempSoll+$tempOut_offset+0.5) { $tempO=TEMP_HIGH; }
if ($tempOut < $tempSoll+$tempOut_offset-0.5) { $tempO=TEMP_LOW; }
if ($tempOut < $tempSoll+$tempOut_offset-1.5) { $tempO=TEMP_COLD; }
return($tempI, $tempO);
}
#------------------------------------------
@@ -406,23 +414,23 @@ sub RollCheck()
#Dbg("--------r:g ".$r->{roll}." / ".$r->{temp});
# Raum zu warm und aussentemp hoch ?
my $temp=ReadingsVal($r->{temp},"temperature", 99);
my($tempH, $tempOH, $tempL, $tempOL)=checkTemps($temp, $tempOut, $r->{tempSoll});
my $tempIn=ReadingsVal($r->{temp},"temperature", 99);
my($tempI, $tempO)=checkTemps($tempIn, $tempOut, $r->{tempSoll});
# Sonne scheint ins Fenster ?
my $sonne=checkWeather($twil, $sr, $r->{dir}, $sonneblock, $sunny);
# Offene Fenster nicht mit Rollaeden verschliessen
my ($skipRunter, $skipHoch)=checkSkip(Value($r->{win}), $r->{typ}, Value("wach"));
Dbg("RollCheck:$r->{roll}-tempH,OH,L,OL:$tempH,$tempOH,$tempL,$tempOL tempI,O:$temp,$tempOut so:$sonne wett:$wett sr:$sr twil:$twil tag:$tag skipR,H:$skipRunter,$skipHoch st:$r->{state}");
Dbg("RollCheck:$r->{roll}-tempLevI,O:$tempI,$tempO tempI,O:$tempIn,$tempOut so:$sonne wett:$wett sr:$sr twil:$twil tag:$tag skipR,H:$skipRunter,$skipHoch st:$r->{state}");
if (!$tag) {
if (!$skipRunter) { RollRunter($r, $ndelay++); }
}
elsif ($tag && !$dawn && $tempH && (($sonne && !$tempOL) || $tempOH)) {
elsif ($tag && !$dawn && $tempI==TEMP_HIGH && (($sonne && $tempO!=TEMP_COLD) || $tempO==TEMP_HIGH)) {
if (!$skipHoch && !$skipRunter) { RollRunterSchlitz($r, $ndelay++); }
}
elsif ($tag && $tempL && $tempOL) {
elsif ($tag && $tempI==TEMP_LOW && $tempO==TEMP_LOW) {
if (!$skipHoch) { RollHoch($r, $ndelay++); }
}
elsif ($tag && !$tagalt) { # bei Tagesbeginn und im Temp-hysteresebereich -> hoch