From 8a079061926e23e9cf201d2794949eef45299ec8 Mon Sep 17 00:00:00 2001 From: Damian <> Date: Wed, 13 Mar 2019 18:56:41 +0000 Subject: [PATCH] 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 --- fhem/FHEM/98_DOIF.pm | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm index ac29f45da..a50680c05 100644 --- a/fhem/FHEM/98_DOIF.pm +++ b/fhem/FHEM/98_DOIF.pm @@ -1874,10 +1874,11 @@ sub DOIF_we($) { my ($wday)=@_; my $we = (($wday==0 || $wday==6) ? 1 : 0); if(!$we) { - my $h2we = $attr{global}{holiday2we}; - if($h2we && Value($h2we)) { - my ($a, $b) = ReplaceEventMap($h2we, [$h2we, Value($h2we)], 0); - $we = 1 if($b ne "none"); + 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; @@ -1887,10 +1888,11 @@ sub DOIF_tomorrow_we($) { my ($wday)=@_; my $we = (($wday==5 || $wday==6) ? 1 : 0); if(!$we) { - my $h2we = $attr{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"); + 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; @@ -3118,12 +3120,18 @@ CmdDoIf($$) return ($tail,"expected DOELSE"); } $j=0; - while ($tail =~ /^\s*\(/) { - ($beginning,$else_cmd_ori,$err,$tail)=GetBlockDoIf($tail,'[\(\)]'); - return ($else_cmd_ori,$err) if ($err); - ($else_cmd,$err)=ParseCommandsDoIf($hash,$else_cmd_ori,0); - return ($else_cmd,$err) if ($err); - $hash->{do}{$last_do+1}{$j++}=$else_cmd_ori; + while ($tail =~ /^\s*(\(|\{)/) { + if ($tail =~ /^\s*\(/) { + ($beginning,$else_cmd_ori,$err,$tail)=GetBlockDoIf($tail,'[\(\)]'); + 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); + return ($else_cmd,$err) if ($err); + $hash->{do}{$last_do+1}{$j++}=$else_cmd_ori; } $hash->{do}{$last_do+1}{0}=$else_cmd_ori if ($j==0); #doelse without brackets }