2011-11-12 07:51:08 +00:00
|
|
|
#######################################################################
|
|
|
|
# $Id$
|
2009-05-08 16:14:03 +00:00
|
|
|
package main;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use POSIX;
|
|
|
|
|
2015-11-25 12:58:12 +00:00
|
|
|
sub holiday_refresh($;$);
|
2009-05-08 16:14:03 +00:00
|
|
|
|
|
|
|
#####################################
|
|
|
|
sub
|
|
|
|
holiday_Initialize($)
|
|
|
|
{
|
|
|
|
my ($hash) = @_;
|
|
|
|
|
|
|
|
$hash->{DefFn} = "holiday_Define";
|
|
|
|
$hash->{GetFn} = "holiday_Get";
|
|
|
|
$hash->{UndefFn} = "holiday_Undef";
|
2014-04-23 10:44:26 +00:00
|
|
|
$hash->{AttrList} = $readingFnAttributes;
|
2009-05-08 16:14:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#####################################
|
|
|
|
sub
|
|
|
|
holiday_Define($$)
|
|
|
|
{
|
|
|
|
my ($hash, $def) = @_;
|
|
|
|
|
2015-11-25 12:58:12 +00:00
|
|
|
return holiday_refresh($hash->{NAME}) if($init_done);
|
2009-05-21 09:58:09 +00:00
|
|
|
InternalTimer(gettimeofday()+1, "holiday_refresh", $hash->{NAME}, 0);
|
|
|
|
return undef;
|
2009-05-08 16:14:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub
|
|
|
|
holiday_Undef($$)
|
|
|
|
{
|
|
|
|
my ($hash, $name) = @_;
|
|
|
|
RemoveInternalTimer($name);
|
|
|
|
return undef;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub
|
2015-11-25 12:58:12 +00:00
|
|
|
holiday_refresh($;$)
|
2009-05-08 16:14:03 +00:00
|
|
|
{
|
|
|
|
my ($name, $fordate) = (@_);
|
|
|
|
my $hash = $defs{$name};
|
|
|
|
my $internal;
|
|
|
|
|
|
|
|
return if(!$hash); # Just deleted
|
|
|
|
|
|
|
|
my $nt = gettimeofday();
|
|
|
|
my @lt = localtime($nt);
|
|
|
|
my @fd;
|
|
|
|
if(!$fordate) {
|
|
|
|
$internal = 1;
|
|
|
|
$fordate = sprintf("%02d-%02d", $lt[4]+1, $lt[3]);
|
|
|
|
@fd = @lt;
|
|
|
|
} else {
|
|
|
|
my ($m,$d) = split("-", $fordate);
|
|
|
|
@fd = localtime(mktime(1,1,1,$d,$m-1,$lt[5],0,0,-1));
|
|
|
|
}
|
|
|
|
|
|
|
|
my $fname = $attr{global}{modpath} . "/FHEM/" . $hash->{NAME} . ".holiday";
|
2014-05-01 15:02:06 +00:00
|
|
|
my ($err, @holidayfile) = FileRead($fname);
|
|
|
|
return $err if($err);
|
2014-04-20 09:28:03 +00:00
|
|
|
|
2012-06-16 08:33:44 +00:00
|
|
|
my @foundList;
|
2014-04-20 09:28:03 +00:00
|
|
|
foreach my $l (@holidayfile) {
|
2009-05-08 16:14:03 +00:00
|
|
|
next if($l =~ m/^\s*#/);
|
|
|
|
next if($l =~ m/^\s*$/);
|
2012-06-16 08:33:44 +00:00
|
|
|
my $found;
|
2009-05-08 16:14:03 +00:00
|
|
|
|
|
|
|
if($l =~ m/^1/) { # Exact date: 1 MM-DD Holiday
|
|
|
|
my @args = split(" +", $l, 3);
|
|
|
|
if($args[1] eq $fordate) {
|
|
|
|
$found = $args[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
} elsif($l =~ m/^2/) { # Easter date: 2 +1 Ostermontag
|
|
|
|
|
2011-10-12 08:57:39 +00:00
|
|
|
###mh new code for easter sunday calc w.o. requirement for
|
|
|
|
# DateTime::Event::Easter
|
|
|
|
# replace $a1 with $1 !!!
|
|
|
|
# split line from file into args '2 <offset from E-sunday> <tagname>'
|
|
|
|
my @a = split(" ", $l, 3);
|
|
|
|
|
|
|
|
# get month & day for E-sunday
|
|
|
|
my ($Om,$Od) = western_easter(($lt[5]+1900));
|
|
|
|
my $timex = mktime(0,0,12,$Od,$Om-1, $lt[5],0,0,-1); # gen timevalue
|
|
|
|
$timex = $timex + $a[1]*86400; # add offset days
|
|
|
|
|
|
|
|
my ($msecond, $mminute, $mhour,
|
|
|
|
$mday, $mmonth, $myear, $mrest) = localtime($timex);
|
|
|
|
$myear = $myear+1900;
|
|
|
|
$mmonth = $mmonth+1;
|
2015-06-10 09:09:01 +00:00
|
|
|
#Log 1, "$name: Ostern:".sprintf("%04d-%02d-%02d", $lt[5]+1900, $Om, $Od).
|
|
|
|
# " Target:".sprintf("%04d-%02d-%02d", $myear, $mmonth, $mday);
|
2011-10-12 08:57:39 +00:00
|
|
|
|
|
|
|
next if($mday != $fd[3] || $mmonth != $fd[4]+1);
|
|
|
|
$found = $a[2];
|
|
|
|
Log 4, "$name: Match day: $a[2]\n";
|
2009-05-08 16:14:03 +00:00
|
|
|
|
|
|
|
} elsif($l =~ m/^3/) { # Relative date: 3 -1 Mon 03 Holiday
|
|
|
|
my @a = split(" +", $l, 5);
|
|
|
|
my %wd = ("Sun"=>0, "Mon"=>1, "Tue"=>2, "Wed"=>3,
|
|
|
|
"Thu"=>4, "Fri"=>5, "Sat"=>6);
|
|
|
|
my @md = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
2009-05-21 09:58:09 +00:00
|
|
|
$md[1]=29 if(schaltjahr($fd[5]+1900) && $fd[4] == 1);
|
2009-05-08 16:14:03 +00:00
|
|
|
my $wd = $wd{$a[2]};
|
|
|
|
if(!defined($wd)) {
|
|
|
|
Log 1, "Wrong timespec: $l";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
next if($wd != $fd[6]); # Weekday
|
|
|
|
next if($a[3] != ($fd[4]+1)); # Month
|
|
|
|
if($a[1] > 0) { # N'th day from the start
|
|
|
|
my $d = $fd[3] - ($a[1]-1)*7;
|
|
|
|
next if($d < 1 || $d > 7);
|
|
|
|
} elsif($a[1] < 0) { # N'th day from the end
|
|
|
|
my $d = $fd[3] - ($a[1]+1)*7;
|
|
|
|
my $md = $md[$fd[4]];
|
|
|
|
next if($d > $md || $d < $md-6);
|
|
|
|
}
|
|
|
|
|
|
|
|
$found = $a[4];
|
|
|
|
|
|
|
|
} elsif($l =~ m/^4/) { # Interval: 4 MM-DD MM-DD Holiday
|
|
|
|
my @args = split(" +", $l, 4);
|
|
|
|
if($args[1] le $fordate && $args[2] ge $fordate) {
|
|
|
|
$found = $args[3];
|
|
|
|
}
|
2009-05-23 07:32:08 +00:00
|
|
|
|
|
|
|
} elsif($l =~ m/^5/) { # nth weekday since MM-DD / before MM-DD
|
|
|
|
my @a = split(" +", $l, 6);
|
2012-11-22 15:32:00 +00:00
|
|
|
# arguments: 5 <distance> <weekday> <month> <day> <name>
|
2009-05-23 07:32:08 +00:00
|
|
|
my %wd = ("Sun"=>0, "Mon"=>1, "Tue"=>2, "Wed"=>3,
|
|
|
|
"Thu"=>4, "Fri"=>5, "Sat"=>6);
|
|
|
|
my $wd = $wd{$a[2]};
|
|
|
|
if(!defined($wd)) {
|
|
|
|
Log 1, "Wrong weekday spec: $l";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
next if $wd != $fd[6]; # check wether weekday matches today
|
|
|
|
my $yday=$fd[7];
|
|
|
|
# create time object of target date - mktime counts months and their
|
|
|
|
# days from 0 instead of 1, so subtract 1 from each
|
2012-11-22 15:32:00 +00:00
|
|
|
my $tgt=mktime(0,0,1,$a[4]-1,$a[3]-1,$fd[5],0,0,-1);
|
2009-05-23 07:32:08 +00:00
|
|
|
my $tgtmin=$tgt;
|
|
|
|
my $tgtmax=$tgt;
|
|
|
|
my $weeksecs=7*24*60*60; # 7 days, 24 hours, 60 minutes, 60seconds each
|
|
|
|
my $cd=mktime(0,0,1,$fd[3],$fd[4],$fd[5],0,0,-1);
|
|
|
|
if ( $a[1] =~ /^-([0-9])*$/ ) {
|
|
|
|
$tgtmin -= $1*$weeksecs; # Minimum: target date minus $1 weeks
|
|
|
|
$tgtmax = $tgtmin+$weeksecs; # Maximum: one week after minimum
|
|
|
|
# needs to be lower than max and greater than or equal to min
|
2012-06-16 08:33:44 +00:00
|
|
|
if( ($cd ge $tgtmin) && ( $cd lt $tgtmax) ) {
|
|
|
|
$found=$a[5];
|
2009-05-23 07:32:08 +00:00
|
|
|
}
|
|
|
|
} elsif ( $a[1] =~ /^\+?([0-9])*$/ ) {
|
|
|
|
$tgtmin += ($1-1)*$weeksecs; # Minimum: target date plus $1-1 weeks
|
|
|
|
$tgtmax = $tgtmin+$weeksecs; # Maximum: one week after minimum
|
|
|
|
# needs to be lower than or equal to max and greater min
|
2012-06-16 08:33:44 +00:00
|
|
|
if( ($cd gt $tgtmin) && ( $cd le $tgtmax) ) {
|
|
|
|
$found=$a[5];
|
2009-05-23 07:32:08 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Log 1, "Wrong distance spec: $l";
|
|
|
|
next;
|
|
|
|
}
|
2009-05-08 16:14:03 +00:00
|
|
|
}
|
2012-06-16 08:33:44 +00:00
|
|
|
push @foundList, $found if($found);
|
2009-05-21 09:58:09 +00:00
|
|
|
|
2009-05-08 16:14:03 +00:00
|
|
|
}
|
|
|
|
|
2012-06-16 08:33:44 +00:00
|
|
|
push @foundList, "none" if(!int(@foundList));
|
|
|
|
my $found = join(", ", @foundList);
|
|
|
|
|
2009-05-08 16:14:03 +00:00
|
|
|
RemoveInternalTimer($name);
|
|
|
|
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]); # Midnight
|
|
|
|
$nt += 86400 + 2; # Tomorrow
|
|
|
|
$hash->{TRIGGERTIME} = $nt;
|
|
|
|
InternalTimer($nt, "holiday_refresh", $name, 0);
|
|
|
|
|
|
|
|
if($internal) {
|
2014-04-23 10:44:26 +00:00
|
|
|
readingsBeginUpdate($hash);
|
|
|
|
readingsBulkUpdate($hash, 'state', $found);
|
|
|
|
readingsBulkUpdate($hash, 'yesterday', CommandGet(undef,"$name yesterday"));
|
|
|
|
readingsBulkUpdate($hash, 'tomorrow', CommandGet(undef,"$name tomorrow"));
|
|
|
|
readingsEndUpdate($hash,1);
|
2009-05-08 16:14:03 +00:00
|
|
|
return undef;
|
|
|
|
} else {
|
|
|
|
return $found;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub
|
|
|
|
holiday_Get($@)
|
|
|
|
{
|
|
|
|
my ($hash, @a) = @_;
|
|
|
|
|
2014-03-26 23:14:05 +00:00
|
|
|
shift(@a) if($a[1] && $a[1] eq "MM-DD");
|
2014-05-19 10:09:42 +00:00
|
|
|
return "argument is missing" if(int(@a) < 2);
|
2012-05-12 07:57:49 +00:00
|
|
|
my $arg;
|
|
|
|
|
|
|
|
if($a[1] =~ m/^[01]\d-[0-3]\d/) {
|
|
|
|
$arg = $a[1];
|
|
|
|
|
2014-05-19 10:09:42 +00:00
|
|
|
} elsif($a[1] =~ m/^(yesterday|today|tomorrow)$/) {
|
2012-05-12 07:57:49 +00:00
|
|
|
my $t = time();
|
|
|
|
$t += 86400 if($a[1] eq "tomorrow");
|
|
|
|
$t -= 86400 if($a[1] eq "yesterday");
|
|
|
|
my @a = localtime($t);
|
|
|
|
$arg = sprintf("%02d-%02d", $a[4]+1, $a[3]);
|
|
|
|
|
2014-05-19 10:09:42 +00:00
|
|
|
} elsif($a[1] eq "days") {
|
|
|
|
my $t = time() + ($a[2] ? int($a[2]) : 0)*86400;
|
|
|
|
my @a = localtime($t);
|
|
|
|
$arg = sprintf("%02d-%02d", $a[4]+1, $a[3]);
|
|
|
|
|
2012-05-12 07:57:49 +00:00
|
|
|
} else {
|
2014-12-27 09:23:04 +00:00
|
|
|
return "unknown argument $a[1], choose one of ".
|
|
|
|
"yesterday:noArg today:noArg tomorrow:noArg days:2,3,4,5,6,7 MM-DD";
|
2012-05-12 07:57:49 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return holiday_refresh($hash->{NAME}, $arg);
|
2009-05-08 16:14:03 +00:00
|
|
|
}
|
|
|
|
|
2009-05-18 12:53:41 +00:00
|
|
|
sub
|
|
|
|
schaltjahr($)
|
|
|
|
{
|
|
|
|
my($jahr) = @_;
|
|
|
|
return 0 if $jahr % 4; # 2009
|
|
|
|
return 1 unless $jahr % 400; # 2000
|
|
|
|
return 0 unless $jahr % 100; # 2100
|
|
|
|
return 1; # 2012
|
|
|
|
}
|
|
|
|
|
2011-10-12 08:57:39 +00:00
|
|
|
### mh sub western_easter copied from cpan Date::Time::Easter
|
|
|
|
### mh changes marked with # mh
|
|
|
|
### mh
|
|
|
|
### mh calling parameter is 4 digit year
|
|
|
|
### mh
|
|
|
|
sub
|
|
|
|
western_easter($)
|
|
|
|
{
|
|
|
|
my $year = shift;
|
|
|
|
my $golden_number = $year % 19;
|
|
|
|
|
|
|
|
#quasicentury is so named because its a century, only its
|
|
|
|
# the number of full centuries rather than the current century
|
|
|
|
my $quasicentury = int($year / 100);
|
|
|
|
my $epact = ($quasicentury - int($quasicentury/4) -
|
|
|
|
int(($quasicentury * 8 + 13)/25) + ($golden_number*19) + 15) % 30;
|
|
|
|
|
|
|
|
my $interval = $epact - int($epact/28)*
|
|
|
|
(1 - int(29/($epact+1)) * int((21 - $golden_number)/11) );
|
|
|
|
my $weekday = ($year + int($year/4) + $interval +
|
|
|
|
2 - $quasicentury + int($quasicentury/4)) % 7;
|
|
|
|
|
|
|
|
my $offset = $interval - $weekday;
|
|
|
|
my $month = 3 + int(($offset+40)/44);
|
|
|
|
my $day = $offset + 28 - 31* int($month/4);
|
|
|
|
|
|
|
|
return $month, $day;
|
|
|
|
}
|
2009-05-08 16:14:03 +00:00
|
|
|
1;
|
2012-11-04 13:49:43 +00:00
|
|
|
|
|
|
|
=pod
|
2016-08-19 12:47:50 +00:00
|
|
|
=item summary define holidays in a local file
|
|
|
|
=item summary_DE Urlaubs-/Feiertagskalender aus einer lokalen Datei
|
2012-11-04 13:49:43 +00:00
|
|
|
=begin html
|
|
|
|
|
|
|
|
<a name="holiday"></a>
|
|
|
|
<h3>holiday</h3>
|
|
|
|
<ul>
|
|
|
|
<a name="holidaydefine"></a>
|
|
|
|
<b>Define</b>
|
|
|
|
<ul>
|
|
|
|
<code>define <name> holiday</code>
|
|
|
|
<br><br>
|
|
|
|
Define a set of holidays. The module will try to open the file
|
|
|
|
<name>.holiday in the <a href="#modpath">modpath</a>/FHEM directory.
|
|
|
|
If entries in the holiday file match the current day, then the STATE of
|
|
|
|
this holiday instance displayed in the <a href="#list">list</a> command
|
|
|
|
will be set to the corresponding values, else the state is set to the text
|
|
|
|
none. Most probably you'll want to query this value in some perl script:
|
|
|
|
see Value() in the <a href="#perl">perl</a> section or the global attribute
|
|
|
|
<a href="#holiday2we"> holiday2we</a>.<br> The file will be reread once
|
|
|
|
every night, to compute the value for the current day, and by each get
|
|
|
|
command (see below).<br>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
Holiday file definition:<br>
|
|
|
|
The file may contain comments (beginning with #) or empty lines.
|
|
|
|
Significant lines begin with a number (type) and contain some space
|
|
|
|
separated words, depending on the type. The different types are:<br>
|
|
|
|
<ul>
|
|
|
|
<li>1<br>
|
|
|
|
Exact date. Arguments: <MM-DD> <holiday-name><br>
|
|
|
|
Exampe: 1 12-24 Christmas
|
|
|
|
</li>
|
|
|
|
<li>2<br>
|
|
|
|
Easter-dependent date. Arguments: <day-offset>
|
|
|
|
<holiday-name>.
|
|
|
|
The offset is counted from Easter-Sunday.
|
|
|
|
<br>
|
|
|
|
Exampe: 2 1 Easter-Monday<br>
|
|
|
|
Sidenote: You can check the easter date with:
|
|
|
|
fhem> { join("-", western_easter(2011)) }
|
|
|
|
</li>
|
|
|
|
<li>3<br>
|
|
|
|
Month dependent date. Arguments: <nth> <weekday>
|
|
|
|
<month <holiday-name>.<br>
|
|
|
|
Examples:<br>
|
|
|
|
<ul>
|
|
|
|
3 1 Mon 05 First Monday In May<br>
|
|
|
|
3 2 Mon 05 Second Monday In May<br>
|
|
|
|
3 -1 Mon 05 Last Monday In May<br>
|
|
|
|
3 0 Mon 05 Each Monday In May<br>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li>4<br>
|
|
|
|
Interval. Arguments: <MM-DD> <MM-DD> <holiday-name>
|
|
|
|
.<br>
|
2016-12-30 09:29:05 +00:00
|
|
|
Note: An interval cannot contain the year-end.
|
2012-11-04 13:49:43 +00:00
|
|
|
Example:<br>
|
|
|
|
<ul>
|
|
|
|
4 06-01 06-30 Summer holiday<br>
|
2016-12-30 09:29:05 +00:00
|
|
|
4 12-20 01-10 Winter holiday # DOES NOT WORK.
|
|
|
|
Use the following 2 lines instead:<br>
|
|
|
|
4 12-20 12-31 Winter holiday<br>
|
|
|
|
4 01-01 01-10 Winter holiday<br>
|
2012-11-04 13:49:43 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li>5<br>
|
|
|
|
Date relative, weekday fixed holiday. Arguments: <nth>
|
|
|
|
<weekday> <month> <day> < holiday-name><br>
|
|
|
|
Note that while +0 or -0 as offsets are not forbidden, their behaviour
|
|
|
|
is undefined in the sense that it might change without notice.<br>
|
|
|
|
Examples:<br>
|
|
|
|
<ul>
|
|
|
|
5 -1 Wed 11 23 Buss und Bettag (first Wednesday before Nov, 23rd)<br>
|
|
|
|
5 1 Mon 01 31 First Monday after Jan, 31st (1st Monday in February)<br>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
See also he.holiday in the contrib directory for official holidays in the
|
|
|
|
german country of Hessen, and by.holiday for the Bavarian definition.
|
|
|
|
</ul>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<a name="holidayset"></a>
|
|
|
|
<b>Set</b> <ul>N/A</ul><br>
|
|
|
|
|
|
|
|
<a name="holidayget"></a>
|
|
|
|
<b>Get</b>
|
|
|
|
<ul>
|
|
|
|
<code>get <name> <MM-DD></code><br>
|
|
|
|
<code>get <name> yesterday</code><br>
|
|
|
|
<code>get <name> today</code><br>
|
|
|
|
<code>get <name> tomorrow</code><br>
|
2014-05-19 10:09:42 +00:00
|
|
|
<code>get <name> days <offset></code><br>
|
2012-11-04 13:49:43 +00:00
|
|
|
<br><br>
|
|
|
|
Return the holiday name of the specified date or the text none.
|
|
|
|
<br><br>
|
|
|
|
</ul>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<a name="holidayattr"></a>
|
|
|
|
<b>Attributes</b><ul>N/A</ul><br>
|
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
=end html
|
2014-03-30 16:20:26 +00:00
|
|
|
|
|
|
|
=begin html_DE
|
|
|
|
|
|
|
|
<a name="holiday"></a>
|
|
|
|
<h3>holiday</h3>
|
|
|
|
<ul>
|
|
|
|
<a name="holidaydefine"></a>
|
|
|
|
<b>Define</b>
|
|
|
|
<ul>
|
|
|
|
<code>define <name> holiday</code>
|
|
|
|
<br><br>
|
|
|
|
Definiert einen Satz mit Urlaubsinformationen. Das Modul versucht die Datei
|
|
|
|
<name>.holiday im Pfad <a href="#modpath">modpath</a>/FHEM zu
|
|
|
|
öffnen.
|
|
|
|
Wenn Einträge im der Datei auf den aktuellen Tag passen wird der STATE
|
|
|
|
der Holiday-Instanz die im <a href="#list">list</a> Befehl angezeigt wird
|
|
|
|
auf die entsprechenden Werte gesetzt. Andernfalls ist der STATE auf den
|
|
|
|
Text "none" gesetzt.
|
|
|
|
|
|
|
|
Meistens wird dieser Wert mit einem Perl Script abgefragt: siehe Value() im
|
|
|
|
<a href="#perl">perl</a> Abschnitt oder im globalen Attribut <a
|
|
|
|
href="#holiday2we"> holiday2we</a>.<br> Die Datei wird jede Nacht neu
|
|
|
|
eingelesen um den Wert des aktuellen Tages zu erzeugen. Auch jeder "get"
|
|
|
|
Befehl liest die Datei neu ein.
|
|
|
|
|
|
|
|
<br><br>
|
|
|
|
|
|
|
|
Holiday file Definition:<br>
|
|
|
|
Die Datei darf Kommentare, beginnend mit #, und Leerzeilen enthalten. Die
|
|
|
|
entscheidenden Zeilen beginnen mit einer Zahl (Typ) und enthalten durch
|
|
|
|
Leerzeichen getrennte Wörter, je nach Typ. Die verschiedenen Typen
|
|
|
|
sind:<br>
|
|
|
|
<ul>
|
|
|
|
<li>1<br>
|
|
|
|
Genaues Datum. Argument: <MM-TT> <Feiertag-Name><br>
|
|
|
|
Beispiel: 1 12-24 Weihnachten
|
|
|
|
</li>
|
|
|
|
<li>2<br>
|
|
|
|
Oster-abhängiges Datum. Argument: <Tag-Offset>
|
|
|
|
<Feiertag-Name>.
|
|
|
|
Der Offset wird vom Oster-Sonntag an gezählt.
|
|
|
|
<br>
|
|
|
|
Beispiel: 2 1 Oster-Montag<br>
|
|
|
|
Hinweis: Das Osterdatum kann vorher geprüft werden:
|
|
|
|
fhem> { join("-", western_easter(2011)) }
|
|
|
|
</li>
|
|
|
|
<li>3<br>
|
|
|
|
Monats-abhängiges Datum. Argument: <X> <Wochentag>
|
|
|
|
<Monat> <Feiertag-Name>.<br>
|
|
|
|
Beispiel:<br>
|
|
|
|
<ul>
|
|
|
|
3 1 Mon 05 Erster Montag In Mai<br>
|
|
|
|
3 2 Mon 05 Zweiter Montag In Mai<br>
|
|
|
|
3 -1 Mon 05 Letzter Montag In Mai<br>
|
|
|
|
3 0 Mon 05 Jeder Montag In Mai<br>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li>4<br>
|
|
|
|
Intervall. Argument: <MM-TT> <MM-TT> <Feiertag-Name>
|
|
|
|
.<br>
|
2016-12-30 09:29:05 +00:00
|
|
|
Achtung: Ein Intervall darf kein Jahresende enthalten.
|
2014-03-30 16:20:26 +00:00
|
|
|
Beispiel:<br>
|
|
|
|
<ul>
|
|
|
|
4 06-01 06-30 Sommerferien<br>
|
2016-12-30 09:29:05 +00:00
|
|
|
4 12-20 01-10 Winterferien # FUNKTIONIER NICHT,
|
|
|
|
stattdessen folgendes verwenden:<br>
|
|
|
|
4 12-20 12-31 Winterferien<br>
|
|
|
|
4 01-01 01-10 Winterferien<br>
|
2014-03-30 16:20:26 +00:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
<li>5<br>
|
|
|
|
Datum relativ, Wochentags ein fester Urlaubstag/Feiertag. Argument:
|
|
|
|
<X> <Wochentag> <Monat> <Tag>
|
|
|
|
<Feiertag-Name><br> Hinweis: Da +0 oder -0 als Offset nicht
|
|
|
|
verboten sind, ist das Verhalten hier nicht definiert, kann sich also
|
|
|
|
ohne Info ändern;<br>
|
|
|
|
Beispiel:<br>
|
|
|
|
<ul>
|
|
|
|
5 -1 Wed 11 23 Buss und Bettag (erster Mittwoch vor dem 23. Nov)<br>
|
|
|
|
5 1 Mon 01 31 Erster Montag in Februar<br>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
Siehe auch he.holiday im contrib Verzeichnis für offizielle Feiertage
|
|
|
|
in den deutschen Bundesländern Hessen und by.holiday für Bayern.
|
|
|
|
</ul>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<a name="holidayset"></a>
|
|
|
|
<b>Set</b> <ul>N/A</ul><br>
|
|
|
|
|
|
|
|
<a name="holidayget"></a>
|
|
|
|
<b>Get</b>
|
|
|
|
<ul>
|
|
|
|
<code>get <name> <MM-DD></code><br>
|
|
|
|
<code>get <name> yesterday</code><br>
|
|
|
|
<code>get <name> today</code><br>
|
|
|
|
<code>get <name> tomorrow</code><br>
|
2014-05-19 10:09:42 +00:00
|
|
|
<code>get <name> days <offset></code><br>
|
2014-03-30 16:20:26 +00:00
|
|
|
<br><br>
|
|
|
|
Gibt den Name des Feiertages zum angebenenen Datum zurück oder den
|
|
|
|
Text none.
|
|
|
|
<br><br>
|
|
|
|
</ul>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<a name="holidayattr"></a>
|
2014-04-23 10:44:26 +00:00
|
|
|
<b>Attributes</b><ul>
|
|
|
|
<li><a href="#readingFnAttributes">readingFnAttributes</a></li>
|
|
|
|
</ul><br>
|
2014-03-30 16:20:26 +00:00
|
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
=end html_DE
|
2012-11-04 13:49:43 +00:00
|
|
|
=cut
|