2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

98_DOIF.pm: IsWe() is used now

git-svn-id: https://svn.fhem.de/fhem/trunk@20268 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Damian 2019-09-28 21:00:39 +00:00
parent ec1fdf2d3f
commit 970cdb7312

View File

@ -1897,29 +1897,31 @@ sub DOIF_SetState($$$$$) {
sub DOIF_we($) {
my ($wday)=@_;
my $we = (($wday==0 || $wday==6) ? 1 : 0);
if(!$we) {
foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
if($h2we && Value($h2we)) {
my ($a, $b) = ReplaceEventMap($h2we, [$h2we, Value($h2we)], 0);
$we = 1 if($b ne "none");
}
}
}
my $we=IsWe("",$wday);
#my $we = (($wday==0 || $wday==6) ? 1 : 0);
#if(!$we) {
# foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
# if($h2we && Value($h2we)) {
# my ($a, $b) = ReplaceEventMap($h2we, [$h2we, Value($h2we)], 0);
# $we = 1 if($b ne "none");
# }
# }
#}
return $we;
}
sub DOIF_tomorrow_we($) {
my ($wday)=@_;
my $we = (($wday==5 || $wday==6) ? 1 : 0);
if(!$we) {
foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
if($h2we && ReadingsVal($h2we,"tomorrow",0)) {
my ($a, $b) = ReplaceEventMap($h2we, [$h2we, ReadingsVal($h2we,"tomorrow",0)], 0);
$we = 1 if($b ne "none");
}
}
}
my $we=IsWe("tomorrow",$wday);
#my $we = (($wday==5 || $wday==6) ? 1 : 0);
#if(!$we) {
# foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
# if($h2we && ReadingsVal($h2we,"tomorrow",0)) {
# my ($a, $b) = ReplaceEventMap($h2we, [$h2we, ReadingsVal($h2we,"tomorrow",0)], 0);
# $we = 1 if($b ne "none");
# }
# }
#}
return $we;
}
@ -2436,8 +2438,11 @@ DOIF_Notify($$)
my $eventas;
return "" if ($dev->{NAME} !~ /$hash->{helper}{DEVFILTER}/);
#Log3 ($pn,1,"pn: $pn, dev: $dev->{NAME}, devfilter: $devfilter");
if (!defined($hash->{helper}{DEVFILTER})) {
return "";
} elsif ($dev->{NAME} !~ /$hash->{helper}{DEVFILTER}/) {
return "";
}
$eventa = deviceEvents($dev, AttrVal($pn, "addStateEvent", 0));
$eventas = deviceEvents($dev, 1);