diff --git a/FHEM/98_DOIF.pm b/FHEM/98_DOIF.pm
index b52d3ce86..b14202410 100644
--- a/FHEM/98_DOIF.pm
+++ b/FHEM/98_DOIF.pm
@@ -1568,10 +1568,12 @@ ParseCommandsDoIf($$$)
sub DOIF_weekdays($$)
{
my ($hash,$weekdays)=@_;
- my @days=split(',',AttrVal($hash->{NAME},"weekdays","So,Mo,Di,Mi,Do,Fr,Sa,WE,AT"));
+ my @days=split(',',AttrVal($hash->{NAME},"weekdays","So,Mo,Di,Mi,Do,Fr,Sa,WE,AT,MWE"));
+ my @edays=split(',',"Su,Mo,Tu,We,Th,Fr,Sa,WE,WD,TWE");
for (my $i=0;$i<@days;$i++)
{
$weekdays =~ s/$days[$i]/$i/;
+ $weekdays =~ s/$edays[$i]/$i/;
}
return($weekdays);
}
@@ -1684,6 +1686,7 @@ sub DOIF_time {
}
$days=DOIF_weekdays($hash,$days);
my $we=DOIF_we($wday);
+ my $twe=DOIF_tomorrow_we($wday);
if ($end gt $begin) {
if ($hms ge $begin and $hms lt $end) {
$ret=1;
@@ -1698,7 +1701,7 @@ sub DOIF_time {
}
}
if ($ret == 1) {
- return 1 if ($days eq "" or $days =~ /$wday/ or ($days =~ /7/ and $we) or ($days =~ /8/ and !$we));
+ return 1 if ($days eq "" or $days =~ /$wday/ or ($days =~ /7/ and $we) or ($days =~ /8/ and !$we) or ($days =~ /9/ and $twe));
}
return 0;
}
@@ -1717,8 +1720,9 @@ sub DOIF_time_once {
}
$days=DOIF_weekdays($hash,$days);
my $we=DOIF_we($wday);
+ my $twe=DOIF_tomorrow_we($wday);
if ($flag) {
- return 1 if ($days eq "" or $days =~ /$wday/ or ($days =~ /7/ and $we) or ($days =~ /8/ and !$we));
+ return 1 if ($days eq "" or $days =~ /$wday/ or ($days =~ /7/ and $we) or ($days =~ /8/ and !$we) or ($days =~ /9/ and $twe));
}
return 0;
}
@@ -1806,6 +1810,19 @@ sub DOIF_we($) {
return $we;
}
+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");
+ }
+ }
+ return $we;
+}
+
sub DOIF_CheckCond($$) {
my ($hash,$condition) = @_;
my $err="";
@@ -1822,6 +1839,7 @@ sub DOIF_CheckCond($$) {
my $reading;
my $internal;
my $we=DOIF_we($wday);
+ my $twe=DOIF_tomorrow_we($wday);
my $eventa=$hash->{helper}{triggerEvents};
my $device=$hash->{helper}{triggerDev};
my $event=$hash->{helper}{event};
@@ -3551,7 +3569,7 @@ The commands are always processed from left to right. There is only one command
+ time calculation on the condition: [(<time calculation in Perl with time syntax specified above>)]
+ time intervals: [<begin>-<end>]
for <begin>
and <end>
, the above time format can be selected.
+ relative times preceded by a plus sign [+<time>]
or [+<begin>-+<end>]
combined with Perl functions
-+ weekday control: [<time>|012345678]
or [<begin>-<end>|012345678]
(0-6 corresponds to Sunday through Saturday) such as 7 for $we and 8 for !$we
++ weekday control: [<time>|0123456789]
or [<begin>-<end>|0123456789]
(0-6 corresponds to Sunday through Saturday) such as 7 for $we, 8 for !$we, 9 for $we tomorrow ($twe)
+ statuses, readings, internals und time intervals for only queries without trigger with [?...]
+ DOELSEIF cases and DOELSE at the end are optional
+ delay specification with resetting is possible (watchdog function)
@@ -4195,30 +4213,33 @@ attr di_gong do always
Hinter der Zeitangabe kann ein oder mehrere Wochentage getrennt mit einem Pipezeichen | angegeben werden. Die Syntax lautet:
-[<time>|012345678]
0-8 entspricht: 0-Sonntag, 1-Montag, ... bis 6-Samstag sowie 7 für Wochenende und Feiertage (entspricht $we) und 8 für Arbeitstage (entspricht !$we)
+[<time>|0123456789]
0-9 entspricht: 0-Sonntag, 1-Montag, ... bis 6-Samstag sowie 7 für Wochenende und Feiertage (entspricht $we), 8 für Arbeitstage (entspricht !$we) und 9 für Wochenende oder Feiertag morgen (entspricht intern $twe)
alternativ mit Buchstaben-Kürzeln:
-[<time>|So Mo Di Mi Do Fr Sa WE AT]
WE entspricht der Ziffer 7 und AT der Ziffer 8
+[<time>|So Mo Di Mi Do Fr Sa WE AT MWE]
WE entspricht der Ziffer 7, AT der Ziffer 8 und MWE der Ziffer 9
+
+oder entsprechend mit englischen Bezeichnern:
+
+[<time>|Su Mo Tu We Th Fr Sa WE WD TWE]
weekdays
können beliebige Wochentagbezeichnungen definiert werden. Die Syntax lautet:weekdays <Bezeichnung für Sonntag>,<Bezeichnung für Montag>,...,<Bezeichnung für Wochenende>,<Bezeichnung für Arbeitstage>
weekdays <Bezeichnung für Sonntag>,<Bezeichnung für Montag>,...,<Bezeichnung für Wochenende oder Feiertag>,<Bezeichnung für Arbeitstage>,<Bezeichnung für Wochenende oder Feiertag morgen>
di_mydoif attr weekdays Son,Mon,Die,Mit,Don,Fre,Sam,Wochenende,Arbeitstag
di_mydoif attr weekdays Son,Mon,Die,Mit,Don,Fre,Sam,Wochenende,Arbeitstag,WochenendeMorgen
define di_radio DOIF ([06:30|Mo We] or [08:30|WE]) (set radio on) DOELSEIF ([07:30|Mo We] or [09:30|WE]) (set radio off)
attr di_radio weekdays Su,Mo,Tu,We,Th,Fr,Sa,WE,WD
define di_radio DOIF ([06:30|Mon Wochenende] or [08:30|Wochenende]) (set radio on) DOELSEIF ([07:30|Mon Wochenende] or [09:30|Wochenende]) (set radio off)
attr di_radio weekdays Son,Mon,Die,Mit,Don,Fre,Sam,Wochenende,Arbeitstag,WochenendeMorgen
define di_radio DOIF
{if ([06:30|Mo We] or [08:30|WE]) {fhem_set"radio on"}}
{if ([07:30|Mo We] or [09:30|WE]) {fhem_set"radio off"}}
attr di_radio weekdays Su,Mo,Tu,We,Th,Fr,Sa,WE,WD
define di_radio DOIF
{[06:30|[myweekday]];fhem_set"radio on"}
{[07:30|[myweekday]];fhem_set"radio off"}
-attr di_radio weekdays sunday,monday,thuesday,wednesday,thursday,friday,saturday,weekend,workdays
[+[h]:MM]
[<time>|012345678]
, [<begin>-<end>]|012345678]
[<time>|0123456789]
, [<begin>-<end>]|0123456789]
[(<Berechnung, gibt Zeit in Sekunden zurück, im Sinne von time>)]