mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-28 08:54:51 +00:00
fhem.pl: do not check for sat/sun if holiday2we contains weekEnd (Forum #101789)
git-svn-id: https://svn.fhem.de/fhem/trunk@19715 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
72343344c6
commit
862e9b2084
@ -1544,14 +1544,16 @@ The following local attributes are used by a wider range of devices:
|
|||||||
<a name="holiday2we"></a>
|
<a name="holiday2we"></a>
|
||||||
<li>holiday2we<br>
|
<li>holiday2we<br>
|
||||||
If this attribute is set, then the <a href="#perl">$we</a> variable
|
If this attribute is set, then the <a href="#perl">$we</a> variable
|
||||||
will be true, if the value of the <a href="#holiday">holiday</a>
|
will be true, if it is either saturday/sunday, or the value of the <a
|
||||||
variable referenced by this attribute is not none.<br>
|
href="#holiday">holiday</a> variable referenced by this attribute is
|
||||||
If it is a comma separated list, then it is true, if one of the
|
not none.<br> If it is a comma separated list, then it is true, if one
|
||||||
referenced entities is not none.<br>
|
of the referenced entities is not none.<br>
|
||||||
Example:<br>
|
Example:<br>
|
||||||
<ul>
|
<ul>
|
||||||
attr global holiday2we he
|
attr global holiday2we he
|
||||||
</ul>
|
</ul>
|
||||||
|
Note: if one of the elements in the list is called weekEnd, then the
|
||||||
|
check for saturday/sunday is skipped.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<a name="httpcompress"></a>
|
<a name="httpcompress"></a>
|
||||||
|
@ -1643,15 +1643,18 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
|||||||
<a name="holiday2we"></a>
|
<a name="holiday2we"></a>
|
||||||
<li>holiday2we<br>
|
<li>holiday2we<br>
|
||||||
Wenn dieses Attribut gesetzt wurde, dann wird die <a
|
Wenn dieses Attribut gesetzt wurde, dann wird die <a
|
||||||
href="#perl">$we</a> Variable als "true" betrachtet, wenn der
|
href="#perl">$we</a> Variable als "true" betrachtet, wenn
|
||||||
Wert der <a href="#holiday">holiday</a> Variable zu diesem Attribut
|
heute entweder Samstag/Sonntag ist, oder der Wert der <a
|
||||||
nicht "none" ist.<br>
|
href="#holiday">holiday</a> Variable zu diesem Attribut nicht
|
||||||
|
"none" ist.<br>
|
||||||
Falls es eine Komma getrennte Liste ist, dann ist es wahr, falls einer
|
Falls es eine Komma getrennte Liste ist, dann ist es wahr, falls einer
|
||||||
der referenzierten Instanzen nicht "none" ist.<br>
|
der referenzierten Instanzen nicht "none" ist.<br>
|
||||||
Beispiel:<br>
|
Beispiel:<br>
|
||||||
<ul>
|
<ul>
|
||||||
attr global holiday2we hessen
|
attr global holiday2we hessen
|
||||||
</ul>
|
</ul>
|
||||||
|
Falls sich einer der Elemente dieser Liste weekEnd nennt, dann wird
|
||||||
|
nicht auf Samstag/Sonntag geprüft.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<a name="httpcompress"></a>
|
<a name="httpcompress"></a>
|
||||||
|
17
fhem/fhem.pl
17
fhem/fhem.pl
@ -5962,14 +5962,17 @@ IsWe(;$$)
|
|||||||
$wday = (localtime(gettimeofday()))[6] if(!defined($wday));
|
$wday = (localtime(gettimeofday()))[6] if(!defined($wday));
|
||||||
$when = "state" if(!$when || $when !~ m/^(yesterday|tomorrow)$/);
|
$when = "state" if(!$when || $when !~ m/^(yesterday|tomorrow)$/);
|
||||||
|
|
||||||
my $we = ($when eq "yesterday" ? ($wday==0 || $wday==1) :
|
my ($we, $wf);
|
||||||
($when eq "state" ? ($wday==6 || $wday==0) :
|
foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
|
||||||
|
my $b = ReadingsVal($h2we, $when, 0);
|
||||||
|
$we = 1 if($b && $b ne "none");
|
||||||
|
$wf = 1 if($h2we eq "weekEnd");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$wf && !$we) {
|
||||||
|
$we = ($when eq "yesterday" ? ($wday==0 || $wday==1) :
|
||||||
|
($when eq "state" ? ($wday==6 || $wday==0) :
|
||||||
($wday==5 || $wday==6))); # tomorrow
|
($wday==5 || $wday==6))); # tomorrow
|
||||||
if(!$we) {
|
|
||||||
foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
|
|
||||||
my $b = ReadingsVal($h2we, $when, 0);
|
|
||||||
$we = 1 if($b && $b ne "none");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $we ? 1 : 0;
|
return $we ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user