2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

fhem.pl: add day to disabledForIntervals (Forum #62018)

git-svn-id: https://svn.fhem.de/fhem/trunk@12717 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-12-05 21:53:35 +00:00
parent 64014c9393
commit cb6f856175
2 changed files with 18 additions and 11 deletions

View File

@ -550,10 +550,12 @@ EOF
<a name="disabledForIntervals"></a> <a name="disabledForIntervals"></a>
<li>disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...<br> <li>disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...<br>
Space separated list of HH:MM tupels. If the current time is between Space separated list of HH:MM or D@HH:MM tupels. If the current time is
the two time specifications, the current device is disabled. Instead of between the two time specifications, the current device is disabled.
HH:MM you can also specify HH or HH:MM:SS. To specify an interval Instead of HH:MM you can also specify HH or HH:MM:SS. D is the day of
spawning midnight, you have to specify two intervals, e.g.: the week, with 0 indicating Sunday and 3 indicating Wednesday. To
specify an interval spawning midnight, you have to specify two
intervals, e.g.:
<ul> <ul>
23:00-24:00 00:00-01:00 23:00-24:00 00:00-01:00
</ul> </ul>
@ -735,11 +737,12 @@ EOF
<a name="disabledForIntervals"></a> <a name="disabledForIntervals"></a>
<li>disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...<br> <li>disabledForIntervals HH:MM-HH:MM HH:MM-HH-MM...<br>
Das Argument ist eine Leerzeichengetrennte Liste von Minuszeichen- Das Argument ist eine Leerzeichengetrennte Liste von Minuszeichen-
getrennten HH:MM Paaren. Falls die aktuelle Uhrzeit zwischen diesen getrennten HH:MM oder D@HH:MM Paaren. Falls die aktuelle Uhrzeit
Werten f&auml;llt, dann wird die Ausf&uuml;hrung, wie beim disable, zwischen diesen Werten f&auml;llt, dann wird die Ausf&uuml;hrung, wie
ausgesetzt. Statt HH:MM kann man auch HH oder HH:MM:SS angeben. beim disable, ausgesetzt. Statt HH:MM kann man auch HH oder HH:MM:SS
Um einen Intervall um Mitternacht zu spezifizieren, muss man zwei angeben. D ist der Tag der Woche, mit 0 als Sonntag and 3 als
einzelne angeben, z.Bsp.: Mittwoch. Um einen Intervall um Mitternacht zu spezifizieren, muss man
zwei einzelne angeben, z.Bsp.:
<ul> <ul>
23:00-24:00 00:00-01:00 23:00-24:00 00:00-01:00
</ul> </ul>

View File

@ -777,10 +777,14 @@ IsDisabled($)
my $dfi = $attr{$devname}{disabledForIntervals}; my $dfi = $attr{$devname}{disabledForIntervals};
if(defined($dfi)) { if(defined($dfi)) {
my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime; my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime;
my $hms = sprintf("%02d:%02d:%02d", $hour, $min, $sec); my $dhms = sprintf("%s\@%02d:%02d:%02d", $wday, $hour, $min, $sec);
foreach my $ft (split(" ", $dfi)) { foreach my $ft (split(" ", $dfi)) {
my ($from, $to) = split("-", $ft); my ($from, $to) = split("-", $ft);
return 2 if($from && $to && $from le $hms && $hms le $to); if($from && $to) {
$from = "$wday\@$from" if(index($from,"@") < 0);
$to = "$wday\@$to" if(index($to, "@") < 0);
return 2 if($from le $dhms && $dhms le $to);
}
} }
} }