mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
98_DOIF.pm: $we, $wte multiple holiday files now possible, fixed: DOELSE {Perl}
git-svn-id: https://svn.fhem.de/fhem/trunk@18890 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b2c8a30876
commit
8a07906192
@ -1874,12 +1874,13 @@ sub DOIF_we($) {
|
|||||||
my ($wday)=@_;
|
my ($wday)=@_;
|
||||||
my $we = (($wday==0 || $wday==6) ? 1 : 0);
|
my $we = (($wday==0 || $wday==6) ? 1 : 0);
|
||||||
if(!$we) {
|
if(!$we) {
|
||||||
my $h2we = $attr{global}{holiday2we};
|
foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
|
||||||
if($h2we && Value($h2we)) {
|
if($h2we && Value($h2we)) {
|
||||||
my ($a, $b) = ReplaceEventMap($h2we, [$h2we, Value($h2we)], 0);
|
my ($a, $b) = ReplaceEventMap($h2we, [$h2we, Value($h2we)], 0);
|
||||||
$we = 1 if($b ne "none");
|
$we = 1 if($b ne "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $we;
|
return $we;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1887,12 +1888,13 @@ sub DOIF_tomorrow_we($) {
|
|||||||
my ($wday)=@_;
|
my ($wday)=@_;
|
||||||
my $we = (($wday==5 || $wday==6) ? 1 : 0);
|
my $we = (($wday==5 || $wday==6) ? 1 : 0);
|
||||||
if(!$we) {
|
if(!$we) {
|
||||||
my $h2we = $attr{global}{holiday2we};
|
foreach my $h2we (split(",", AttrVal("global", "holiday2we", ""))) {
|
||||||
if($h2we && ReadingsVal($h2we,"tomorrow",0)) {
|
if($h2we && ReadingsVal($h2we,"tomorrow",0)) {
|
||||||
my ($a, $b) = ReplaceEventMap($h2we, [$h2we, ReadingsVal($h2we,"tomorrow",0)], 0);
|
my ($a, $b) = ReplaceEventMap($h2we, [$h2we, ReadingsVal($h2we,"tomorrow",0)], 0);
|
||||||
$we = 1 if($b ne "none");
|
$we = 1 if($b ne "none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $we;
|
return $we;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3118,9 +3120,15 @@ CmdDoIf($$)
|
|||||||
return ($tail,"expected DOELSE");
|
return ($tail,"expected DOELSE");
|
||||||
}
|
}
|
||||||
$j=0;
|
$j=0;
|
||||||
while ($tail =~ /^\s*\(/) {
|
while ($tail =~ /^\s*(\(|\{)/) {
|
||||||
|
if ($tail =~ /^\s*\(/) {
|
||||||
($beginning,$else_cmd_ori,$err,$tail)=GetBlockDoIf($tail,'[\(\)]');
|
($beginning,$else_cmd_ori,$err,$tail)=GetBlockDoIf($tail,'[\(\)]');
|
||||||
return ($else_cmd_ori,$err) if ($err);
|
return ($else_cmd_ori,$err) if ($err);
|
||||||
|
} elsif ($tail =~ /^\s*\{/) {
|
||||||
|
($beginning,$else_cmd_ori,$err,$tail)=GetBlockDoIf($tail,'[\{\}]');
|
||||||
|
return ($else_cmd_ori,$err) if ($err);
|
||||||
|
$else_cmd_ori="{".$else_cmd_ori."}";
|
||||||
|
}
|
||||||
($else_cmd,$err)=ParseCommandsDoIf($hash,$else_cmd_ori,0);
|
($else_cmd,$err)=ParseCommandsDoIf($hash,$else_cmd_ori,0);
|
||||||
return ($else_cmd,$err) if ($err);
|
return ($else_cmd,$err) if ($err);
|
||||||
$hash->{do}{$last_do+1}{$j++}=$else_cmd_ori;
|
$hash->{do}{$last_do+1}{$j++}=$else_cmd_ori;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user