mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +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>
|
||||
<li>holiday2we<br>
|
||||
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>
|
||||
variable referenced by this attribute is not none.<br>
|
||||
If it is a comma separated list, then it is true, if one of the
|
||||
referenced entities is not none.<br>
|
||||
will be true, if it is either saturday/sunday, or the value of the <a
|
||||
href="#holiday">holiday</a> variable referenced by this attribute is
|
||||
not none.<br> If it is a comma separated list, then it is true, if one
|
||||
of the referenced entities is not none.<br>
|
||||
Example:<br>
|
||||
<ul>
|
||||
attr global holiday2we he
|
||||
</ul>
|
||||
Note: if one of the elements in the list is called weekEnd, then the
|
||||
check for saturday/sunday is skipped.
|
||||
</li><br>
|
||||
|
||||
<a name="httpcompress"></a>
|
||||
|
@ -1643,15 +1643,18 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
<a name="holiday2we"></a>
|
||||
<li>holiday2we<br>
|
||||
Wenn dieses Attribut gesetzt wurde, dann wird die <a
|
||||
href="#perl">$we</a> Variable als "true" betrachtet, wenn der
|
||||
Wert der <a href="#holiday">holiday</a> Variable zu diesem Attribut
|
||||
nicht "none" ist.<br>
|
||||
href="#perl">$we</a> Variable als "true" betrachtet, wenn
|
||||
heute entweder Samstag/Sonntag ist, oder der Wert der <a
|
||||
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
|
||||
der referenzierten Instanzen nicht "none" ist.<br>
|
||||
Beispiel:<br>
|
||||
<ul>
|
||||
attr global holiday2we hessen
|
||||
</ul>
|
||||
Falls sich einer der Elemente dieser Liste weekEnd nennt, dann wird
|
||||
nicht auf Samstag/Sonntag geprüft.
|
||||
</li><br>
|
||||
|
||||
<a name="httpcompress"></a>
|
||||
|
17
fhem/fhem.pl
17
fhem/fhem.pl
@ -5962,14 +5962,17 @@ IsWe(;$$)
|
||||
$wday = (localtime(gettimeofday()))[6] if(!defined($wday));
|
||||
$when = "state" if(!$when || $when !~ m/^(yesterday|tomorrow)$/);
|
||||
|
||||
my $we = ($when eq "yesterday" ? ($wday==0 || $wday==1) :
|
||||
($when eq "state" ? ($wday==6 || $wday==0) :
|
||||
my ($we, $wf);
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user