...Rollladen: auf innen sehr warm berücksichtigen

This commit is contained in:
2020-08-15 12:51:35 +02:00
committed by Marc Hoppe
parent 7f1e0d7db8
commit 223559a01a

View File

@@ -243,11 +243,12 @@ sub SchlitzBlockCheck($)
{ {
my ($r) = @_; my ($r) = @_;
if($r->{btr}) { if($r->{btr}) {
if(!IsLater("@{$r->{bt}}[2]:@{$r->{bt}}[1]")) { if(!IsLater("@{$r->{bt}}[2]:@{$r->{bt}}[1]")) {
return(1); Dbg("Schlitz blocked");
} else { return(0);
$r->{btr}=0; } else {
Dbg("Schlitzblock End $r->{roll}"); $r->{btr}=0;
Dbg("Schlitzblock End $r->{roll}");
} }
} }
return(0); return(0);
@@ -272,13 +273,15 @@ sub setTagHell($$)
#------------------------------------------ #------------------------------------------
sub getTempMaxForecast() # Die maximal für den aktuellen Tag verhergesagte Temperatur bestimmen
OBsub getTempMaxForecast()
{ {
my $max=0; # aktuellen Wert auch einbeziehen
my $max=ReadingsVal("wetter", "tempHigh", 20);
for (my $i=1; $i<=6; $i++) { for (my $i=1; $i<=6; $i++) {
my $temp = ReadingsVal("wetter", "hfc".$i."_tempHigh", 40); my $temp = ReadingsVal("wetter", "hfc".$i."_tempHigh", 20);
if($temp>$max) { $max=$temp; } if($temp>$max) { $max=$temp; }
#print("i:$i t:$temp, m=$max\n"); #print("i:$i t:$temp, m=$max\n");
} }
return $max; return $max;
} }
@@ -291,6 +294,7 @@ sub checkTemps($$$)
my($temp, $tempOut, $tempSoll)=@_; my($temp, $tempOut, $tempSoll)=@_;
my $tempI=TEMP_OK; my $tempO=TEMP_OK; my $tempI=TEMP_OK; my $tempO=TEMP_OK;
if ($temp > $tempSoll+$tempIn_offset+3.0) { $tempI=TEMP_HOT; }
if ($temp > $tempSoll+$tempIn_offset+0.5) { $tempI=TEMP_HIGH; } if ($temp > $tempSoll+$tempIn_offset+0.5) { $tempI=TEMP_HIGH; }
if ($temp < $tempSoll+$tempIn_offset-0.5) { $tempI=TEMP_LOW; } if ($temp < $tempSoll+$tempIn_offset-0.5) { $tempI=TEMP_LOW; }
if ($tempOut > $tempSoll+$tempOut_offset+4.0) { $tempO=TEMP_HOT; } if ($tempOut > $tempSoll+$tempOut_offset+4.0) { $tempO=TEMP_HOT; }
@@ -307,15 +311,17 @@ sub checkSunIn($$$$$)
{ {
my($twil, $sun_dir, $win_dir, $sunblock, $sunny)=@_; my($twil, $sun_dir, $win_dir, $sunblock, $sunny)=@_;
# Sonne scheint ins Fenster ? # Sonne scheint ins Fenster ?
my $sonne=0; my $sun_in=0;
my $dir_in=0;
if($twil>=5 && $twil<7) { # nur, wenn der Sonnenstand ueber 'weather' liegt if($twil>=5 && $twil<7) { # nur, wenn der Sonnenstand ueber 'weather' liegt
if (index($sun_dir, $win_dir) != -1) { # Sonnenrichtung ins Fenster if (index($sun_dir, $win_dir) != -1) { # Sonnenrichtung ins Fenster
if ($sunblock) { $sonne=1; } $dir_in=1;
if ($sunny) { $sonne=1; } if ($sunblock) { $sun_in=1; }
if ($sunny) { $sun_in=1; }
#Dbg("son3, $sonne"); #Dbg("son3, $sonne");
} }
} }
return $sonne; return ($sun_in, $dir_in);
} }
#------------------------------------------ #------------------------------------------
@@ -388,33 +394,35 @@ sub RollCheck()
my $run=0; 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, $sunDir) =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); my ($skipRunter, $skipHoch)=checkSkip($r);
# Bedingungen zum Fahren
my $Hot = $tempO>=TEMP_HOT; my $Hot = $tempO>=TEMP_HOT;
my $WarmSun = $sunIn && $tempO>=TEMP_HIGH; my $WarmSun = $sunIn && $tempO>=TEMP_HIGH;
my $ForecastHotSun = $sunIn && $tempOutMaxForecast>=$tempOutForecastLimit; my $WarmHotIn = $sunDir && $tempO>=TEMP_HIGH && $tempI>=TEMP_HOT;
my $Cold = $tempO<=TEMP_COLD; my $ForecastHotSun = $sunIn && $tempOutMaxForecast>=$tempOutForecastLimit;
my $NoSunNotHot = !$sunIn && $tempO<=TEMP_LOW; my $ForecastHotWarmIn = $sunDir && $tempOutMaxForecast>=$tempOutForecastLimit && $tempI>=TEMP_HIGH;
my $Cold = $tempO<=TEMP_COLD;
my $NoSunNotHot = !$sunIn && ($tempO<=TEMP_LOW || $tempI<=TEMP_OK);
if (!$tag) { if (!$tag) {
$run=RollRunter($r, $skipRunter, $ndelay++); $run=RollRunter($r, $skipRunter, $ndelay++);
} elsif ($dawn) { # Abenddämmerung } elsif ($dawn) { # Abenddämmerung
$run=RollHoch($r, $skipHoch, $ndelay++); $run=RollHoch($r, $skipHoch, $ndelay++);
} elsif ($Hot || $WarmSun || $ForecastHotSun) { } elsif ($Hot || $WarmSun || $WarmHotIn || $ForecastHotSun || $ForecastHotWarmIn) {
$run=RollRunterSchlitz($r, $skipRunter, $ndelay++); $run=RollRunterSchlitz($r, $skipRunter, $ndelay++);
} elsif ( $Cold || $NoSunNotHot ) { } elsif ( $Cold || $NoSunNotHot ) {
if(!SchlitzBlockCheck($r)) { $run=RollHoch($r, $skipHoch, $ndelay++); } if(!SchlitzBlockCheck($r)) { $run=RollHoch($r, $skipHoch, $ndelay++); }
} elsif ( ($tag && !$tagalt) || ($wach && !$wachalt) ) { # bei Tagesbeginn hoch } elsif ( ($tag && !$tagalt) || ($wach && !$wachalt) ) { # bei Tagesbeginn hoch
$run=RollHoch($r, $skipHoch, $ndelay++); $run=RollHoch($r, $skipHoch, $ndelay++);
} }
if ($run) { # if ($run) {
Dbg("Hot: $Hot WarmSun:$WarmSun ForHotSun:$ForecastHotSun Cold:$Cold NoSunNotHot:$NoSunNotHot\n"); Dbg("RollCheck: H:$Hot WS:$WarmSun WHI:$WarmHotIn FHS:$ForecastHotSun FHI:$ForecastHotWarmIn C:$Cold NSNH:$NoSunNotHot "
Dbg("RollCheck to:$tempOut twil:$twil light:$light wett:$wett sr:$sr block:$sonneblock tomax:$tempOutMaxForecast\n"); . "to:$tempOut twil:$twil light:$light wett:$wett sr:$sr block:$sonneblock tomax:$tempOutMaxForecast "
Dbg("RollCheck:$r->{roll}-tempLevI,O:$tempI,$tempO tempI,O:$tempIn,$tempOut so:$sunIn wett:$wett sr:$sr " . "$r->{roll}-tempLevI,O:$tempI,$tempO tempI,O:$tempIn,$tempOut sun:$sunIn/$sunDir wett:$wett sr:$sr "
. "twil:$twil tag:$tag wach:$wach skipR,H:$skipRunter,$skipHoch st:$r->{state}"); . "twil:$twil tag:$tag/$tagalt wach:$wach/$wachalt skipR,H:$skipRunter,$skipHoch st:$r->{state}");
} # }
} # for $r } # for $r
$tagalt=$tag; $tagalt=$tag;
$wachalt=$wach; $wachalt=$wach;