mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-13 23:36:37 +00:00
added get commands yesterday/tommorrow
git-svn-id: https://svn.fhem.de/fhem/trunk@1555 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3105323f9b
commit
cd2a10044b
@ -197,8 +197,23 @@ holiday_Get($@)
|
||||
my ($hash, @a) = @_;
|
||||
|
||||
return "argument is missing" if(int(@a) != 2);
|
||||
return "wrong argument: need MM-DD" if($a[1] !~ m/^[01]\d-[0-3]\d$/);
|
||||
return holiday_refresh($hash->{NAME}, $a[1]);
|
||||
my $arg;
|
||||
|
||||
if($a[1] =~ m/^[01]\d-[0-3]\d/) {
|
||||
$arg = $a[1];
|
||||
|
||||
} elsif($a[1] =~ m/^yesterday|today|tomorrow$/) {
|
||||
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]);
|
||||
|
||||
} else {
|
||||
return "wrong argument: need MM-DD/yesterday/today/tomorrow"
|
||||
|
||||
}
|
||||
return holiday_refresh($hash->{NAME}, $arg);
|
||||
}
|
||||
|
||||
sub
|
||||
|
@ -8838,7 +8838,10 @@ KlikAanKlikUit, NEXA, CHACON, HomeEasy UK. <br> You need to define an RFXtrx433
|
||||
<a name="holidayget"></a>
|
||||
<b>Get</b>
|
||||
<ul>
|
||||
<code>get <name> <MM-DD></code>
|
||||
<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>
|
||||
<br><br>
|
||||
Return the holiday name of the specified date or the text none.
|
||||
<br><br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user