mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
Bugfix: close FH, override initial setstate
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@374 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cd08ba87b7
commit
1c46ae0129
@ -1,4 +1,4 @@
|
|||||||
##############################################
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
@ -25,7 +25,9 @@ holiday_Define($$)
|
|||||||
{
|
{
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
|
|
||||||
return holiday_refresh($hash->{NAME}, undef);
|
return holiday_refresh($hash->{NAME}, undef) if($init_done);
|
||||||
|
InternalTimer(gettimeofday()+1, "holiday_refresh", $hash->{NAME}, 0);
|
||||||
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
@ -75,7 +77,6 @@ holiday_refresh($$)
|
|||||||
} elsif($l =~ m/^2/) { # Easter date: 2 +1 Ostermontag
|
} elsif($l =~ m/^2/) { # Easter date: 2 +1 Ostermontag
|
||||||
|
|
||||||
eval { require DateTime::Event::Easter } ;
|
eval { require DateTime::Event::Easter } ;
|
||||||
|
|
||||||
if( $@) {
|
if( $@) {
|
||||||
Log 1, "$@";
|
Log 1, "$@";
|
||||||
|
|
||||||
@ -93,6 +94,7 @@ holiday_refresh($$)
|
|||||||
my %wd = ("Sun"=>0, "Mon"=>1, "Tue"=>2, "Wed"=>3,
|
my %wd = ("Sun"=>0, "Mon"=>1, "Tue"=>2, "Wed"=>3,
|
||||||
"Thu"=>4, "Fri"=>5, "Sat"=>6);
|
"Thu"=>4, "Fri"=>5, "Sat"=>6);
|
||||||
my @md = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
my @md = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
||||||
|
$md[1]=29 if(schaltjahr($fd[5]+1900) && $fd[4] == 1);
|
||||||
my $wd = $wd{$a[2]};
|
my $wd = $wd{$a[2]};
|
||||||
if(!defined($wd)) {
|
if(!defined($wd)) {
|
||||||
Log 1, "Wrong timespec: $l";
|
Log 1, "Wrong timespec: $l";
|
||||||
@ -120,7 +122,9 @@ holiday_refresh($$)
|
|||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
close(FH);
|
||||||
|
|
||||||
RemoveInternalTimer($name);
|
RemoveInternalTimer($name);
|
||||||
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]); # Midnight
|
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]); # Midnight
|
||||||
@ -143,7 +147,7 @@ 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/);
|
return "wrong argument: need MM-DD" if($a[1] !~ m/^[01]\d-[0-3]\d$/);
|
||||||
return holiday_refresh($hash->{NAME}, $a[1]);
|
return holiday_refresh($hash->{NAME}, $a[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user