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