99-my temperatur-hysterese
This commit is contained in:
@@ -18,17 +18,17 @@ use constant {
|
|||||||
|
|
||||||
|
|
||||||
my @rolls = (
|
my @rolls = (
|
||||||
{ roll => "wohn.rollTerrR", dir=>"W", typ=>"n", temp=>"tempWohn", tempS=>21, win=>"wohn.fenTerr", state=>STATE_IDLE, },
|
{ roll => "wohn.rollTerrR", dir=>"W", typ=>"n", temp=>"tempWohn", tempSoll=>21, tempSchalt=>-1, win=>"wohn.fenTerr", state=>STATE_IDLE, },
|
||||||
{ roll => "wohn.rollTerrL", dir=>"W", typ=>"n", temp=>"tempWohn", tempS=>21, win=>"", state=>STATE_IDLE, },
|
{ roll => "wohn.rollTerrL", dir=>"W", typ=>"n", temp=>"tempWohn", tempSoll=>21, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "wohn.rollSofa", dir=>"S", typ=>"n", temp=>"tempWohn", tempS=>21, win=>"", state=>STATE_IDLE, },
|
{ roll => "wohn.rollSofa", dir=>"S", typ=>"n", temp=>"tempWohn", tempSoll=>21, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "ess.roll", dir=>"S", typ=>"n", temp=>"tempWohn", tempS=>21, win=>"", state=>STATE_IDLE, },
|
{ roll => "ess.roll", dir=>"S", typ=>"n", temp=>"tempWohn", tempSoll=>21, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "kuch.rollBar", dir=>"S", typ=>"n", temp=>"tempKueche", tempS=>21, win=>"", state=>STATE_IDLE, },
|
{ roll => "kuch.rollBar", dir=>"S", typ=>"n", temp=>"tempKueche", tempSoll=>21, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "kuch.rollStr", dir=>"O", typ=>"n", temp=>"tempKueche", tempS=>21, win=>"", state=>STATE_IDLE, },
|
{ roll => "kuch.rollStr", dir=>"O", typ=>"n", temp=>"tempKueche", tempSoll=>21, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "arb.rollTerr", dir=>"W", typ=>"n", temp=>"tempStudio", tempS=>21, win=>"wohn.fenTerr", state=>STATE_IDLE, },
|
{ roll => "arb.rollTerr", dir=>"W", typ=>"n", temp=>"tempStudio", tempSoll=>21, tempSchalt=>-1, win=>"wohn.fenTerr", state=>STATE_IDLE, },
|
||||||
{ roll => "arb.rollWeg", dir=>"S", typ=>"n", temp=>"tempStudio", tempS=>21, win=>"", state=>STATE_IDLE, },
|
{ roll => "arb.rollWeg", dir=>"S", typ=>"n", temp=>"tempStudio", tempSoll=>21, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "bad.roll", dir=>"S", typ=>"n", temp=>"tempBad", tempS=>23, win=>"", state=>STATE_IDLE, },
|
{ roll => "bad.roll", dir=>"S", typ=>"n", temp=>"tempBad", tempSoll=>23, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "schlaf.rollWeg", dir=>"S", typ=>"s", temp=>"tempSchlaf", tempS=>18, win=>"", state=>STATE_IDLE, },
|
{ roll => "schlaf.rollWeg", dir=>"S", typ=>"s", temp=>"tempSchlaf", tempSoll=>18, tempSchalt=>-1, win=>"", state=>STATE_IDLE, },
|
||||||
{ roll => "schlaf.rollStr", dir=>"O", typ=>"s", temp=>"tempSchlaf", tempS=>18, win=>"wohn.fenTerr", state=>STATE_IDLE, },
|
{ roll => "schlaf.rollStr", dir=>"O", typ=>"s", temp=>"tempSchlaf", tempSoll=>18, tempSchalt=>-1, win=>"wohn.fenTerr", state=>STATE_IDLE, },
|
||||||
);
|
);
|
||||||
|
|
||||||
#my %rollStates = (
|
#my %rollStates = (
|
||||||
@@ -87,12 +87,18 @@ my @rollArb = (
|
|||||||
my $tc=0;
|
my $tc=0;
|
||||||
my @blocktime=localtime;
|
my @blocktime=localtime;
|
||||||
my $blocktimerRunning=0;
|
my $blocktimerRunning=0;
|
||||||
|
my $tempHystOffset=-0.9;
|
||||||
|
my $tempHighOffset=0.3;
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub myfhem($) {
|
sub myfhem($) {
|
||||||
#Log 1, "@_";
|
#Log 1, "@_";
|
||||||
fhem("@_");
|
fhem("@_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollCheckSkip($$)
|
sub RollCheckSkip($$)
|
||||||
{
|
{
|
||||||
my($cmd, $roll) = @_;
|
my($cmd, $roll) = @_;
|
||||||
@@ -107,6 +113,8 @@ sub RollCheckSkip($$)
|
|||||||
return $skip
|
return $skip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollCmd($$$)
|
sub RollCmd($$$)
|
||||||
{
|
{
|
||||||
my ($cmd, $roll, $delay) = @_;
|
my ($cmd, $roll, $delay) = @_;
|
||||||
@@ -114,6 +122,8 @@ sub RollCmd($$$)
|
|||||||
myfhem ("define r".int(rand(10000))." at +".$delay." set ".$roll." ".$cmd);
|
myfhem ("define r".int(rand(10000))." at +".$delay." set ".$roll." ".$cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollGroup(\@$$)
|
sub RollGroup(\@$$)
|
||||||
{
|
{
|
||||||
@@ -147,10 +157,14 @@ sub RollGroup(\@$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollTest() {
|
sub RollTest() {
|
||||||
&RollGroup(\@rollTest, "closes", 1);
|
&RollGroup(\@rollTest, "closes", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollAll($$) {
|
sub RollAll($$) {
|
||||||
# Log 1, "################";
|
# Log 1, "################";
|
||||||
my ($cmd, $delay) = @_;
|
my ($cmd, $delay) = @_;
|
||||||
@@ -164,6 +178,7 @@ sub RollAll($$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollWeck($) {
|
sub RollWeck($) {
|
||||||
my ($delay) = @_;
|
my ($delay) = @_;
|
||||||
@@ -175,9 +190,13 @@ sub RollWeck($) {
|
|||||||
#------------------------------------------
|
#------------------------------------------
|
||||||
|
|
||||||
sub Dbg($) {
|
sub Dbg($) {
|
||||||
Log 1,$_[0];
|
if(Value("DebugRoll") eq "1") {
|
||||||
|
Log 1,$_[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollRunterSchlitz($;$) {
|
sub RollRunterSchlitz($;$) {
|
||||||
my ($roll, $delay) = @_;
|
my ($roll, $delay) = @_;
|
||||||
$delay ||= 0;
|
$delay ||= 0;
|
||||||
@@ -193,6 +212,8 @@ sub RollRunterSchlitz($;$) {
|
|||||||
myfhem("define ru".$i." at +".$t2." set ".$roll." up 6");
|
myfhem("define ru".$i." at +".$t2." set ".$roll." up 6");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollHoch($;$) {
|
sub RollHoch($;$) {
|
||||||
my ($roll, $delay) = @_;
|
my ($roll, $delay) = @_;
|
||||||
$delay ||= 0;
|
$delay ||= 0;
|
||||||
@@ -205,6 +226,8 @@ sub RollHoch($;$) {
|
|||||||
myfhem("define r".$i." at +".$t." set ".$roll." opens");
|
myfhem("define r".$i." at +".$t." set ".$roll." opens");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollRunter($;$) {
|
sub RollRunter($;$) {
|
||||||
my ($roll, $delay) = @_;
|
my ($roll, $delay) = @_;
|
||||||
$delay ||= 0;
|
$delay ||= 0;
|
||||||
@@ -217,6 +240,8 @@ sub RollRunter($;$) {
|
|||||||
myfhem("define r".$i." at +".$t." set ".$roll." closes");
|
myfhem("define r".$i." at +".$t." set ".$roll." closes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub IsSunny($) {
|
sub IsSunny($) {
|
||||||
my ($wett)=@_;
|
my ($wett)=@_;
|
||||||
if($wett==30 || $wett==31 || $wett==32 || $wett==33 || $wett==34 || $wett==35 || $wett==36) { # sonnig, heiter, heiss
|
if($wett==30 || $wett==31 || $wett==32 || $wett==33 || $wett==34 || $wett==35 || $wett==36) { # sonnig, heiter, heiss
|
||||||
@@ -225,6 +250,8 @@ sub IsSunny($) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub IsLater($) {
|
sub IsLater($) {
|
||||||
my($t)=@_;
|
my($t)=@_;
|
||||||
#Dbg("Islater:$t");
|
#Dbg("Islater:$t");
|
||||||
@@ -236,7 +263,7 @@ sub IsLater($) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
# Nach dem Wechsel auf !sonne noch 2Std warten
|
# Nach dem Wechsel auf !sonne noch 2Std warten
|
||||||
sub IsWetterSonneWait($) {
|
sub IsWetterSonneWait($) {
|
||||||
@@ -268,15 +295,17 @@ sub IsWetterSonneWait($) {
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub RollCheck() {
|
sub RollCheck() {
|
||||||
# Dbg("RollCheck\n");
|
|
||||||
my $temp=20;
|
my $temp=20;
|
||||||
my $r;
|
my $r;
|
||||||
my $i=0;
|
my $i=0;
|
||||||
my $delay=11;
|
my $delay=11;
|
||||||
my $tag=0;
|
my $tag=0;
|
||||||
|
|
||||||
my $tempOut=ReadingsVal("wetter", "temp_c", 99);
|
#my $tempOut=ReadingsVal("wetter", "temp_c", 99);
|
||||||
|
my $tempOut=ReadingsVal("naAussen", "temperature", 99);
|
||||||
|
|
||||||
my $twil=Value("twil");
|
my $twil=Value("twil");
|
||||||
if ($twil>=3 && $twil<10) { # civil
|
if ($twil>=3 && $twil<10) { # civil
|
||||||
@@ -296,6 +325,7 @@ sub RollCheck() {
|
|||||||
|
|
||||||
# Nach wechsel von sonne auf !sonne blockert ?
|
# Nach wechsel von sonne auf !sonne blockert ?
|
||||||
my $sonneblock=IsWetterSonneWait($wett);
|
my $sonneblock=IsWetterSonneWait($wett);
|
||||||
|
Dbg("RollCheck to:$tempOut twil:$twil light:$light wett:$wett sr:$sr block:$sonneblock\n");
|
||||||
|
|
||||||
for $r ( @rolls ) {
|
for $r ( @rolls ) {
|
||||||
|
|
||||||
@@ -311,18 +341,26 @@ sub RollCheck() {
|
|||||||
# Raum zu warm und aussentemp hoch ?
|
# Raum zu warm und aussentemp hoch ?
|
||||||
#$temp=ReadingsVal($r->{temp},"measured-temp", 99);
|
#$temp=ReadingsVal($r->{temp},"measured-temp", 99);
|
||||||
$temp=ReadingsVal($r->{temp},"temperature", 99);
|
$temp=ReadingsVal($r->{temp},"temperature", 99);
|
||||||
if( ($temp>$r->{tempS} && $tempOut>($r->{tempS}-3)) || $temp>($r->{tempS}+2) ) {
|
my $tempSoll=$r->{tempSoll};
|
||||||
$tempH=1;
|
my $tempSchalt=$tempSoll;
|
||||||
}
|
my $tempHyst=99;
|
||||||
if( $temp<$r->{tempS}-1 ) {
|
if($r->{tempSchalt}>-1) {
|
||||||
$tempL=1;
|
$tempSchalt=$r->{tempSchalt};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ($temp>$tempSoll && $tempOut>($tempSoll-3)) || $temp>($tempSoll+2) ) {
|
||||||
|
$tempH=1;
|
||||||
|
}
|
||||||
|
if( $temp<$tempSoll-1 ) {
|
||||||
|
$tempL=1;
|
||||||
|
}
|
||||||
|
|
||||||
# Sonne scheint ins Fenster ?
|
# Sonne scheint ins Fenster ?
|
||||||
if($twil>=5 && $twil<7) { # nur, wenn der Sonnenstand ueber 'weather' liegt
|
if($twil>=5 && $twil<7) { # nur, wenn der Sonnenstand ueber 'weather' liegt
|
||||||
# bei hoher Raum- und Aussentemperatur immer unten lassen
|
# bei hoher Raum- und Aussentemperatur immer unten lassen
|
||||||
if($temp > ($r->{tempS}+2) && $tempOut > $r->{tempS}) {
|
if($temp > ($tempSchalt+$tempHighOffset) && $tempOut > $tempSoll+$tempHighOffset) {
|
||||||
$sonne=1;
|
$sonne=1;
|
||||||
|
$tempHyst=$tempHystOffset;
|
||||||
}
|
}
|
||||||
elsif (index($sr, $r->{dir}) != -1) { # Sonnenrichtung ins Fenster
|
elsif (index($sr, $r->{dir}) != -1) { # Sonnenrichtung ins Fenster
|
||||||
if($sonneblock) {
|
if($sonneblock) {
|
||||||
@@ -351,7 +389,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} h:$tempHyst ts:$tempSchalt");
|
||||||
|
|
||||||
if( $tag and $sonne and $tempH) {
|
if( $tag and $sonne and $tempH) {
|
||||||
if($r->{state}!=STATE_SCHLITZ) {
|
if($r->{state}!=STATE_SCHLITZ) {
|
||||||
@@ -364,6 +402,7 @@ sub RollCheck() {
|
|||||||
|
|
||||||
if(($tag && !$sonne)||($tag && $tempL)) {
|
if(($tag && !$sonne)||($tag && $tempL)) {
|
||||||
if($r->{state}!=STATE_HOCH) {
|
if($r->{state}!=STATE_HOCH) {
|
||||||
|
$tempHyst=0;
|
||||||
if(!$skipHoch) {
|
if(!$skipHoch) {
|
||||||
RollHoch($r->{roll}, $ndelay);
|
RollHoch($r->{roll}, $ndelay);
|
||||||
$r->{state}=STATE_HOCH;
|
$r->{state}=STATE_HOCH;
|
||||||
@@ -379,10 +418,14 @@ sub RollCheck() {
|
|||||||
$r->{state}=STATE_RUNTER;
|
$r->{state}=STATE_RUNTER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if($tempHyst<50) {
|
||||||
|
$r->{tempSchalt}=$tempSoll+$tempHyst;
|
||||||
|
}
|
||||||
$i=$i+1;
|
$i=$i+1;
|
||||||
} # for
|
} # for
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#------------------------------------------
|
||||||
|
|
||||||
sub Untoggle($) {
|
sub Untoggle($) {
|
||||||
my ($obj) = @_;
|
my ($obj) = @_;
|
||||||
|
|||||||
Reference in New Issue
Block a user